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

Unified Diff: bench/nanobench.cpp

Issue 918673002: Adding new benchmark to test image decoding performance. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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
« bench/SKDBench.cpp ('K') | « bench/SKDBench.cpp ('k') | gyp/bench.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/nanobench.cpp
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index eb48ec228d6b35886d6c8a87cd5e1c344f9479e3..ceb26d013d83d23acf2ace984afe57c3383c3f47 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -13,7 +13,9 @@
#include "ProcStats.h"
#include "ResultsWriter.h"
#include "RecordingBench.h"
+#include "Resources.h"
#include "SKPBench.h"
+#include "SKDBench.h"
#include "Stats.h"
#include "Timer.h"
@@ -439,7 +441,8 @@ public:
, fCurrentRecording(0)
, fCurrentScale(0)
, fCurrentSKP(0)
- , fCurrentUseMPD(0) {
+ , fCurrentUseMPD(0)
+ , fCurrentColorType(0) {
for (int i = 0; i < FLAGS_skps.count(); i++) {
if (SkStrEndsWith(FLAGS_skps[i], ".skp")) {
fSKPs.push_back() = FLAGS_skps[i];
@@ -469,6 +472,21 @@ public:
if (FLAGS_mpd) {
fUseMPDs.push_back() = true;
}
+
+ // Get the resource path for SKD benchmarks
+ fResourceDir = GetResourcePath();
scroggo 2015/02/11 19:38:10 Sorry, I think I mislead you in conversation; I th
msarett 2015/02/11 21:57:01 Done.
+ if (fResourceDir.isEmpty()) {
+ SkDebugf("SKDBench Failed: fResourceDir is not specified");
+ }
+
+ // Get an iterator for resource files
+ fFileIter = *(new SkOSFile::Iter(fResourceDir.c_str()));
mtklein 2015/02/11 19:15:36 This pattern seems odd. It's allocating on the he
msarett 2015/02/11 21:57:01 Done.
+
+ // Choose the candidate color types
+ SkColorType colorTypes[3] = { kN32_SkColorType,
+ kRGB_565_SkColorType,
+ kAlpha_8_SkColorType };
+ fColorTypes = *(new SkTArray<SkColorType>(colorTypes, 3));
mtklein 2015/02/11 19:15:36 If this sticks, I think you might want to write th
msarett 2015/02/11 21:57:01 Done.
}
static bool ReadPicture(const char* path, SkAutoTUnref<SkPicture>* pic) {
@@ -562,6 +580,25 @@ public:
fCurrentScale++;
}
+ // Run the SKDBenches
+ SkString file;
+ while (fFileIter.next(&file)) {
+ // Run a separate benchmark for each image and color type
+ SkString path = SkOSPath::Join(fResourceDir.c_str(), file.c_str());
+ return SkNEW_ARGS(SKDBench, ("SKD", path,
scroggo 2015/02/11 19:38:10 As with SKPs and images in DM, I think we should c
msarett 2015/02/11 21:57:01 Done.
+ fColorTypes[fCurrentColorType]));
+ }
+ // Reset the iterator for the next color type
+ if (++fCurrentColorType < fColorTypes.count()) {
+ fFileIter.reset(fResourceDir.c_str());
+ while (fFileIter.next(&file)) {
+ SkString path = SkOSPath::Join(fResourceDir.c_str(),
+ file.c_str());
+ return SkNEW_ARGS(SKDBench, ("SKD", path,
+ fColorTypes[fCurrentColorType]));
+ }
+ }
+
return NULL;
}
@@ -591,6 +628,8 @@ private:
SkTArray<SkScalar> fScales;
SkTArray<SkString> fSKPs;
SkTArray<bool> fUseMPDs;
+ SkString fResourceDir;
+ SkOSFile::Iter fFileIter;
double fSKPBytes, fSKPOps;
@@ -600,6 +639,8 @@ private:
int fCurrentScale;
int fCurrentSKP;
int fCurrentUseMPD;
+ SkTArray<SkColorType> fColorTypes;
+ int fCurrentColorType;
};
int nanobench_main();
« bench/SKDBench.cpp ('K') | « bench/SKDBench.cpp ('k') | gyp/bench.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698