Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrThreadSafePipelineBuilder.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2021 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
9
10#if GR_GPU_STATS
11#if defined(GR_TEST_UTILS)
13
14using namespace skia_private;
15
17
18static const char* cache_result_to_str(int i) {
19 const char* kCacheResultStrings[Stats::kNumProgramCacheResults] = {
20 "hits",
21 "misses",
22 "partials"
23 };
24 static_assert(0 == (int) Stats::ProgramCacheResult::kHit);
25 static_assert(1 == (int) Stats::ProgramCacheResult::kMiss);
26 static_assert(2 == (int) Stats::ProgramCacheResult::kPartial);
27 static_assert(Stats::kNumProgramCacheResults == 3);
28 return kCacheResultStrings[i];
29}
30
31void GrThreadSafePipelineBuilder::Stats::dump(SkString* out) {
32 out->appendf("Shader Compilations: %d\n", fShaderCompilations.load());
33
34 SkASSERT(fNumInlineCompilationFailures == 0);
35 out->appendf("Number of Inline compile failures %d\n", fNumInlineCompilationFailures.load());
36 for (int i = 0; i < Stats::kNumProgramCacheResults-1; ++i) {
37 out->appendf("Inline Program Cache %s %d\n", cache_result_to_str(i),
38 fInlineProgramCacheStats[i].load());
39 }
40
41 SkASSERT(fNumPreCompilationFailures == 0);
42 out->appendf("Number of precompile failures %d\n", fNumPreCompilationFailures.load());
43 for (int i = 0; i < Stats::kNumProgramCacheResults-1; ++i) {
44 out->appendf("Precompile Program Cache %s %d\n", cache_result_to_str(i),
45 fPreProgramCacheStats[i].load());
46 }
47
48 SkASSERT(fNumCompilationFailures == 0);
49 out->appendf("Total number of compilation failures %d\n", fNumCompilationFailures.load());
50 out->appendf("Total number of partial compilation successes %d\n",
51 fNumPartialCompilationSuccesses.load());
52 out->appendf("Total number of compilation successes %d\n", fNumCompilationSuccesses.load());
53}
54
55void GrThreadSafePipelineBuilder::Stats::dumpKeyValuePairs(TArray<SkString>* keys,
56 TArray<double>* values) {
57 keys->push_back(SkString("shader_compilations")); values->push_back(fShaderCompilations);
58}
59
60#endif // defined(GR_TEST_UTILS)
61#endif // GR_GPU_STATS
#define SkASSERT(cond)
Definition SkAssert.h:116
SI T load(const P *ptr)
Type::kYUV Type::kRGBA() int(0.7 *637)