OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #ifndef TimerData_DEFINED | 9 #ifndef TimerData_DEFINED |
10 #define TimerData_DEFINED | 10 #define TimerData_DEFINED |
11 | 11 |
12 #include "SkString.h" | 12 #include "SkString.h" |
13 #include "SkTemplates.h" | |
14 | |
13 | 15 |
14 class BenchTimer; | 16 class BenchTimer; |
15 | 17 |
16 class TimerData { | 18 class TimerData { |
17 public: | 19 public: |
18 TimerData(const SkString& perIterTimeFormat, const SkString& normalTimeForma t); | 20 /** |
21 * Constructs a TimerData to hold at most maxNumTimings sets of elapsed time r values. | |
22 **/ | |
23 explicit TimerData(int maxNumTimings); | |
19 | 24 |
20 /** | 25 /** |
21 * Append the value from each timer in BenchTimer to our various strings, an d update the | 26 * Collect times from the BenchTimer for an iteration. It will fail if calle d more often than |
22 * minimum and sum times. | 27 * indicated in the constructor. |
28 * | |
23 * @param BenchTimer Must not be null. | 29 * @param BenchTimer Must not be null. |
24 * @param last True if this is the last set of times to add. | |
25 */ | 30 */ |
26 void appendTimes(BenchTimer*, bool last); | 31 bool appendTimes(BenchTimer*); |
scroggo
2013/07/30 19:12:34
This boolean result is never used.
bsalomon
2013/07/31 15:21:39
I put SkAssertResult around the callers.
| |
27 SkString getResult(bool logPerIter, bool printMin, int repeatDraw, const cha r* configName, | 32 |
28 bool showWallTime, bool showTruncatedWallTime, bool showC puTime, | 33 enum Result { |
29 bool showTruncatedCpuTime, bool showGpuTime); | 34 kMin_Result, |
35 kAvg_Result, | |
36 kPerIter_Result | |
37 }; | |
38 | |
39 enum TimerFlags { | |
40 kWall_Flag = 0x1, | |
41 kTruncatedWall_Flag = 0x2, | |
42 kCpu_Flag = 0x4, | |
43 kTruncatedCpu_Flag = 0x8, | |
44 kGpu_Flag = 0x10 | |
45 }; | |
46 | |
47 SkString getResult(const char* doubleFormat, | |
48 Result result, | |
49 const char* configName, | |
50 uint32_t timerFlags, | |
51 int itersPerTiming = 1); | |
scroggo
2013/07/30 19:12:34
Could you add a comment explaining itersPerTiming?
bsalomon
2013/07/31 15:21:39
Done.
| |
30 private: | 52 private: |
31 SkString fWallStr; | 53 int fMaxNumTimings; |
32 SkString fTruncatedWallStr; | 54 int fCurrTiming; |
33 SkString fCpuStr; | |
34 SkString fTruncatedCpuStr; | |
35 SkString fGpuStr; | |
36 double fWallSum, fWallMin; | |
37 double fTruncatedWallSum, fTruncatedWallMin; | |
38 double fCpuSum, fCpuMin; | |
39 double fTruncatedCpuSum, fTruncatedCpuMin; | |
40 double fGpuSum, fGpuMin; | |
41 | 55 |
42 SkString fPerIterTimeFormat; | 56 SkAutoTArray<double> fWallTimes; |
43 SkString fNormalTimeFormat; | 57 SkAutoTArray<double> fTruncatedWallTimes; |
58 SkAutoTArray<double> fCpuTimes; | |
59 SkAutoTArray<double> fTruncatedCpuTimes; | |
60 SkAutoTArray<double> fGpuTimes; | |
44 }; | 61 }; |
45 | 62 |
46 #endif // TimerData_DEFINED | 63 #endif // TimerData_DEFINED |
OLD | NEW |