diff options
author | mtklein <mtklein@chromium.org> | 2014-12-04 08:46:51 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-04 08:46:51 -0800 |
commit | 051e56df8f14fae68f0e990f78b85494c2ce4a6b (patch) | |
tree | dec51eb5dd9f68d62e7112308ef428006b6c3c69 | |
parent | eeb6f0c3c0eed1673d0d335666e78e65243a411b (diff) |
Upload picture byte size and op count metrics for SKP recording.
Look okay?
{
"results" : {
"desk_amazon.skp_1264_3999" : {
"nonrendering" : {
"bytes" : 75656,
"max_ms" : 1.150187,
"mean_ms" : 1.150187,
"median_ms" : 1.150187,
"min_ms" : 1.150187,
"ops" : 659,
"options" : {
"bench_type" : "recording",
"clip" : "0 0 1000 1000",
"name" : "desk_amazon.skp",
"scale" : "1",
"source_type" : "skp"
}
}
},
...
BUG=skia:
Review URL: https://codereview.chromium.org/773323002
-rw-r--r-- | bench/ResultsWriter.h | 6 | ||||
-rw-r--r-- | bench/nanobench.cpp | 19 |
2 files changed, 17 insertions, 8 deletions
diff --git a/bench/ResultsWriter.h b/bench/ResultsWriter.h index b8d97075a1..f53a980de4 100644 --- a/bench/ResultsWriter.h +++ b/bench/ResultsWriter.h @@ -34,7 +34,7 @@ public: virtual void property(const char name[], const char value[]) {} // Denote the start of a specific benchmark. Once bench is called, - // then config and timer can be called multiple times to record runs. + // then config and metric can be called multiple times to record runs. virtual void bench(const char name[], int32_t x, int32_t y) {} // Record the specific configuration a bench is run under, such as "8888". @@ -44,7 +44,7 @@ public: virtual void configOption(const char name[], const char* value) {} // Record a single test metric. - virtual void timer(const char name[], double ms) {} + virtual void metric(const char name[], double ms) {} // Flush to storage now please. virtual void flush() {} @@ -105,7 +105,7 @@ public: virtual void configOption(const char name[], const char* value) { (*fConfig)["options"][name] = value; } - virtual void timer(const char name[], double ms) { + virtual void metric(const char name[], double ms) { // Don't record if nan, or -nan. if (sk_double_isnan(ms)) { return; diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index 03fabc44f1..3f8919d260 100644 --- a/bench/nanobench.cpp +++ b/bench/nanobench.cpp @@ -24,6 +24,7 @@ #include "SkGraphics.h" #include "SkOSFile.h" #include "SkPictureRecorder.h" +#include "SkPictureUtils.h" #include "SkString.h" #include "SkSurface.h" #include "SkTaskGroup.h" @@ -524,6 +525,8 @@ public: SkString name = SkOSPath::Basename(path.c_str()); fSourceType = "skp"; fBenchType = "recording"; + fSKPBytes = SkPictureUtils::ApproximateBytesUsed(pic); + fSKPOps = pic->approximateOpCount(); return SkNEW_ARGS(RecordingBench, (name.c_str(), pic.get(), FLAGS_bbh)); } @@ -578,6 +581,10 @@ public: log->configOption("multi_picture_draw", fUseMPDs[fCurrentUseMPD-1] ? "true" : "false"); } } + if (0 == strcmp(fBenchType, "recording")) { + log->metric("bytes", fSKPBytes); + log->metric("ops", fSKPOps); + } } private: @@ -588,6 +595,8 @@ private: SkTArray<SkString> fSKPs; SkTArray<bool> fUseMPDs; + double fSKPBytes, fSKPOps; + const char* fSourceType; // What we're benching: bench, GM, SKP, ... const char* fBenchType; // How we bench it: micro, recording, playback, ... int fCurrentRecording; @@ -723,11 +732,11 @@ int nanobench_main() { fill_gpu_options(log.get(), targets[j]->gl); } #endif - log->timer("min_ms", stats.min); - log->timer("median_ms", stats.median); - log->timer("mean_ms", stats.mean); - log->timer("max_ms", stats.max); - log->timer("stddev_ms", sqrt(stats.var)); + log->metric("min_ms", stats.min); + log->metric("median_ms", stats.median); + log->metric("mean_ms", stats.mean); + log->metric("max_ms", stats.max); + log->metric("stddev_ms", sqrt(stats.var)); if (runs++ % FLAGS_flushEvery == 0) { log->flush(); } |