aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar keyar@chromium.org <keyar@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-21 17:57:59 +0000
committerGravatar keyar@chromium.org <keyar@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-21 17:57:59 +0000
commitdb9a5fb55f77935774f21e07a04b6d1350ca54cc (patch)
treeeba68fe0ad25c6882d1ff925f5c3a9f1f4e2783c
parent5b5919862fa9114b76ed9c2e9429739dec06fee7 (diff)
Benchmark results will now print to STDOUT if on not-Android.
Review URL: https://codereview.appspot.com/6446164 git-svn-id: http://skia.googlecode.com/svn/trunk@5215 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--tools/PictureBenchmark.cpp42
-rw-r--r--tools/bench_pictures_main.cpp7
-rw-r--r--tools/picture_utils.cpp8
-rw-r--r--tools/picture_utils.h5
4 files changed, 42 insertions, 20 deletions
diff --git a/tools/PictureBenchmark.cpp b/tools/PictureBenchmark.cpp
index e45c5e8389..4f7cbac202 100644
--- a/tools/PictureBenchmark.cpp
+++ b/tools/PictureBenchmark.cpp
@@ -62,16 +62,17 @@ void PipePictureBenchmark::run(SkPicture* pict) {
#endif
}
- fRenderer.end();
-
- SkDebugf("pipe: msecs = %6.2f", wall_time / fRepeats);
+ SkString result;
+ result.printf("pipe: msecs = %6.2f", wall_time / fRepeats);
#if SK_SUPPORT_GPU
if (fRenderer.isUsingGpuDevice()) {
- SkDebugf(" gmsecs = %6.2f", gpu_time / fRepeats);
+ result.appendf(" gmsecs = %6.2f", gpu_time / fRepeats);
}
#endif
- SkDebugf("\n");
+ result.appendf("\n");
+ sk_tools::print_msg(result.c_str());
+ fRenderer.end();
SkDELETE(timer);
}
@@ -98,7 +99,9 @@ void RecordPictureBenchmark::run(SkPicture* pict) {
}
}
- SkDebugf("record: msecs = %6.5f\n", wall_time / fRepeats);
+ SkString result;
+ result.printf("record: msecs = %6.5f\n", wall_time / fRepeats);
+ sk_tools::print_msg(result.c_str());
SkDELETE(timer);
}
@@ -137,16 +140,18 @@ void SimplePictureBenchmark::run(SkPicture* pict) {
#endif
}
- fRenderer.end();
- SkDebugf("simple: msecs = %6.2f", wall_time / fRepeats);
+ SkString result;
+ result.printf("simple: msecs = %6.2f", wall_time / fRepeats);
#if SK_SUPPORT_GPU
if (fRenderer.isUsingGpuDevice()) {
- SkDebugf(" gmsecs = %6.2f", gpu_time / fRepeats);
+ result.appendf(" gmsecs = %6.2f", gpu_time / fRepeats);
}
#endif
- SkDebugf("\n");
+ result.appendf("\n");
+ sk_tools::print_msg(result.c_str());
+ fRenderer.end();
SkDELETE(timer);
}
@@ -183,17 +188,18 @@ void TiledPictureBenchmark::run(SkPicture* pict) {
#endif
}
- fRenderer.end();
-
- SkDebugf("%i_tiles_%ix%i: msecs = %6.2f", fRenderer.numTiles(), fRenderer.getTileWidth(),
- fRenderer.getTileHeight(), wall_time / fRepeats);
+ SkString result;
+ result.printf("%i_tiles_%ix%i: msecs = %6.2f", fRenderer.numTiles(), fRenderer.getTileWidth(),
+ fRenderer.getTileHeight(), wall_time / fRepeats);
#if SK_SUPPORT_GPU
if (fRenderer.isUsingGpuDevice()) {
- SkDebugf(" gmsecs = %6.2f", gpu_time / fRepeats);
+ result.appendf(" gmsecs = %6.2f", gpu_time / fRepeats);
}
#endif
- SkDebugf("\n");
+ result.appendf("\n");
+ sk_tools::print_msg(result.c_str());
+ fRenderer.end();
SkDELETE(timer);
}
@@ -222,7 +228,9 @@ void UnflattenPictureBenchmark::run(SkPicture* pict) {
}
}
- SkDebugf("unflatten: msecs = %6.4f\n", wall_time / fRepeats);
+ SkString result;
+ result.printf("unflatten: msecs = %6.4f\n", wall_time / fRepeats);
+ sk_tools::print_msg(result.c_str());
SkDELETE(timer);
}
diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp
index d906214e7a..88b54227e2 100644
--- a/tools/bench_pictures_main.cpp
+++ b/tools/bench_pictures_main.cpp
@@ -81,8 +81,11 @@ static void run_single_benchmark(const SkString& inputPath,
SkString filename;
sk_tools::get_basename(&filename, inputPath);
- SkDebugf("running bench [%i %i] %s ", picture.width(), picture.height(),
- filename.c_str());
+
+ SkString result;
+ result.printf("running bench [%i %i] %s ", picture.width(), picture.height(),
+ filename.c_str());
+ sk_tools::print_msg(result.c_str());
benchmark.run(&picture);
}
diff --git a/tools/picture_utils.cpp b/tools/picture_utils.cpp
index 26788ee1ed..d38cbb0669 100644
--- a/tools/picture_utils.cpp
+++ b/tools/picture_utils.cpp
@@ -70,10 +70,16 @@ namespace sk_tools {
return skString.endsWith("%");
}
+ // This copies how bench does printing of test results.
+#ifdef SK_BUILD_FOR_ANDROID
+ void print_msg(const char msg[]) { SkDebugf("%s", msg); }
+#else
+ void print_msg(const char msg[]) { printf("%s", msg); }
+#endif
+
void setup_bitmap(SkBitmap* bitmap, int width, int height) {
bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height);
bitmap->allocPixels();
bitmap->eraseColor(0);
}
-
}
diff --git a/tools/picture_utils.h b/tools/picture_utils.h
index 2cda45bd40..c0c5d8f069 100644
--- a/tools/picture_utils.h
+++ b/tools/picture_utils.h
@@ -28,6 +28,11 @@ namespace sk_tools {
// Returns true if the string ends with %
bool is_percentage(char* const string);
+ // Prints to STDOUT so that test results can be easily seperated from the
+ // error stream. Note, that this still prints to the same stream as SkDebugf
+ // on Andoid.
+ void print_msg(const char msg[]);
+
// Prepares the bitmap so that it can be written.
//
// Specifically, it configures the bitmap, allocates pixels and then