| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "BenchTimer.h" | 8 #include "BenchTimer.h" |
| 9 #include "CopyTilesRenderer.h" | 9 #include "CopyTilesRenderer.h" |
| 10 #include "LazyDecodeBitmap.h" | 10 #include "LazyDecodeBitmap.h" |
| 11 #include "PictureBenchmark.h" | 11 #include "PictureBenchmark.h" |
| 12 #include "PictureRenderingFlags.h" | 12 #include "PictureRenderingFlags.h" |
| 13 #include "SkBenchLogger.h" | 13 #include "SkBenchLogger.h" |
| 14 #include "SkCommandLineFlags.h" | 14 #include "SkCommandLineFlags.h" |
| 15 #include "SkGraphics.h" | 15 #include "SkGraphics.h" |
| 16 #include "SkImageDecoder.h" | 16 #include "SkImageDecoder.h" |
| 17 #if LAZY_CACHE_STATS | 17 #if LAZY_CACHE_STATS |
| 18 #include "SkLazyPixelRef.h" | 18 #include "SkDiscardablePixelRef.h" |
| 19 #endif | 19 #endif |
| 20 #include "SkLruImageCache.h" | 20 #include "SkLruImageCache.h" |
| 21 #include "SkMath.h" | 21 #include "SkMath.h" |
| 22 #include "SkOSFile.h" | 22 #include "SkOSFile.h" |
| 23 #include "SkPicture.h" | 23 #include "SkPicture.h" |
| 24 #include "SkStream.h" | 24 #include "SkStream.h" |
| 25 #include "picture_utils.h" | 25 #include "picture_utils.h" |
| 26 | 26 |
| 27 SkBenchLogger gLogger; | 27 SkBenchLogger gLogger; |
| 28 | 28 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 190 |
| 191 SkString result; | 191 SkString result; |
| 192 result.printf("running bench [%i %i] %s ", picture->width(), picture->height
(), | 192 result.printf("running bench [%i %i] %s ", picture->width(), picture->height
(), |
| 193 filename.c_str()); | 193 filename.c_str()); |
| 194 gLogger.logProgress(result); | 194 gLogger.logProgress(result); |
| 195 | 195 |
| 196 benchmark.run(picture); | 196 benchmark.run(picture); |
| 197 | 197 |
| 198 #if LAZY_CACHE_STATS | 198 #if LAZY_CACHE_STATS |
| 199 if (FLAGS_trackDeferredCaching) { | 199 if (FLAGS_trackDeferredCaching) { |
| 200 int32_t cacheHits = SkLazyPixelRef::GetCacheHits(); | 200 int32_t cacheHits = SkDiscardablePixelRef::GetCacheHits(); |
| 201 int32_t cacheMisses = SkLazyPixelRef::GetCacheMisses(); | 201 int32_t cacheMisses = SkDiscardablePixelRef::GetCacheMisses(); |
| 202 SkLazyPixelRef::ResetCacheStats(); | 202 SkDiscardablePixelRef::ResetCacheStats(); |
| 203 SkString hitString; | 203 SkString hitString; |
| 204 hitString.printf("Cache hit rate: %f\n", (double) cacheHits / (cacheHits
+ cacheMisses)); | 204 hitString.printf("Cache hit rate: %f\n", (double) cacheHits / (cacheHits
+ cacheMisses)); |
| 205 gLogger.logProgress(hitString); | 205 gLogger.logProgress(hitString); |
| 206 gTotalCacheHits += cacheHits; | 206 gTotalCacheHits += cacheHits; |
| 207 gTotalCacheMisses += cacheMisses; | 207 gTotalCacheMisses += cacheMisses; |
| 208 } | 208 } |
| 209 #endif | 209 #endif |
| 210 if (FLAGS_countRAM) { | 210 if (FLAGS_countRAM) { |
| 211 SkString ramCount("RAM used for bitmaps: "); | 211 SkString ramCount("RAM used for bitmaps: "); |
| 212 size_t bytes = gLruImageCache.getImageCacheUsed(); | 212 size_t bytes = gLruImageCache.getImageCacheUsed(); |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 } | 443 } |
| 444 #endif | 444 #endif |
| 445 return 0; | 445 return 0; |
| 446 } | 446 } |
| 447 | 447 |
| 448 #if !defined SK_BUILD_FOR_IOS | 448 #if !defined SK_BUILD_FOR_IOS |
| 449 int main(int argc, char * const argv[]) { | 449 int main(int argc, char * const argv[]) { |
| 450 return tool_main(argc, (char**) argv); | 450 return tool_main(argc, (char**) argv); |
| 451 } | 451 } |
| 452 #endif | 452 #endif |
| OLD | NEW |