| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * 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 |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 #include "TimerData.h" | 7 #include "TimerData.h" |
| 8 | 8 |
| 9 #include "Timer.h" | 9 #include "Timer.h" |
| 10 #include <limits> | 10 #include <limits> |
| 11 | 11 |
| 12 TimerData::TimerData(int maxNumTimings) | 12 TimerData::TimerData(int maxNumTimings) |
| 13 : fMaxNumTimings(maxNumTimings) | 13 : fMaxNumTimings(maxNumTimings) |
| 14 , fCurrTiming(0) | 14 , fCurrTiming(0) |
| 15 , fWallTimes(maxNumTimings) | 15 , fWallTimes(maxNumTimings) |
| 16 , fTruncatedWallTimes(maxNumTimings) | 16 , fTruncatedWallTimes(maxNumTimings) |
| 17 , fCpuTimes(maxNumTimings) | 17 , fCpuTimes(maxNumTimings) |
| 18 , fTruncatedCpuTimes(maxNumTimings) | 18 , fTruncatedCpuTimes(maxNumTimings) |
| 19 , fGpuTimes(maxNumTimings) {} | 19 , fGpuTimes(maxNumTimings) {} |
| 20 | 20 |
| 21 bool TimerData::appendTimes(Timer* timer) { | 21 bool TimerData::appendTimes(Timer* timer) { |
| 22 SkASSERT(timer != NULL); | 22 SkASSERT(timer != nullptr); |
| 23 if (fCurrTiming >= fMaxNumTimings) { | 23 if (fCurrTiming >= fMaxNumTimings) { |
| 24 return false; | 24 return false; |
| 25 } | 25 } |
| 26 | 26 |
| 27 fWallTimes[fCurrTiming] = timer->fWall; | 27 fWallTimes[fCurrTiming] = timer->fWall; |
| 28 fTruncatedWallTimes[fCurrTiming] = timer->fTruncatedWall; | 28 fTruncatedWallTimes[fCurrTiming] = timer->fTruncatedWall; |
| 29 fCpuTimes[fCurrTiming] = timer->fCpu; | 29 fCpuTimes[fCurrTiming] = timer->fCpu; |
| 30 fTruncatedCpuTimes[fCurrTiming] = timer->fTruncatedCpu; | 30 fTruncatedCpuTimes[fCurrTiming] = timer->fTruncatedCpu; |
| 31 fGpuTimes[fCurrTiming] = timer->fGpu; | 31 fGpuTimes[fCurrTiming] = timer->fGpu; |
| 32 | 32 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 dataNode["cpu"] = cpuNode; | 211 dataNode["cpu"] = cpuNode; |
| 212 } | 212 } |
| 213 if (timerFlags & kTruncatedCpu_Flag) { | 213 if (timerFlags & kTruncatedCpu_Flag) { |
| 214 dataNode["trucCpu"] = truncCpu; | 214 dataNode["trucCpu"] = truncCpu; |
| 215 } | 215 } |
| 216 if ((timerFlags & kGpu_Flag) && gpuSum > 0) { | 216 if ((timerFlags & kGpu_Flag) && gpuSum > 0) { |
| 217 dataNode["gpu"] = gpuNode; | 217 dataNode["gpu"] = gpuNode; |
| 218 } | 218 } |
| 219 return dataNode; | 219 return dataNode; |
| 220 } | 220 } |
| OLD | NEW |