1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef GPU_PERFTESTS_MEASUREMENTS_H_
6 #define GPU_PERFTESTS_MEASUREMENTS_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "base/time/time.h"
14 class GPUTimingClient
;
22 Measurement(const Measurement
& m
);
23 Measurement(const std::string
& name
,
24 const base::TimeDelta wall_time
,
25 const base::TimeDelta cpu_time
,
26 const base::TimeDelta gpu_time
);
29 void PrintResult(const std::string
& graph
) const;
30 Measurement
& Increment(const Measurement
& m
);
31 Measurement
Divide(int a
) const;
34 base::TimeDelta wall_time
;
35 base::TimeDelta cpu_time
;
36 base::TimeDelta gpu_time
;
39 // Class to measure wall, cpu and gpu time deltas.
40 // The deltas are measured from the time of the object
41 // creation up to when Record is called.
42 class MeasurementTimers
{
44 explicit MeasurementTimers(gfx::GPUTimingClient
* gpu_timing_client
);
46 Measurement
GetAsMeasurement(const std::string
& name
);
50 base::TimeTicks wall_time_start_
;
51 base::TimeTicks cpu_time_start_
;
52 scoped_ptr
<gfx::GPUTimer
> gpu_timer_
;
54 base::TimeDelta wall_time_
;
55 base::TimeDelta cpu_time_
;
60 #endif // GPU_PERFTESTS_MEASUREMENTS_H_