aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2014-10-24 09:34:41 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-10-24 09:34:41 -0700
commit24234fe77718a553ccc6ffdea0f2ee3ef414e0b6 (patch)
tree21f90c197b4bf34e17dd99dbb4ee6f7fd9d71835
parent42d1db2ccc42b18d6c906de7039b18acb65f4525 (diff)
Build gpu stats tracking in dev builds.
Fix cache stats, add more info. BUG=skia:2889 Review URL: https://codereview.chromium.org/655263005
-rw-r--r--include/gpu/GrConfig.h12
-rw-r--r--src/gpu/GrResourceCache.cpp17
-rw-r--r--tools/bench_pictures_main.cpp2
-rw-r--r--tools/render_pictures_main.cpp8
4 files changed, 27 insertions, 12 deletions
diff --git a/include/gpu/GrConfig.h b/include/gpu/GrConfig.h
index 86ad63ad6e..8e65f51b25 100644
--- a/include/gpu/GrConfig.h
+++ b/include/gpu/GrConfig.h
@@ -33,11 +33,19 @@
*/
#if !defined(GR_CACHE_STATS)
- #define GR_CACHE_STATS 0
+ #ifdef SK_DEVELOPER
+ #define GR_CACHE_STATS 1
+ #else
+ #define GR_CACHE_STATS 0
+ #endif
#endif
#if !defined(GR_GPU_STATS)
-#define GR_GPU_STATS 0
+ #ifdef SK_DEVELOPER
+ #define GR_GPU_STATS 1
+ #else
+ #define GR_GPU_STATS 0
+ #endif
#endif
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index f50ed7d032..f70d141c72 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -404,22 +404,29 @@ void GrResourceCache::validate() const {
void GrResourceCache::printStats() {
int locked = 0;
+ int scratch = 0;
EntryList::Iter iter;
GrResourceCacheEntry* entry = iter.init(fList, EntryList::Iter::kTail_IterStart);
for ( ; entry; entry = iter.prev()) {
- if (entry->fResource->getRefCnt() > 1) {
+ if (!entry->fResource->isPurgable()) {
++locked;
}
+ if (entry->fResource->isScratch()) {
+ ++scratch;
+ }
}
+ float countUtilization = (100.f * fEntryCount) / fMaxCount;
+ float byteUtilization = (100.f * fEntryBytes) / fMaxBytes;
+
SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes);
- SkDebugf("\t\tEntry Count: current %d (%d locked) high %d\n",
- fEntryCount, locked, fHighWaterEntryCount);
- SkDebugf("\t\tEntry Bytes: current %d high %d\n",
- fEntryBytes, fHighWaterEntryBytes);
+ SkDebugf("\t\tEntry Count: current %d (%d locked, %d scratch %.2g%% full), high %d\n",
+ fEntryCount, locked, scratch, countUtilization, fHighWaterEntryCount);
+ SkDebugf("\t\tEntry Bytes: current %d (%.2g%% full) high %d\n",
+ fEntryBytes, byteUtilization, fHighWaterEntryBytes);
}
#endif
diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp
index 93ee308ae1..e8c4063d78 100644
--- a/tools/bench_pictures_main.cpp
+++ b/tools/bench_pictures_main.cpp
@@ -471,7 +471,7 @@ int tool_main(int argc, char** argv) {
}
#endif
-#if GR_GPU_STATS
+#if GR_GPU_STATS && SK_SUPPORT_GPU
if (FLAGS_gpuStats && benchmark.renderer()->isUsingGpuDevice()) {
GrContext* ctx = benchmark.renderer()->getGrContext();
SkDebugf("RenderTarget Binds: %d\n", ctx->gpuStats()->renderTargetBinds());
diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp
index 6faa81ac0e..91b6481b67 100644
--- a/tools/render_pictures_main.cpp
+++ b/tools/render_pictures_main.cpp
@@ -474,8 +474,7 @@ int tool_main(int argc, char** argv) {
SkDebugf("Failed to render %i pictures.\n", failures);
return 1;
}
-#if SK_SUPPORT_GPU
-#if GR_CACHE_STATS
+#if GR_CACHE_STATS && SK_SUPPORT_GPU
if (renderer->isUsingGpuDevice()) {
GrContext* ctx = renderer->getGrContext();
ctx->printCacheStats();
@@ -484,14 +483,15 @@ int tool_main(int argc, char** argv) {
#endif
}
#endif
-#if GR_GPU_STATS
+
+#if GR_GPU_STATS && SK_SUPPORT_GPU
if (FLAGS_gpuStats && renderer->isUsingGpuDevice()) {
GrContext* ctx = renderer->getGrContext();
SkDebugf("RenderTarget Binds: %d\n", ctx->gpuStats()->renderTargetBinds());
SkDebugf("Shader Compilations: %d\n", ctx->gpuStats()->shaderCompilations());
}
#endif
-#endif
+
if (FLAGS_writeJsonSummaryPath.count() == 1) {
// If there were any descriptions on the command line, insert them now.
for (int i=0; i<FLAGS_descriptions.count(); i++) {