2 * Copyright 2012 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef TimerData_DEFINED
9 #define TimerData_DEFINED
12 #include "SkTemplates.h"
14 #ifdef SK_BUILD_FOR_WIN
16 #pragma warning(disable : 4530)
19 #include "SkJSONCPP.h"
21 #ifdef SK_BUILD_FOR_WIN
30 * Constructs a TimerData to hold at most maxNumTimings sets of elapsed timer values.
32 explicit TimerData(int maxNumTimings);
35 * Collect times from the Timer for an iteration. It will fail if called more often than
36 * indicated in the constructor.
38 * @param Timer Must not be null.
40 bool appendTimes(Timer*);
50 kTruncatedWall_Flag = 0x2,
52 kTruncatedCpu_Flag = 0x8,
57 * Gets the timer data results as a string.
58 * @param doubleFormat printf-style format for doubles (e.g. "%02d")
59 * @param result the type of result desired
60 * @param the name of the config being timed (prepended to results string)
61 * @param timerFlags bitfield of TimerFlags values indicating which timers should be reported.
62 * @param itersPerTiming the number of test/bench iterations that correspond to each
63 * appendTimes() call, 1 when appendTimes is called for each iteration.
65 SkString getResult(const char* doubleFormat,
67 const char* configName,
69 int itersPerTiming = 1);
70 Json::Value getJSON(uint32_t timerFlags,
72 int itersPerTiming = 1);
78 SkAutoTArray<double> fWallTimes;
79 SkAutoTArray<double> fTruncatedWallTimes;
80 SkAutoTArray<double> fCpuTimes;
81 SkAutoTArray<double> fTruncatedCpuTimes;
82 SkAutoTArray<double> fGpuTimes;
85 #endif // TimerData_DEFINED