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

Side by Side Diff: bench/ResultsWriter.h

Issue 1302103002: VisualBenchTest: Write JSON output (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add comment Created 5 years, 4 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
« no previous file with comments | « no previous file | platform_tools/android/apps/robotium.cfg » ('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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 * 6 *
7 * Classes for writing out bench results in various formats. 7 * Classes for writing out bench results in various formats.
8 */ 8 */
9 9
10 #ifndef SkResultsWriter_DEFINED 10 #ifndef SkResultsWriter_DEFINED
11 #define SkResultsWriter_DEFINED 11 #define SkResultsWriter_DEFINED
12 12
13 #include "BenchLogger.h" 13 #include "BenchLogger.h"
14 #include "SkJSONCPP.h" 14 #include "SkJSONCPP.h"
15 #include "SkOSFile.h"
15 #include "SkStream.h" 16 #include "SkStream.h"
16 #include "SkString.h" 17 #include "SkString.h"
17 #include "SkTArray.h" 18 #include "SkTArray.h"
18 #include "SkTypes.h" 19 #include "SkTypes.h"
19 20
20 /** 21 /**
21 * Base class for writing out the bench results. 22 * Base class for writing out the bench results.
22 * 23 *
23 * Default implementation does nothing. 24 * Default implementation does nothing.
24 */ 25 */
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // Don't record if nan, or -nan. 110 // Don't record if nan, or -nan.
110 if (sk_double_isnan(ms)) { 111 if (sk_double_isnan(ms)) {
111 return; 112 return;
112 } 113 }
113 SkASSERT(fConfig); 114 SkASSERT(fConfig);
114 (*fConfig)[name] = ms; 115 (*fConfig)[name] = ms;
115 } 116 }
116 117
117 // Flush to storage now please. 118 // Flush to storage now please.
118 virtual void flush() { 119 virtual void flush() {
120 SkString dirname = SkOSPath::Dirname(fFilename.c_str());
121 if (!sk_exists(dirname.c_str(), kWrite_SkFILE_Flag)) {
122 if (!sk_mkdir(dirname.c_str())) {
123 SkDebugf("Failed to create directory.");
124 }
125 }
119 SkFILEWStream stream(fFilename.c_str()); 126 SkFILEWStream stream(fFilename.c_str());
120 stream.writeText(Json::StyledWriter().write(fRoot).c_str()); 127 stream.writeText(Json::StyledWriter().write(fRoot).c_str());
121 stream.flush(); 128 stream.flush();
122 } 129 }
123 130
124 private: 131 private:
125 SkString fFilename; 132 SkString fFilename;
126 Json::Value fRoot; 133 Json::Value fRoot;
127 Json::Value& fResults; 134 Json::Value& fResults;
128 Json::Value* fBench; 135 Json::Value* fBench;
129 Json::Value* fConfig; 136 Json::Value* fConfig;
130 }; 137 };
131 138
132 139
133 #endif 140 #endif
OLDNEW
« no previous file with comments | « no previous file | platform_tools/android/apps/robotium.cfg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698