blob: ed0ee473c18133e4f6a5372bccad48c0caa475f1 (
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
65
66
67
68
69
70
71
72
73
|
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef TimerData_DEFINED
#define TimerData_DEFINED
#include "SkString.h"
#include "SkTemplates.h"
class BenchTimer;
class TimerData {
public:
/**
* Constructs a TimerData to hold at most maxNumTimings sets of elapsed timer values.
**/
explicit TimerData(int maxNumTimings);
/**
* Collect times from the BenchTimer for an iteration. It will fail if called more often than
* indicated in the constructor.
*
* @param BenchTimer Must not be null.
*/
bool appendTimes(BenchTimer*);
enum Result {
kMin_Result,
kAvg_Result,
kPerIter_Result
};
enum TimerFlags {
kWall_Flag = 0x1,
kTruncatedWall_Flag = 0x2,
kCpu_Flag = 0x4,
kTruncatedCpu_Flag = 0x8,
kGpu_Flag = 0x10
};
/**
* Gets the timer data results as a string.
* @param doubleFormat printf-style format for doubles (e.g. "%02d")
* @param result the type of result desired
* @param the name of the config being timed (prepended to results string)
* @param timerFlags bitfield of TimerFlags values indicating which timers should be reported.
* @param itersPerTiming the number of test/bench iterations that correspond to each
* appendTimes() call, 1 when appendTimes is called for each iteration.
*/
SkString getResult(const char* doubleFormat,
Result result,
const char* configName,
uint32_t timerFlags,
int itersPerTiming = 1);
private:
int fMaxNumTimings;
int fCurrTiming;
SkAutoTArray<double> fWallTimes;
SkAutoTArray<double> fTruncatedWallTimes;
SkAutoTArray<double> fCpuTimes;
SkAutoTArray<double> fTruncatedCpuTimes;
SkAutoTArray<double> fGpuTimes;
};
#endif // TimerData_DEFINED
|