// Record a single test metric.
virtual void timer(const char name[], double ms) {}
+
+ // Flush to storage now please.
+ virtual void flush() {}
};
/**
, fConfig(NULL) {}
~NanoJSONResultsWriter() {
- SkFILEWStream stream(fFilename.c_str());
- stream.writeText(Json::StyledWriter().write(fRoot).c_str());
- stream.flush();
+ this->flush();
}
// Added under "key".
(*fConfig)[name] = ms;
}
+ // Flush to storage now please.
+ virtual void flush() {
+ SkFILEWStream stream(fFilename.c_str());
+ stream.writeText(Json::StyledWriter().write(fRoot).c_str());
+ stream.flush();
+ }
+
private:
SkString fFilename;
Json::Value fRoot;
DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs.");
DEFINE_string(scales, "1.0", "Space-separated scales for SKPs.");
DEFINE_bool(bbh, true, "Build a BBH for SKPs?");
+DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run.");
static SkString humanize(double ms) {
if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6));
SkTDArray<Config> configs;
create_configs(&configs);
+ int runs = 0;
BenchmarkStream benchStream;
while (Benchmark* b = benchStream.next()) {
SkAutoTDelete<Benchmark> bench(b);
log->timer("mean_ms", stats.mean);
log->timer("max_ms", stats.max);
log->timer("stddev_ms", sqrt(stats.var));
+ if (runs++ % FLAGS_flushEvery == 0) {
+ log->flush();
+ }
if (kAutoTuneLoops != FLAGS_loops) {
if (targets.count() == 1) {