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

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

Issue 344213003: Move BenchTimer to tools as Timer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fixes Created 6 years, 6 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
« tools/timer/GpuTimer.cpp ('K') | « tools/timer/TimerData.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1
2 /* 1 /*
3 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
4 * 3 *
5 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
8 #include "TimerData.h" 7 #include "TimerData.h"
9 8
10 #include "BenchTimer.h" 9 #include "Timer.h"
11 #include <limits> 10 #include <limits>
12 11
13 using namespace std; 12 TimerData::TimerData(int maxNumTimings)
13 : fMaxNumTimings(maxNumTimings)
14 , fCurrTiming(0)
15 , fWallTimes(maxNumTimings)
16 , fTruncatedWallTimes(maxNumTimings)
17 , fCpuTimes(maxNumTimings)
18 , fTruncatedCpuTimes(maxNumTimings)
19 , fGpuTimes(maxNumTimings) {}
14 20
15 TimerData::TimerData(int maxNumTimings) 21 bool TimerData::appendTimes(Timer* timer) {
16 : fMaxNumTimings(maxNumTimings)
17 , fCurrTiming(0)
18 , fWallTimes(maxNumTimings)
19 , fTruncatedWallTimes(maxNumTimings)
20 , fCpuTimes(maxNumTimings)
21 , fTruncatedCpuTimes(maxNumTimings)
22 , fGpuTimes(maxNumTimings){
23 }
24
25 bool TimerData::appendTimes(BenchTimer* timer) {
26 SkASSERT(timer != NULL); 22 SkASSERT(timer != NULL);
27 if (fCurrTiming >= fMaxNumTimings) { 23 if (fCurrTiming >= fMaxNumTimings) {
28 return false; 24 return false;
29 } 25 }
30 26
31 fWallTimes[fCurrTiming] = timer->fWall; 27 fWallTimes[fCurrTiming] = timer->fWall;
32 fTruncatedWallTimes[fCurrTiming] = timer->fTruncatedWall; 28 fTruncatedWallTimes[fCurrTiming] = timer->fTruncatedWall;
33 fCpuTimes[fCurrTiming] = timer->fCpu; 29 fCpuTimes[fCurrTiming] = timer->fCpu;
34 fTruncatedCpuTimes[fCurrTiming] = timer->fTruncatedCpu; 30 fTruncatedCpuTimes[fCurrTiming] = timer->fTruncatedCpu;
35 fGpuTimes[fCurrTiming] = timer->fGpu; 31 fGpuTimes[fCurrTiming] = timer->fGpu;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 dataNode["cpu"] = cpuNode; 211 dataNode["cpu"] = cpuNode;
216 } 212 }
217 if (timerFlags & kTruncatedCpu_Flag) { 213 if (timerFlags & kTruncatedCpu_Flag) {
218 dataNode["trucCpu"] = truncCpu; 214 dataNode["trucCpu"] = truncCpu;
219 } 215 }
220 if ((timerFlags & kGpu_Flag) && gpuSum > 0) { 216 if ((timerFlags & kGpu_Flag) && gpuSum > 0) {
221 dataNode["gpu"] = gpuNode; 217 dataNode["gpu"] = gpuNode;
222 } 218 }
223 return dataNode; 219 return dataNode;
224 } 220 }
OLDNEW
« tools/timer/GpuTimer.cpp ('K') | « tools/timer/TimerData.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698