aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/VisualBench/VisualBenchmarkStream.h
blob: 71b6c972f2baa4509a3bbbf48039966a40aa1480 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * Copyright 2015 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 *
 */

#ifndef VisualBenchmarkStream_DEFINED
#define VisualBenchmarkStream_DEFINED

#include "Benchmark.h"
#include "gm.h"
#include "SkCommandLineFlags.h"
#include "SkPicture.h"

DECLARE_string(match);

class VisualBenchmarkStream {
public:
    VisualBenchmarkStream(const SkSurfaceProps&, bool justSKP = false);

    static sk_sp<SkPicture> ReadPicture(const char* path);

    Benchmark* next();
    Benchmark* current() { return fBenchmark.get(); }

private:
    Benchmark* innerNext();

    SkSurfaceProps fSurfaceProps;
    const BenchRegistry* fBenches;
    const skiagm::GMRegistry* fGMs;
    SkTArray<SkString> fSKPs;
    SkAutoTUnref<Benchmark> fBenchmark;

    const char* fSourceType;  // What we're benching: bench, GM, SKP, ...
    const char* fBenchType;   // How we bench it: micro, playback, ...
    int fCurrentSKP;
    bool fIsWarmedUp;
};

#endif