Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #ifndef GPU_PERFTESTS_MEASUREMENTS_H_ | |
| 6 #define GPU_PERFTESTS_MEASUREMENTS_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/time/time.h" | |
| 11 #include "base/timer/elapsed_timer.h" | |
| 12 #include "ui/gl/gl_bindings.h" | |
| 13 | |
| 14 namespace gpu { | |
| 15 | |
| 16 struct Measurement { | |
| 17 Measurement(); | |
| 18 Measurement(const Measurement& m); | |
| 19 Measurement(const std::string& name, | |
| 20 const base::TimeDelta wall_time, | |
| 21 const base::TimeDelta cpu_time, | |
| 22 const base::TimeDelta gpu_time); | |
| 23 ~Measurement(); | |
| 24 | |
| 25 void PrintResult() const; | |
| 26 Measurement& Increment(const Measurement& m); | |
| 27 Measurement Divide(int a) const; | |
| 28 | |
| 29 std::string name; | |
| 30 base::TimeDelta wall_time; | |
| 31 base::TimeDelta cpu_time; | |
| 32 base::TimeDelta gpu_time; | |
| 33 }; | |
| 34 | |
| 35 // Class to measure wall, cpu and gpu time deltas. | |
| 36 // The deltas are measured from the time of the object | |
| 37 // creation up to when Record is called. | |
| 38 class MeasurementTimers { | |
| 39 public: | |
| 40 MeasurementTimers(); | |
| 41 void Record(); | |
| 42 Measurement GetAsMeasurement(const std::string& name); | |
| 43 ~MeasurementTimers(); | |
| 44 | |
| 45 private: | |
| 46 base::ElapsedTimer wall_timer_; | |
|
piman
2015/01/30 21:12:04
ElapsedTimer uses TimeTicks::Now which can have lo
Daniele Castagna
2015/02/03 04:12:59
Done.
| |
| 47 base::TimeTicks cpu_time_begin_; | |
| 48 GLuint gl_queries_[2]; | |
| 49 | |
| 50 base::TimeDelta wall_time_; | |
| 51 base::TimeDelta cpu_time_; | |
| 52 }; | |
| 53 | |
| 54 } // namespace gpu | |
| 55 | |
| 56 #endif // GPU_PERFTESTS_MEASUREMENTS_H_ | |
| OLD | NEW |