diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-27 21:51:38 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-27 21:51:38 +0000 |
commit | 293a4b367ae5b89384c364737ef76099fd3f0101 (patch) | |
tree | c3d734dab256af6de77f7ee2f8b039c77c35ce93 /bench | |
parent | 466f5f3e44e703ca58b43ac1c4ac3bfa0e1ff024 (diff) |
Revert of PictureBenchmark JSON logging (https://codereview.chromium.org/286903025/)
Reason for revert:
Broke some Windows builds; see http://skbug.com/2609 ('certain Windows Build-* bots failing since r14905').
Before re-landing with a fix, please send to some of the trybots that failed the first time.
Original issue's description:
> Add JSON logging support to bench_pictures by adding a PictureResultsWriter class (in tools/PictureResultsWriter.h) to process logging information, using a very similar style as bench/ResultsWriter.h
>
> JSON format described in code, above PictureJSONResultsWriter class
>
> BUG=skia:
>
> Committed: http://code.google.com/p/skia/source/detail?r=14906
R=bensong@google.com, jcgregorio@google.com, kelvinly@google.com
TBR=bensong@google.com, jcgregorio@google.com, kelvinly@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:2609
Author: epoger@google.com
Review URL: https://codereview.chromium.org/306483010
git-svn-id: http://skia.googlecode.com/svn/trunk@14910 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench')
-rw-r--r-- | bench/ResultsWriter.cpp | 33 | ||||
-rw-r--r-- | bench/ResultsWriter.h | 26 | ||||
-rw-r--r-- | bench/TimerData.cpp | 83 | ||||
-rw-r--r-- | bench/TimerData.h | 4 |
4 files changed, 21 insertions, 125 deletions
diff --git a/bench/ResultsWriter.cpp b/bench/ResultsWriter.cpp deleted file mode 100644 index 0bfcba8b1e..0000000000 --- a/bench/ResultsWriter.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - * - * Helper functions for result writing operations. - */ - -#include "ResultsWriter.h" - -#ifdef SK_BUILD_JSON_WRITER - -Json::Value* SkFindNamedNode(Json::Value* root, const char name[]) { - Json::Value* search_results = NULL; - for(Json::Value::iterator iter = root->begin(); - iter!= root->end(); ++iter) { - if(SkString(name).equals((*iter)["name"].asCString())) { - search_results = &(*iter); - break; - } - } - - if(search_results != NULL) { - return search_results; - } else { - Json::Value* new_val = &(root->append(Json::Value())); - (*new_val)["name"] = name; - return new_val; - } -} - -#endif // SK_BUILD_JSON_WRITER diff --git a/bench/ResultsWriter.h b/bench/ResultsWriter.h index c66593864f..a9eef802bd 100644 --- a/bench/ResultsWriter.h +++ b/bench/ResultsWriter.h @@ -101,9 +101,26 @@ private: * }, * ... */ - -Json::Value* SkFindNamedNode(Json::Value* root, const char name[]); class JSONResultsWriter : public ResultsWriter { +private: + Json::Value* find_named_node(Json::Value* root, const char name[]) { + Json::Value* search_results = NULL; + for(Json::Value::iterator iter = root->begin(); + iter!= root->end(); ++iter) { + if(SkString(name).equals((*iter)["name"].asCString())) { + search_results = &(*iter); + break; + } + } + + if(search_results != NULL) { + return search_results; + } else { + Json::Value* new_val = &(root->append(Json::Value())); + (*new_val)["name"] = name; + return new_val; + } + } public: explicit JSONResultsWriter(const char filename[]) : fFilename(filename) @@ -121,12 +138,12 @@ public: sk_name.appendS32(x); sk_name.append("_"); sk_name.appendS32(y); - Json::Value* bench_node = SkFindNamedNode(&fResults, sk_name.c_str()); + Json::Value* bench_node = find_named_node(&fResults, sk_name.c_str()); fBench = &(*bench_node)["results"]; } virtual void config(const char name[]) { SkASSERT(NULL != fBench); - fConfig = SkFindNamedNode(fBench, name); + fConfig = find_named_node(fBench, name); } virtual void timer(const char name[], double ms) { SkASSERT(NULL != fConfig); @@ -147,7 +164,6 @@ private: }; #endif // SK_BUILD_JSON_WRITER - /** * This ResultsWriter writes out to multiple ResultsWriters. */ diff --git a/bench/TimerData.cpp b/bench/TimerData.cpp index f72319e761..a86f29394f 100644 --- a/bench/TimerData.cpp +++ b/bench/TimerData.cpp @@ -140,86 +140,3 @@ SkString TimerData::getResult(const char* doubleFormat, } return str; } - -Json::Value TimerData::getJSON(uint32_t timerFlags, - Result result, - int itersPerTiming) { - SkASSERT(itersPerTiming >= 1); - Json::Value dataNode; - Json::Value wallNode, truncWall, cpuNode, truncCpu, gpuNode; - if (!fCurrTiming) { - return dataNode; - } - - int numTimings = fCurrTiming; - - double wallMin = std::numeric_limits<double>::max(); - double truncWallMin = std::numeric_limits<double>::max(); - double cpuMin = std::numeric_limits<double>::max(); - double truncCpuMin = std::numeric_limits<double>::max(); - double gpuMin = std::numeric_limits<double>::max(); - - double wallSum = 0; - double truncWallSum = 0; - double cpuSum = 0; - double truncCpuSum = 0; - double gpuSum = 0; - - for (int i = 0; i < numTimings; ++i) { - if (kPerIter_Result == result) { - wallNode.append(fWallTimes[i] / itersPerTiming); - truncWall.append(fTruncatedWallTimes[i] / itersPerTiming); - cpuNode.append(fCpuTimes[i] / itersPerTiming); - truncCpu.append(fTruncatedCpuTimes[i] / itersPerTiming); - gpuNode.append(fGpuTimes[i] / itersPerTiming); - } else if (kMin_Result == result) { - wallMin = SkTMin(wallMin, fWallTimes[i]); - truncWallMin = SkTMin(truncWallMin, fTruncatedWallTimes[i]); - cpuMin = SkTMin(cpuMin, fCpuTimes[i]); - truncCpuMin = SkTMin(truncCpuMin, fTruncatedCpuTimes[i]); - gpuMin = SkTMin(gpuMin, fGpuTimes[i]); - } else { - SkASSERT(kAvg_Result == result); - wallSum += fWallTimes[i]; - truncWallSum += fTruncatedWallTimes[i]; - cpuSum += fCpuTimes[i]; - truncCpuSum += fTruncatedCpuTimes[i]; - } - - // We always track the GPU sum because whether it is non-zero indicates if valid gpu times - // were recorded at all. - gpuSum += fGpuTimes[i]; - } - - if (kMin_Result == result) { - wallNode.append(wallMin / itersPerTiming); - truncWall.append(truncWallMin / itersPerTiming); - cpuNode.append(cpuMin / itersPerTiming); - truncCpu.append(truncCpuMin / itersPerTiming); - gpuNode.append(gpuMin / itersPerTiming); - } else if (kAvg_Result == result) { - int divisor = numTimings * itersPerTiming; - wallNode.append(wallSum / divisor); - truncWall.append(truncWallSum / divisor); - cpuNode.append(cpuSum / divisor); - truncCpu.append(truncCpuSum / divisor); - gpuNode.append(gpuSum / divisor); - } - - if (timerFlags & kWall_Flag) { - dataNode["wall"] = wallNode; - } - if (timerFlags & kTruncatedWall_Flag) { - dataNode["truncWall"] = truncWall; - } - if (timerFlags & kCpu_Flag) { - dataNode["cpu"] = cpuNode; - } - if (timerFlags & kTruncatedCpu_Flag) { - dataNode["trucCpu"] = truncCpu; - } - if ((timerFlags & kGpu_Flag) && gpuSum > 0) { - dataNode["gpu"] = gpuNode; - } - return dataNode; -} diff --git a/bench/TimerData.h b/bench/TimerData.h index 50539c7522..ed0ee473c1 100644 --- a/bench/TimerData.h +++ b/bench/TimerData.h @@ -9,7 +9,6 @@ #ifndef TimerData_DEFINED #define TimerData_DEFINED -#include "SkJSONCPP.h" #include "SkString.h" #include "SkTemplates.h" @@ -59,9 +58,6 @@ public: const char* configName, uint32_t timerFlags, int itersPerTiming = 1); - Json::Value getJSON(uint32_t timerFlags, - Result result, - int itersPerTiming = 1); private: int fMaxNumTimings; |