skia2/bench/TimerData.h
commit-bot@chromium.org 293a4b367a Revert of PictureBenchmark JSON logging (https://codereview.chromium.org/286903025/)
Reason for revert:
Broke some Windows builds; see http://skbug.com/2609 ('certain Windows Build-* bots failing since r14905').

Before re-landing with a fix, please send to some of the trybots that failed the first time.

Original issue's description:
> Add JSON logging support to bench_pictures by adding a PictureResultsWriter class (in tools/PictureResultsWriter.h) to process logging information, using a very similar style as bench/ResultsWriter.h
>
> JSON format described in code, above PictureJSONResultsWriter class
>
> BUG=skia:
>
> Committed: http://code.google.com/p/skia/source/detail?r=14906

R=bensong@google.com, jcgregorio@google.com, kelvinly@google.com
TBR=bensong@google.com, jcgregorio@google.com, kelvinly@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:2609

Author: epoger@google.com

Review URL: https://codereview.chromium.org/306483010

git-svn-id: http://skia.googlecode.com/svn/trunk@14910 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-05-27 21:51:38 +00:00

74 lines
2.0 KiB
C++

/*
* 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