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

Unified 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, 7 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 | « bench/BenchTimer.h ('k') | bench/BitmapBench.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/BenchTimer.cpp
diff --git a/bench/BenchTimer.cpp b/bench/BenchTimer.cpp
index ab9dfdaf18caef23d4113b64fbe62689fc833e64..3617f9de58b243253499f65df6bf340153a6d8da 100644
--- a/bench/BenchTimer.cpp
+++ b/bench/BenchTimer.cpp
@@ -46,7 +46,9 @@ BenchTimer::~BenchTimer() {
#endif
}
-void BenchTimer::start() {
+void BenchTimer::start(double durationScale) {
+ fDurationScale = durationScale;
+
fSysTimer->startWall();
fTruncatedSysTimer->startWall();
#if SK_SUPPORT_GPU
@@ -59,18 +61,18 @@ void BenchTimer::start() {
}
void BenchTimer::end() {
- fCpu = fSysTimer->endCpu();
+ fCpu = fSysTimer->endCpu() * fDurationScale;
#if SK_SUPPORT_GPU
//It is important to stop the cpu clocks first,
//as the following will cpu wait for the gpu to finish.
if (fGpuTimer) {
- fGpu = fGpuTimer->endGpu();
+ fGpu = fGpuTimer->endGpu() * fDurationScale;
}
#endif
- fWall = fSysTimer->endWall();
+ fWall = fSysTimer->endWall() * fDurationScale;
}
void BenchTimer::truncatedEnd() {
- fTruncatedCpu = fTruncatedSysTimer->endCpu();
- fTruncatedWall = fTruncatedSysTimer->endWall();
+ fTruncatedCpu = fTruncatedSysTimer->endCpu() * fDurationScale;
+ fTruncatedWall = fTruncatedSysTimer->endWall() * fDurationScale;
}
« 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