skia2/bench/ResultsWriter.h
Mike Klein c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00

58 lines
1.5 KiB
C++

/*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* Classes for writing out bench results in various formats.
*/
#ifndef SkResultsWriter_DEFINED
#define SkResultsWriter_DEFINED
#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
#include "src/utils/SkJSONWriter.h"
/**
NanoJSONResultsWriter helps nanobench writes the test results out in the following format:
{
"key": {
"arch": "Arm7",
"gpu": "SGX540",
"os": "Android",
"model": "GalaxyNexus",
}
"gitHash": "d1830323662ae8ae06908b97f15180fd25808894",
"build_number": "1234",
"results" : {
"Xfermode_Luminosity_640_480" : {
"8888" : {
"median_ms" : 143.188128906250,
"min_ms" : 143.835957031250,
...
},
...
*/
class NanoJSONResultsWriter : public SkJSONWriter {
public:
NanoJSONResultsWriter(SkWStream* stream, Mode mode) : SkJSONWriter(stream, mode) {}
void beginBench(const char* name, int32_t x, int32_t y) {
SkString id = SkStringPrintf("%s_%d_%d", name, x, y);
this->beginObject(id.c_str());
}
void endBench() { this->endObject(); }
void appendMetric(const char* name, double value) {
// Don't record if nan, or -nan.
if (!sk_double_isnan(value)) {
this->appendDoubleDigits(name, value, 16);
}
}
};
#endif