diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-21 12:46:01 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-21 12:46:01 +0000 |
commit | 174db77d1aa9bfa779cdb5ea2aac070af2883cdd (patch) | |
tree | 62a1b36535d6552f9a99cfa1f1178ba9b5afa0fb /src/gpu | |
parent | 311d4eafab513adae3ef6c37dd4d573844bccd63 (diff) |
Fix divide-by-zero in program cache tracking.
This also adds tracking to developer builds.
Author: jvanverth@google.com
Reviewed By: robertphillips@google.com
Review URL: https://chromiumcodereview.appspot.com/12426019
git-svn-id: http://skia.googlecode.com/svn/trunk@8284 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/gl/GrGpuGL.h | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGpuGL_program.cpp | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/gpu/gl/GrGpuGL.h b/src/gpu/gl/GrGpuGL.h index e589ef2a70..e871f220d5 100644 --- a/src/gpu/gl/GrGpuGL.h +++ b/src/gpu/gl/GrGpuGL.h @@ -24,7 +24,7 @@ #include "GrGLVertexBuffer.h" #include "../GrTHashCache.h" -#ifdef SK_DEBUG +#ifdef SK_DEVELOPER #define PROGRAM_CACHE_STATS #endif diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp index 5081089216..8111a03ca7 100644 --- a/src/gpu/gl/GrGpuGL_program.cpp +++ b/src/gpu/gl/GrGpuGL_program.cpp @@ -33,7 +33,8 @@ GrGpuGL::ProgramCache::~ProgramCache() { SkDebugf("--- Program Cache ---\n"); SkDebugf("Total requests: %d\n", fTotalRequests); SkDebugf("Cache misses: %d\n", fCacheMisses); - SkDebugf("Cache miss %%: %f\n", (float)fCacheMisses/(float)fTotalRequests); + SkDebugf("Cache miss %%: %f\n", (fTotalRequests > 0) + ? (float)fCacheMisses/(float)fTotalRequests : 0.0f); SkDebugf("---------------------\n"); #endif } |