Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Side by Side Diff: tools/timer/TimerData.h

Issue 1422513003: SkTime::GetNSecs() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: #else std::chrono Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/timer/Timer.cpp ('k') | tools/timer/TimerData.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef TimerData_DEFINED
9 #define TimerData_DEFINED
10
11 #include "SkString.h"
12 #include "SkTemplates.h"
13
14 #ifdef SK_BUILD_FOR_WIN
15 #pragma warning(push)
16 #pragma warning(disable : 4530)
17 #endif
18
19 #include "SkJSONCPP.h"
20
21 #ifdef SK_BUILD_FOR_WIN
22 #pragma warning(pop)
23 #endif
24
25 class Timer;
26
27 class TimerData {
28 public:
29 /**
30 * Constructs a TimerData to hold at most maxNumTimings sets of elapsed time r values.
31 **/
32 explicit TimerData(int maxNumTimings);
33
34 /**
35 * Collect times from the Timer for an iteration. It will fail if called mor e often than
36 * indicated in the constructor.
37 *
38 * @param Timer Must not be null.
39 */
40 bool appendTimes(Timer*);
41
42 enum Result {
43 kMin_Result,
44 kAvg_Result,
45 kPerIter_Result
46 };
47
48 enum TimerFlags {
49 kWall_Flag = 0x1,
50 kTruncatedWall_Flag = 0x2,
51 kCpu_Flag = 0x4,
52 kTruncatedCpu_Flag = 0x8,
53 kGpu_Flag = 0x10
54 };
55
56 /**
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 s hould 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 iteratio n.
64 */
65 SkString getResult(const char* doubleFormat,
66 Result result,
67 const char* configName,
68 uint32_t timerFlags,
69 int itersPerTiming = 1);
70 Json::Value getJSON(uint32_t timerFlags,
71 Result result,
72 int itersPerTiming = 1);
73
74 private:
75 int fMaxNumTimings;
76 int fCurrTiming;
77
78 SkAutoTArray<double> fWallTimes;
79 SkAutoTArray<double> fTruncatedWallTimes;
80 SkAutoTArray<double> fCpuTimes;
81 SkAutoTArray<double> fTruncatedCpuTimes;
82 SkAutoTArray<double> fGpuTimes;
83 };
84
85 #endif // TimerData_DEFINED
OLDNEW
« no previous file with comments | « tools/timer/Timer.cpp ('k') | tools/timer/TimerData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698