aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm/DMBenchTask.h
blob: ac7030b5f01feace3adcf0eb191aa958d420ac7d (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef DMBenchTask_DEFINED
#define DMBenchTask_DEFINED

#include "DMReporter.h"
#include "DMTask.h"
#include "DMTaskRunner.h"
#include "SkBenchmark.h"
#include "SkString.h"
#include "SkTemplates.h"

// Tasks that run an SkBenchmark once as a check that it doesn't crash.

namespace DM {

class NonRenderingBenchTask : public CpuTask {
public:
    NonRenderingBenchTask(const char* config, Reporter*, TaskRunner*, BenchRegistry::Factory);

    virtual void draw() SK_OVERRIDE;
    virtual bool shouldSkip() const SK_OVERRIDE;
    virtual SkString name() const SK_OVERRIDE { return fName; }

private:
    SkAutoTDelete<SkBenchmark> fBench;
    const SkString fName;
};

class CpuBenchTask : public CpuTask {
public:
    CpuBenchTask(const char* config, Reporter*, TaskRunner*, BenchRegistry::Factory, SkColorType);

    virtual void draw() SK_OVERRIDE;
    virtual bool shouldSkip() const SK_OVERRIDE;
    virtual SkString name() const SK_OVERRIDE { return fName; }

private:
    SkAutoTDelete<SkBenchmark> fBench;
    const SkString fName;
    const SkColorType fColorType;
};

class GpuBenchTask : public GpuTask {
public:
    GpuBenchTask(const char* config,
                 Reporter*,
                 TaskRunner*,
                 BenchRegistry::Factory,
                 GrContextFactory::GLContextType,
                 int sampleCount);

    virtual void draw(GrContextFactory*) SK_OVERRIDE;
    virtual bool shouldSkip() const SK_OVERRIDE;
    virtual SkString name() const SK_OVERRIDE { return fName; }

private:
    SkAutoTDelete<SkBenchmark> fBench;
    const SkString fName;
    const GrContextFactory::GLContextType fContextType;
    int fSampleCount;
};

}  // namespace DM

#endif // DMBenchTask_DEFINED