Flutter Engine
The Flutter Engine
ResultsWriter.h
Go to the documentation of this file.
1/*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 *
7 * Classes for writing out bench results in various formats.
8 */
9
10#ifndef SkResultsWriter_DEFINED
11#define SkResultsWriter_DEFINED
12
16#include <cmath>
17
18/**
19 NanoJSONResultsWriter helps nanobench writes the test results out in the following format:
20
21 {
22 "key": {
23 "arch": "Arm7",
24 "gpu": "SGX540",
25 "os": "Android",
26 "model": "GalaxyNexus",
27 }
28 "gitHash": "d1830323662ae8ae06908b97f15180fd25808894",
29 "build_number": "1234",
30 "results" : {
31 "Xfermode_Luminosity_640_480" : {
32 "8888" : {
33 "median_ms" : 143.188128906250,
34 "min_ms" : 143.835957031250,
35 ...
36 },
37 ...
38*/
40public:
42
43 void beginBench(const char* name, int32_t x, int32_t y) {
44 SkString id = SkStringPrintf("%s_%d_%d", name, x, y);
45 this->beginObject(id.c_str());
46 }
47
48 void endBench() { this->endObject(); }
49
50 void appendMetric(const char* name, double value) {
51 // Don't record if NaN or Inf.
52 if (std::isfinite(value)) {
53 this->appendDoubleDigits(name, value, 16);
54 }
55 }
56};
57
58#endif
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
void beginBench(const char *name, int32_t x, int32_t y)
Definition: ResultsWriter.h:43
void appendMetric(const char *name, double value)
Definition: ResultsWriter.h:50
NanoJSONResultsWriter(SkWStream *stream, Mode mode)
Definition: ResultsWriter.h:41
void beginObject(const char *name=nullptr, bool multiline=true)
Definition: SkJSONWriter.h:114
void endObject()
Definition: SkJSONWriter.h:126
void appendDoubleDigits(double value, int digits)
Definition: SkJSONWriter.h:247
uint8_t value
double y
double x
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228
SINT bool isfinite(const Vec< N, T > &v)
Definition: SkVx.h:1003