X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2Fskia%2Ftools%2Fbench_record.cpp;h=4f928ee6dc77598c0c12c1980a23d379b32580a5;hb=4a1a0bdd01eef90b0826a0e761d3379d3715c10f;hp=0024c2ccdbea644eb600efec04e39672d9f76f0a;hpb=b1be5ca53587d23e7aeb77b26861fdc0a181ffd8;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/skia/tools/bench_record.cpp b/src/third_party/skia/tools/bench_record.cpp index 0024c2c..4f928ee 100644 --- a/src/third_party/skia/tools/bench_record.cpp +++ b/src/third_party/skia/tools/bench_record.cpp @@ -14,11 +14,9 @@ #include "SkStream.h" #include "SkString.h" -#include "BenchTimer.h" #include "LazyDecodeBitmap.h" #include "Stats.h" - -typedef WallTimer Timer; +#include "Timer.h" __SK_FORCE_IMAGE_DECODER_LINKING; @@ -81,12 +79,13 @@ static void bench_record(const SkPicture& src, rerecord(src, bbhFactory); // Rerecord once to see how many times we should loop to make timer overhead insignificant. - Timer timer; + WallTimer timer; + const double scale = timescale(); do { - timer.start(timescale()); + timer.start(); rerecord(src, bbhFactory); timer.end(); - } while (timer.fWall < timerOverhead); // Loop just in case something bizarre happens. + } while (timer.fWall * scale < timerOverhead); // Loop just in case something bizarre happens. // We want (timer overhead / measurement) to be less than FLAGS_overheadGoal. // So in each sample, we'll loop enough times to have made that true for our first measurement. @@ -94,12 +93,12 @@ static void bench_record(const SkPicture& src, SkAutoTMalloc samples(FLAGS_samples); for (int i = 0; i < FLAGS_samples; i++) { - timer.start(timescale()); + timer.start(); for (int j = 0; j < loops; j++) { rerecord(src, bbhFactory); } timer.end(); - samples[i] = timer.fWall / loops; + samples[i] = timer.fWall * scale / loops; } Stats stats(samples.get(), FLAGS_samples); @@ -132,12 +131,13 @@ int tool_main(int argc, char** argv) { // Each run will use this timer overhead estimate to guess how many times it should run. static const int kOverheadLoops = 10000000; - Timer timer; + WallTimer timer; double overheadEstimate = 0.0; + const double scale = timescale(); for (int i = 0; i < kOverheadLoops; i++) { - timer.start(timescale()); + timer.start(); timer.end(); - overheadEstimate += timer.fWall; + overheadEstimate += timer.fWall * scale; } overheadEstimate /= kOverheadLoops; @@ -149,7 +149,7 @@ int tool_main(int argc, char** argv) { continue; } - const SkString path = SkOSPath::SkPathJoin(FLAGS_skps[0], filename.c_str()); + const SkString path = SkOSPath::Join(FLAGS_skps[0], filename.c_str()); SkAutoTUnref stream(SkStream::NewFromFile(path.c_str())); if (!stream) {