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

Unified Diff: tools/VisualBench/TimingStateMachine.cpp

Issue 1427033003: DM+VB: WallTimer -> SkTime::GetNSecs(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweak 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/VisualBench/TimingStateMachine.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/VisualBench/TimingStateMachine.cpp
diff --git a/tools/VisualBench/TimingStateMachine.cpp b/tools/VisualBench/TimingStateMachine.cpp
index 85aab42ba9763ef3f3f7e6aeec1fbd61934e0ade..4dfa3f575575a75cf3acf936840345dcd4a96a97 100644
--- a/tools/VisualBench/TimingStateMachine.cpp
+++ b/tools/VisualBench/TimingStateMachine.cpp
@@ -14,6 +14,8 @@ DEFINE_int32(gpuFrameLag, 5, "Overestimate of maximum number of frames GPU is al
DEFINE_int32(frames, 5, "Number of frames of each skp to render per sample.");
DEFINE_double(loopMs, 5, "Each benchmark will be tuned until it takes loopsMs millseconds.");
+static double now_ms() { return SkTime::GetNSecs() * 1e-6; }
+
TimingStateMachine::TimingStateMachine()
: fCurrentFrame(0)
, fLoops(1)
@@ -28,7 +30,7 @@ TimingStateMachine::ParentEvents TimingStateMachine::nextFrame(bool preWarmBetwe
case kPreWarm_State: {
if (fCurrentFrame >= FLAGS_gpuFrameLag) {
fCurrentFrame = 0;
- fTimer.start();
+ fStartTime = now_ms();
fState = kTiming_State;
} else {
fCurrentFrame++;
@@ -63,7 +65,7 @@ TimingStateMachine::ParentEvents TimingStateMachine::nextFrame(bool preWarmBetwe
if (preWarmBetweenSamples) {
fState = kPreWarm_State;
} else {
- fTimer.start(); // start timing again, don't change state
+ fStartTime = now_ms();
}
} else {
fCurrentFrame++;
@@ -78,13 +80,11 @@ TimingStateMachine::ParentEvents TimingStateMachine::nextFrame(bool preWarmBetwe
}
inline double TimingStateMachine::elapsed() {
- fTimer.end();
- return fTimer.fWall;
+ return now_ms() - fStartTime;
}
void TimingStateMachine::resetTimingState() {
fCurrentFrame = 0;
- fTimer = WallTimer();
}
void TimingStateMachine::recordMeasurement() {
« no previous file with comments | « tools/VisualBench/TimingStateMachine.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698