Prevent app list doodle from being pinch-to-zoomed.
[chromium-blink-merge.git] / gpu / perftests / measurements.h
blob87d0c2aa83e1376851e792d6d22393dfca2eaee9
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_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "base/time/time.h"
13 namespace gfx {
14 class GPUTimingClient;
15 class GPUTimer;
18 namespace gpu {
20 struct Measurement {
21 Measurement();
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);
27 ~Measurement();
29 void PrintResult(const std::string& graph) const;
30 Measurement& Increment(const Measurement& m);
31 Measurement Divide(int a) const;
33 std::string name;
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 {
43 public:
44 explicit MeasurementTimers(gfx::GPUTimingClient* gpu_timing_client);
45 void Record();
46 Measurement GetAsMeasurement(const std::string& name);
47 ~MeasurementTimers();
49 private:
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_;
58 } // namespace gpu
60 #endif // GPU_PERFTESTS_MEASUREMENTS_H_