OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |