DM: also run benches once.
Also:
- make GrMemoryPoolBenches threadsafe
- some tweaks to various DM code
- rename GM::shortName() to getName() to match benches and tests
On my desktop, (289 GMs, 617 benches) x 4 configs, 227 tests takes 46s in Debug, 14s in Release. (Still minutes faster than running tests && bench && gm.) GPU singlethreading is definitely the limiting factor again; going to reexamine whether that's helpful to thread it again.
BUG=skia:
R=reed@google.com, bsalomon@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/178473006
git-svn-id: http://skia.googlecode.com/svn/trunk@13603 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/gm.cpp b/gm/gm.cpp
index 82dd476..803874f 100644
--- a/gm/gm.cpp
+++ b/gm/gm.cpp
@@ -40,7 +40,7 @@
this->onDrawBackground(canvas);
}
-const char* GM::shortName() {
+const char* GM::getName() {
if (fShortName.size() == 0) {
fShortName = this->onShortName();
}
diff --git a/gm/gm.h b/gm/gm.h
index 372b781..90de96f 100644
--- a/gm/gm.h
+++ b/gm/gm.h
@@ -66,7 +66,7 @@
void drawContent(SkCanvas*);
SkISize getISize() { return this->onISize(); }
- const char* shortName();
+ const char* getName();
uint32_t getFlags() const {
return this->onGetFlags();
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index fb50b1e..acdc598 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -938,7 +938,7 @@
errors.add(ErrorCombination(kIntentionallySkipped_ErrorType));
} else {
ExpectationsSource *expectationsSource = this->fExpectationsSource.get();
- SkString nameWithExtension = make_shortname_plus_config(gm->shortName(), configName);
+ SkString nameWithExtension = make_shortname_plus_config(gm->getName(), configName);
nameWithExtension.append(".");
nameWithExtension.append(kPNG_FileExtension);
@@ -957,11 +957,11 @@
* See comments above complete_bitmap() for more detail.
*/
Expectations expectations = expectationsSource->get(nameWithExtension.c_str());
- if (this->ShouldIgnoreTest(gm->shortName())) {
+ if (this->ShouldIgnoreTest(gm->getName())) {
expectations.setIgnoreFailure(true);
}
errors.add(compare_to_expectations(expectations, *actualBitmapAndDigest,
- gm->shortName(), configName, "", true));
+ gm->getName(), configName, "", true));
} else {
// If we are running without expectations, we still want to
// record the actual results.
@@ -1069,7 +1069,7 @@
gm, gRec, gRec.fName, &bitmapAndDigest));
if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) {
- path = make_bitmap_filename(writePath, gm->shortName(), gRec.fName,
+ path = make_bitmap_filename(writePath, gm->getName(), gRec.fName,
"", bitmapAndDigest.fDigest);
errors.add(write_bitmap(path, bitmapAndDigest.fBitmap));
}
@@ -1079,7 +1079,7 @@
} else {
SkAutoTUnref<SkStreamAsset> documentStream(document.detachAsStream());
if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) {
- path = make_filename(writePath, gm->shortName(), gRec.fName, "", "pdf");
+ path = make_filename(writePath, gm->getName(), gRec.fName, "", "pdf");
errors.add(write_document(path, documentStream));
}
@@ -1091,7 +1091,7 @@
documentStream.get(), &pdfBitmap);
if (!success) {
gm_fprintf(stderr, "FAILED to render PDF for %s using renderer %s\n",
- gm->shortName(),
+ gm->getName(),
pdfRasterizers[i]->fName);
continue;
}
@@ -1105,7 +1105,7 @@
gm, gRec, configName.c_str(), &bitmapAndDigest));
if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) {
- path = make_bitmap_filename(writePath, gm->shortName(),
+ path = make_bitmap_filename(writePath, gm->getName(),
configName.c_str(),
"", bitmapAndDigest.fDigest);
errors.add(write_bitmap(path, bitmapAndDigest.fBitmap));
@@ -1123,7 +1123,7 @@
gm, gRec, gRec.fName, NULL));
if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) {
- path = make_filename(writePath, gm->shortName(), gRec.fName, "", "xps");
+ path = make_filename(writePath, gm->getName(), gRec.fName, "", "xps");
errors.add(write_document(path, documentStream));
}
} else {
@@ -1160,14 +1160,14 @@
return kEmpty_ErrorCombination;
}
return compare_test_results_to_reference_bitmap(
- gm->shortName(), gRec.fName, renderModeDescriptor, bitmap, &referenceBitmap);
+ gm->getName(), gRec.fName, renderModeDescriptor, bitmap, &referenceBitmap);
}
return kEmpty_ErrorCombination;
}
ErrorCombination test_pipe_playback(GM* gm, const ConfigData& gRec,
const SkBitmap& referenceBitmap, bool simulateFailure) {
- const SkString shortNamePlusConfig = make_shortname_plus_config(gm->shortName(),
+ const SkString shortNamePlusConfig = make_shortname_plus_config(gm->getName(),
gRec.fName);
ErrorCombination errors;
for (size_t i = 0; i < SK_ARRAY_COUNT(gPipeWritingFlagCombos); ++i) {
@@ -1199,7 +1199,7 @@
complete_bitmap(&bitmap);
writer.endRecording();
errors.add(compare_test_results_to_reference_bitmap(
- gm->shortName(), gRec.fName, renderModeDescriptor.c_str(), bitmap,
+ gm->getName(), gRec.fName, renderModeDescriptor.c_str(), bitmap,
&referenceBitmap));
if (!errors.isEmpty()) {
break;
@@ -1211,7 +1211,7 @@
ErrorCombination test_tiled_pipe_playback(GM* gm, const ConfigData& gRec,
const SkBitmap& referenceBitmap) {
- const SkString shortNamePlusConfig = make_shortname_plus_config(gm->shortName(),
+ const SkString shortNamePlusConfig = make_shortname_plus_config(gm->getName(),
gRec.fName);
ErrorCombination errors;
for (size_t i = 0; i < SK_ARRAY_COUNT(gPipeWritingFlagCombos); ++i) {
@@ -1237,7 +1237,7 @@
invokeGM(gm, pipeCanvas, false, false);
complete_bitmap(&bitmap);
writer.endRecording();
- errors.add(compare_test_results_to_reference_bitmap(gm->shortName(), gRec.fName,
+ errors.add(compare_test_results_to_reference_bitmap(gm->getName(), gRec.fName,
renderModeDescriptor.c_str(),
bitmap, &referenceBitmap));
if (!errors.isEmpty()) {
@@ -1555,7 +1555,7 @@
const SkTDArray<SkScalar> &tileGridReplayScales) {
ErrorCombination errorsForAllModes;
uint32_t gmFlags = gm->getFlags();
- const SkString shortNamePlusConfig = gmmain.make_shortname_plus_config(gm->shortName(),
+ const SkString shortNamePlusConfig = gmmain.make_shortname_plus_config(gm->getName(),
compareConfig.fName);
SkPicture* pict = gmmain.generate_new_picture(gm, kNone_BbhType, 0);
@@ -1570,7 +1570,7 @@
SkBitmap bitmap;
gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap);
errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitmap(
- gm->shortName(), compareConfig.fName, renderModeDescriptor, bitmap,
+ gm->getName(), compareConfig.fName, renderModeDescriptor, bitmap,
&comparisonBitmap));
}
}
@@ -1587,7 +1587,7 @@
SkBitmap bitmap;
gmmain.generate_image_from_picture(gm, compareConfig, repict, &bitmap);
errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitmap(
- gm->shortName(), compareConfig.fName, renderModeDescriptor, bitmap,
+ gm->getName(), compareConfig.fName, renderModeDescriptor, bitmap,
&comparisonBitmap));
}
}
@@ -1602,7 +1602,7 @@
// write out their SkPictures to separate files rather than
// overwriting each other. But we should make sure it doesn't
// break anybody.
- SkString path = gmmain.make_filename(FLAGS_writePicturePath[0], gm->shortName(),
+ SkString path = gmmain.make_filename(FLAGS_writePicturePath[0], gm->getName(),
compareConfig.fName, "", pictureSuffix);
SkFILEWStream stream(path.c_str());
pict->serialize(&stream);
@@ -1622,7 +1622,7 @@
SkBitmap bitmap;
gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap);
errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitmap(
- gm->shortName(), compareConfig.fName, renderModeDescriptor, bitmap,
+ gm->getName(), compareConfig.fName, renderModeDescriptor, bitmap,
&comparisonBitmap));
}
}
@@ -1657,7 +1657,7 @@
gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap,
replayScale /*, true */);
errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitmap(
- gm->shortName(), compareConfig.fName, renderModeDescriptor.c_str(), bitmap,
+ gm->getName(), compareConfig.fName, renderModeDescriptor.c_str(), bitmap,
&comparisonBitmap));
}
}
@@ -1699,7 +1699,7 @@
for (int i = 0; i < configs.count(); i++) {
ConfigData config = gRec[configs[i]];
- const SkString shortNamePlusConfig = gmmain.make_shortname_plus_config(gm->shortName(),
+ const SkString shortNamePlusConfig = gmmain.make_shortname_plus_config(gm->getName(),
config.fName);
// Skip any tests that we don't even need to try.
@@ -2316,7 +2316,7 @@
moduloStr.printf("[%d.%d] ", gmIndex, moduloDivisor);
}
- const char* shortName = gm->shortName();
+ const char* shortName = gm->getName();
if (SkCommandLineFlags::ShouldSkip(FLAGS_match, shortName)) {
continue;