skia2/bench/TimerData.h
scroggo@google.com 9a4125283a Report data from bench_pictures in the same fashion as bench.
Move SkBenchLogger into separate files and make bench_pictures use it.
Remove sk_tools::print_msg, since SkBenchLogger is now used instead.

Combine picture_benchmark with bench_pictures, since that is the
only project that uses it.

Refactor the aggregator for bench timer data into its own class and
make bench_pictures use it.

Consolidate the various virtual PictureBenchmark::run functions
into one for reuse.

BUG=https://code.google.com/p/skia/issues/detail?id=822

Review URL: https://codereview.appspot.com/6488086

git-svn-id: http://skia.googlecode.com/svn/trunk@5432 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-09-07 15:21:18 +00:00

47 lines
1.3 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"
class BenchTimer;
class TimerData {
public:
TimerData(const SkString& perIterTimeFormat, const SkString& normalTimeFormat);
/**
* Append the value from each timer in BenchTimer to our various strings, and update the
* minimum and sum times.
* @param BenchTimer Must not be null.
* @param last True if this is the last set of times to add.
*/
void appendTimes(BenchTimer*, bool last);
SkString getResult(bool logPerIter, bool printMin, int repeatDraw, const char* configName,
bool showWallTime, bool showTruncatedWallTime, bool showCpuTime,
bool showTruncatedCpuTime, bool showGpuTime);
private:
SkString fWallStr;
SkString fTruncatedWallStr;
SkString fCpuStr;
SkString fTruncatedCpuStr;
SkString fGpuStr;
double fWallSum, fWallMin;
double fTruncatedWallSum, fTruncatedWallMin;
double fCpuSum, fCpuMin;
double fTruncatedCpuSum, fTruncatedCpuMin;
double fGpuSum, fGpuMin;
SkString fPerIterTimeFormat;
SkString fNormalTimeFormat;
};
#endif // TimerData_DEFINED