Chromium Code Reviews| Index: bench/TimerData.h |
| diff --git a/bench/TimerData.h b/bench/TimerData.h |
| index d97a0632aadf2eaff86e76123d22e2719174518c..db7c78164d074d481e376cb4c3f6c74fb6546d86 100644 |
| --- a/bench/TimerData.h |
| +++ b/bench/TimerData.h |
| @@ -10,37 +10,54 @@ |
| #define TimerData_DEFINED |
| #include "SkString.h" |
| +#include "SkTemplates.h" |
| + |
| class BenchTimer; |
| class TimerData { |
| public: |
| - TimerData(const SkString& perIterTimeFormat, const SkString& normalTimeFormat); |
| + /** |
| + * Constructs a TimerData to hold at most maxNumTimings sets of elapsed timer values. |
| + **/ |
| + explicit TimerData(int maxNumTimings); |
| /** |
| - * Append the value from each timer in BenchTimer to our various strings, and update the |
| - * minimum and sum times. |
| + * Collect times from the BenchTimer for an iteration. It will fail if called more often than |
| + * indicated in the constructor. |
| + * |
| * @param BenchTimer Must not be null. |
| - * @param last True if this is the last set of times to add. |
| */ |
| - void appendTimes(BenchTimer*, bool last); |
| - SkString getResult(bool logPerIter, bool printMin, int repeatDraw, const char* configName, |
| - bool showWallTime, bool showTruncatedWallTime, bool showCpuTime, |
| - bool showTruncatedCpuTime, bool showGpuTime); |
| + 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.
|
| + |
| + enum Result { |
| + kMin_Result, |
| + kAvg_Result, |
| + kPerIter_Result |
| + }; |
| + |
| + enum TimerFlags { |
| + kWall_Flag = 0x1, |
| + kTruncatedWall_Flag = 0x2, |
| + kCpu_Flag = 0x4, |
| + kTruncatedCpu_Flag = 0x8, |
| + kGpu_Flag = 0x10 |
| + }; |
| + |
| + SkString getResult(const char* doubleFormat, |
| + Result result, |
| + const char* configName, |
| + uint32_t timerFlags, |
| + 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.
|
| private: |
| - SkString fWallStr; |
| - SkString fTruncatedWallStr; |
| - SkString fCpuStr; |
| - SkString fTruncatedCpuStr; |
| - SkString fGpuStr; |
| - double fWallSum, fWallMin; |
| - double fTruncatedWallSum, fTruncatedWallMin; |
| - double fCpuSum, fCpuMin; |
| - double fTruncatedCpuSum, fTruncatedCpuMin; |
| - double fGpuSum, fGpuMin; |
| - |
| - SkString fPerIterTimeFormat; |
| - SkString fNormalTimeFormat; |
| + int fMaxNumTimings; |
| + int fCurrTiming; |
| + |
| + SkAutoTArray<double> fWallTimes; |
| + SkAutoTArray<double> fTruncatedWallTimes; |
| + SkAutoTArray<double> fCpuTimes; |
| + SkAutoTArray<double> fTruncatedCpuTimes; |
| + SkAutoTArray<double> fGpuTimes; |
| }; |
| #endif // TimerData_DEFINED |