Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5573)

Unified Diff: bench/DecodeBench.cpp

Issue 23478013: Major bench refactoring. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: merge with head agani Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bench/DashBench.cpp ('k') | bench/DeferredCanvasBench.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/DecodeBench.cpp
diff --git a/bench/DecodeBench.cpp b/bench/DecodeBench.cpp
index c87e6f6484fb467a2352bd72736e8b7322e548a0..c45654cccb72f3619edb833e8b0a5c9f5ac15322 100644
--- a/bench/DecodeBench.cpp
+++ b/bench/DecodeBench.cpp
@@ -7,29 +7,26 @@
*/
#include "SkBenchmark.h"
#include "SkBitmap.h"
+#include "SkCommandLineFlags.h"
#include "SkImageDecoder.h"
#include "SkString.h"
+DEFINE_string(decodeBenchFilename, "resources/CMYK.jpeg", "Path to image for DecodeBench.");
+
static const char* gConfigName[] = {
"ERROR", "a1", "a8", "index8", "565", "4444", "8888"
};
class DecodeBench : public SkBenchmark {
- const char* fFilename;
SkBitmap::Config fPrefConfig;
SkString fName;
- enum { N = SkBENCHLOOP(10) };
public:
DecodeBench(void* param, SkBitmap::Config c) : SkBenchmark(param) {
- fFilename = this->findDefine("decode-filename");
fPrefConfig = c;
- const char* fname = NULL;
- if (fFilename) {
- fname = strrchr(fFilename, '/');
- if (fname) {
- fname += 1; // skip the slash
- }
+ const char* fname = strrchr(FLAGS_decodeBenchFilename[0], '/');
+ if (fname) {
+ fname++; // skip the slash
}
fName.printf("decode_%s_%s", gConfigName[c], fname);
fIsRendering = false;
@@ -41,12 +38,12 @@ protected:
}
virtual void onDraw(SkCanvas*) {
- if (fFilename) {
- for (int i = 0; i < N; i++) {
- SkBitmap bm;
- SkImageDecoder::DecodeFile(fFilename, &bm, fPrefConfig,
- SkImageDecoder::kDecodePixels_Mode);
- }
+ for (int i = 0; i < this->getLoops(); i++) {
+ SkBitmap bm;
+ SkImageDecoder::DecodeFile(FLAGS_decodeBenchFilename[0],
+ &bm,
+ fPrefConfig,
+ SkImageDecoder::kDecodePixels_Mode);
}
}
« no previous file with comments | « bench/DashBench.cpp ('k') | bench/DeferredCanvasBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698