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

Side by Side Diff: bench/BenchTimer.cpp

Issue 16069010: extend SkBenchmark to allow a bench to return a durationScale, which allows it to perform fewer act… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « bench/BenchTimer.h ('k') | bench/BitmapBench.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "BenchTimer.h" 8 #include "BenchTimer.h"
9 #if defined(SK_BUILD_FOR_WIN32) 9 #if defined(SK_BUILD_FOR_WIN32)
10 #include "BenchSysTimer_windows.h" 10 #include "BenchSysTimer_windows.h"
(...skipping 28 matching lines...) Expand all
39 } 39 }
40 40
41 BenchTimer::~BenchTimer() { 41 BenchTimer::~BenchTimer() {
42 delete fSysTimer; 42 delete fSysTimer;
43 delete fTruncatedSysTimer; 43 delete fTruncatedSysTimer;
44 #if SK_SUPPORT_GPU 44 #if SK_SUPPORT_GPU
45 delete fGpuTimer; 45 delete fGpuTimer;
46 #endif 46 #endif
47 } 47 }
48 48
49 void BenchTimer::start() { 49 void BenchTimer::start(double durationScale) {
50 fDurationScale = durationScale;
51
50 fSysTimer->startWall(); 52 fSysTimer->startWall();
51 fTruncatedSysTimer->startWall(); 53 fTruncatedSysTimer->startWall();
52 #if SK_SUPPORT_GPU 54 #if SK_SUPPORT_GPU
53 if (fGpuTimer) { 55 if (fGpuTimer) {
54 fGpuTimer->startGpu(); 56 fGpuTimer->startGpu();
55 } 57 }
56 #endif 58 #endif
57 fSysTimer->startCpu(); 59 fSysTimer->startCpu();
58 fTruncatedSysTimer->startCpu(); 60 fTruncatedSysTimer->startCpu();
59 } 61 }
60 62
61 void BenchTimer::end() { 63 void BenchTimer::end() {
62 fCpu = fSysTimer->endCpu(); 64 fCpu = fSysTimer->endCpu() * fDurationScale;
63 #if SK_SUPPORT_GPU 65 #if SK_SUPPORT_GPU
64 //It is important to stop the cpu clocks first, 66 //It is important to stop the cpu clocks first,
65 //as the following will cpu wait for the gpu to finish. 67 //as the following will cpu wait for the gpu to finish.
66 if (fGpuTimer) { 68 if (fGpuTimer) {
67 fGpu = fGpuTimer->endGpu(); 69 fGpu = fGpuTimer->endGpu() * fDurationScale;
68 } 70 }
69 #endif 71 #endif
70 fWall = fSysTimer->endWall(); 72 fWall = fSysTimer->endWall() * fDurationScale;
71 } 73 }
72 74
73 void BenchTimer::truncatedEnd() { 75 void BenchTimer::truncatedEnd() {
74 fTruncatedCpu = fTruncatedSysTimer->endCpu(); 76 fTruncatedCpu = fTruncatedSysTimer->endCpu() * fDurationScale;
75 fTruncatedWall = fTruncatedSysTimer->endWall(); 77 fTruncatedWall = fTruncatedSysTimer->endWall() * fDurationScale;
76 } 78 }
OLDNEW
« no previous file with comments | « bench/BenchTimer.h ('k') | bench/BitmapBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698