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

Unified Diff: gm/gmmain.cpp

Issue 14265010: Make SkSHA1 and SkM5 use common SkDigestHash result type (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: sync_to_r8826 Created 7 years, 8 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
Index: gm/gmmain.cpp
===================================================================
--- gm/gmmain.cpp (revision 8826)
+++ gm/gmmain.cpp (working copy)
@@ -714,11 +714,10 @@
const char renderModeDescriptor[],
bool addToJsonSummary) {
ErrorCombination errors;
- SkHashDigest actualBitmapHash;
- // TODO(epoger): Better handling for error returned by ComputeDigest()?
- // For now, we just report a digest of 0 in error cases, like before.
+ BITMAP_HASH_TYPE actualBitmapHash;
if (!SkBitmapHasher::ComputeDigest(actualBitmap, &actualBitmapHash)) {
- actualBitmapHash = 0;
+ // TODO(epoger): Better handling for error returned by ComputeDigest()?
+ // For now, we just leave actualBitmapHash empty.
}
SkString completeNameString = baseNameString;
completeNameString.append(renderModeDescriptor);
@@ -768,7 +767,7 @@
* depending on status.
*/
void add_actual_results_to_json_summary(const char testName[],
- const SkHashDigest& actualBitmapHash,
+ const BITMAP_HASH_TYPE& actualBitmapHash,
ErrorCombination result,
bool ignoreFailure) {
Json::Value actualResults;
@@ -864,11 +863,10 @@
} else {
// If we are running without expectations, we still want to
// record the actual results.
- SkHashDigest actualBitmapHash;
- // TODO(epoger): Better handling for error returned by ComputeDigest()?
- // For now, we just report a digest of 0 in error cases, like before.
+ BITMAP_HASH_TYPE actualBitmapHash;
if (!SkBitmapHasher::ComputeDigest(actualBitmap, &actualBitmapHash)) {
- actualBitmapHash = 0;
+ // TODO(epoger): Better handling for error returned by ComputeDigest()?
+ // For now, we just leave actualBitmapHash empty.
}
add_actual_results_to_json_summary(name.c_str(), actualBitmapHash,
ErrorCombination(kMissingExpectations_ErrorType),
@@ -1591,6 +1589,12 @@
return total;
}
+// Set this temporary macro to print out timing info.
+#define EPOGER_TIMER
+#ifdef EPOGER_TIMER
+#include "SkTime.h"
+#endif
+
int tool_main(int argc, char** argv);
int tool_main(int argc, char** argv) {
@@ -1598,6 +1602,10 @@
gPrintInstCount = true;
#endif
+#ifdef EPOGER_TIMER
+ SkMSec startTime = SkTime::GetMSecs();
+#endif
+
SkGraphics::Init();
// we don't need to see this during a run
gSkSuppressFontCachePurgeSpew = true;
@@ -1846,6 +1854,10 @@
}
int expectedNumberOfTests = gmsRun * (configs.count() + modes.count());
+#ifdef EPOGER_TIMER
+ SkMSec middleTime = SkTime::GetMSecs();
+#endif
+
// Output summary to stdout.
if (FLAGS_verbose) {
gm_fprintf(stdout, "Ran %d GMs\n", gmsRun);
@@ -1867,6 +1879,23 @@
}
#endif
+#ifdef EPOGER_TIMER
+ Json::Value actualResults;
+ actualResults[kJsonKey_ActualResults_Failed] =
+ gmmain.fJsonActualResults_Failed;
+ actualResults[kJsonKey_ActualResults_FailureIgnored] =
+ gmmain.fJsonActualResults_FailureIgnored;
+ actualResults[kJsonKey_ActualResults_NoComparison] =
+ gmmain.fJsonActualResults_NoComparison;
+ actualResults[kJsonKey_ActualResults_Succeeded] =
+ gmmain.fJsonActualResults_Succeeded;
+ Json::Value root;
+ root[kJsonKey_ActualResults] = actualResults;
+ root[kJsonKey_ExpectedResults] = gmmain.fJsonExpectedResults;
+ std::string jsonStdString = root.toStyledString();
+ printf("%s\n", jsonStdString.c_str());
+#endif
+
if (FLAGS_writeJsonSummaryPath.count() == 1) {
Json::Value actualResults;
actualResults[kJsonKey_ActualResults_Failed] =
@@ -1904,6 +1933,12 @@
#endif
SkGraphics::Term();
+#ifdef EPOGER_TIMER
+ SkMSec endTime = SkTime::GetMSecs();
+ printf("EPOGER timings: start-middle=%d msecs, start-end=%d msecs\n",
+ (middleTime - startTime), (endTime - startTime));
+#endif
+
return (reportError) ? -1 : 0;
}
« no previous file with comments | « gm/gm_expectations.h ('k') | gm/tests/outputs/compared-against-different-pixels-images/output-expected/json-summary.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698