| Index: tools/bench_pictures_main.cpp
|
| diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp
|
| index ffcab747720e5e765cab6e06b66b2615c935d715..68eb1a6a10c3dba6ef0a4db5a6164b501857c8fa 100644
|
| --- a/tools/bench_pictures_main.cpp
|
| +++ b/tools/bench_pictures_main.cpp
|
| @@ -26,6 +26,7 @@
|
| SkBenchLogger gLogger;
|
|
|
| // Flags used by this file, in alphabetical order.
|
| +DEFINE_bool(countRAM, false, "Count the RAM used for bitmap pixels in each skp file");
|
| DECLARE_bool(deferImageDecoding);
|
| DEFINE_string(filter, "",
|
| "type:flag : Enable canvas filtering to disable a paint flag, "
|
| @@ -164,6 +165,13 @@ static bool run_single_benchmark(const SkString& inputPath,
|
| return false;
|
| }
|
|
|
| + // Since the old picture has been deleted, all pixels should be cleared.
|
| + SkASSERT(gLruImageCache.getRamUsed() == 0);
|
| + if (FLAGS_countRAM) {
|
| + // Set the budget to zero, so all pixels will be kept
|
| + gLruImageCache.setBudget(0);
|
| + }
|
| +
|
| bool success = false;
|
| SkPicture* picture;
|
| if (FLAGS_deferImageDecoding) {
|
| @@ -189,6 +197,23 @@ static bool run_single_benchmark(const SkString& inputPath,
|
| gLogger.logProgress(result);
|
|
|
| benchmark.run(picture);
|
| +
|
| + if (FLAGS_countRAM) {
|
| + SkDebugf("RAM used for bitmaps: ");
|
| + size_t bytes = gLruImageCache.getRamUsed();
|
| + if (bytes > 1024) {
|
| + size_t kb = bytes / 1024;
|
| + if (kb > 1024) {
|
| + size_t mb = kb / 1024;
|
| + SkDebugf("%i MB\n", mb);
|
| + } else {
|
| + SkDebugf("%i KB\n", kb);
|
| + }
|
| + } else {
|
| + SkDebugf("%i bytes\n", bytes);
|
| + }
|
| + }
|
| +
|
| return true;
|
| }
|
|
|
|
|