Improve shader compile tracing with Android framework

Log shader compile "cache miss" and "cache hit" tags. Shader
compile tags are logged even if debug.hwui.skia_atrace_enabled is
not enabled. "shader_compile" tag measures the total time to
prepare the shader (regardless of cache miss or hit).
"cache_hit" measures the time to load the binary program from
cache (with glProgramBinary). "cache_miss" measures the time
to compile from SkSL to GLSL, compile GLSL and link the program.

Test: Ran systrace on android
Bug: b/146635333
Change-Id: I984b9681cdcf78fc5f4a2e2ef0ad072ebc851ca1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264097
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Stan Iliev <stani@google.com>
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index dda21cc..6c12794 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -50,7 +50,7 @@
                                                GrProgramDesc* desc,
                                                GrGLGpu* gpu,
                                                const GrGLPrecompiledProgram* precompiledProgram) {
-    ATRACE_ANDROID_FRAMEWORK("Shader Compile");
+    ATRACE_ANDROID_FRAMEWORK_ALWAYS("shader_compile");
     GrAutoLocaleSetter als("C");
 
     // create a builder.  This will be handed off to effects so they can use it to add
@@ -254,6 +254,7 @@
         this->computeCountsAndStrides(programID, primProc, false);
         usedProgramBinaries = true;
     } else if (cached) {
+        ATRACE_ANDROID_FRAMEWORK_ALWAYS("cache_hit");
         SkReader32 reader(fCached->data(), fCached->size());
         SkFourByteTag shaderType = reader.readU32();
 
@@ -303,6 +304,7 @@
         }
     }
     if (!usedProgramBinaries) {
+        ATRACE_ANDROID_FRAMEWORK_ALWAYS("cache_miss");
         // Either a cache miss, or we got something other than binaries from the cache
 
         /*