本文整理汇总了C++中GrContext::gpuStats方法的典型用法代码示例。如果您正苦于以下问题:C++ GrContext::gpuStats方法的具体用法?C++ GrContext::gpuStats怎么用?C++ GrContext::gpuStats使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrContext
的用法示例。
在下文中一共展示了GrContext::gpuStats方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tool_main
int tool_main(int argc, char** argv) {
SetupCrashHandler();
SkString usage;
usage.printf("Time drawing .skp files.\n"
"\tPossible arguments for --filter: [%s]\n\t\t[%s]",
filterTypesUsage().c_str(), filterFlagsUsage().c_str());
SkCommandLineFlags::SetUsage(usage.c_str());
SkCommandLineFlags::Parse(argc, argv);
if (FLAGS_repeat < 1) {
SkString error;
error.printf("--repeats must be >= 1. Was %i\n", FLAGS_repeat);
gLogger.logError(error);
exit(-1);
}
if (FLAGS_logFile.count() == 1) {
if (!gLogger.SetLogFile(FLAGS_logFile[0])) {
SkString str;
str.printf("Could not open %s for writing.\n", FLAGS_logFile[0]);
gLogger.logError(str);
// TODO(borenet): We're disabling this for now, due to
// write-protected Android devices. The very short-term
// solution is to ignore the fact that we have no log file.
//exit(-1);
}
}
SkAutoTDelete<PictureJSONResultsWriter> jsonWriter;
if (FLAGS_jsonLog.count() == 1) {
SkASSERT(FLAGS_builderName.count() == 1 && FLAGS_gitHash.count() == 1);
jsonWriter.reset(SkNEW(PictureJSONResultsWriter(
FLAGS_jsonLog[0],
FLAGS_builderName[0],
FLAGS_buildNumber,
FLAGS_timestamp,
FLAGS_gitHash[0],
FLAGS_gitNumber)));
gWriter.add(jsonWriter.get());
}
gWriter.add(&gLogWriter);
#if SK_ENABLE_INST_COUNT
gPrintInstCount = true;
#endif
SkAutoGraphics ag;
sk_tools::PictureBenchmark benchmark;
setup_benchmark(&benchmark);
int failures = 0;
for (int i = 0; i < FLAGS_readPath.count(); ++i) {
failures += process_input(FLAGS_readPath[i], benchmark);
}
if (failures != 0) {
SkString err;
err.printf("Failed to run %i benchmarks.\n", failures);
gLogger.logError(err);
return 1;
}
#if SK_LAZY_CACHE_STATS
if (FLAGS_trackDeferredCaching) {
SkDebugf("Total cache hit rate: %f\n",
(double) gTotalCacheHits / (gTotalCacheHits + gTotalCacheMisses));
}
#endif
#if GR_GPU_STATS
if (FLAGS_gpuStats && benchmark.renderer()->isUsingGpuDevice()) {
GrContext* ctx = benchmark.renderer()->getGrContext();
SkDebugf("RenderTarget Binds: %d\n", ctx->gpuStats()->renderTargetBinds());
SkDebugf("Shader Compilations: %d\n", ctx->gpuStats()->shaderCompilations());
}
#endif
gWriter.end();
return 0;
}