better SKVM_JIT_STATS output

Count pixels, show percents, and promote to int64_t
for safety... pixels certainly needs it.

Change-Id: Ia8db4fec6c357557e6c805b6c05191f71e331843
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275148
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
This commit is contained in:
Mike Klein 2020-03-04 16:46:53 -06:00 committed by Skia Commit-Bot
parent 238105b50c
commit 203b4050ed

View File

@ -1643,10 +1643,17 @@ namespace skvm {
void Program::eval(int n, void* args[]) const { void Program::eval(int n, void* args[]) const {
#define SKVM_JIT_STATS 0 #define SKVM_JIT_STATS 0
#if SKVM_JIT_STATS #if SKVM_JIT_STATS
static std::atomic<int> calls{0}, jits{0}; static std::atomic<int64_t> calls{0}, jits{0},
pixels{0}, fast{0};
pixels += n;
if (0 == calls++) { if (0 == calls++) {
atexit([]{ atexit([]{
SkDebugf("%d of %d calls to eval() went through JIT.\n", jits.load(), calls.load()); int64_t num = jits .load(),
den = calls.load();
SkDebugf("%.3g%% of %lld eval() calls went through JIT.\n", (100.0 * num)/den, den);
num = fast .load();
den = pixels.load();
SkDebugf("%.3g%% of %lld pixels went through JIT.\n", (100.0 * num)/den, den);
}); });
} }
#endif #endif
@ -1655,6 +1662,7 @@ namespace skvm {
if (const void* b = fImpl->jit_entry.load()) { if (const void* b = fImpl->jit_entry.load()) {
#if SKVM_JIT_STATS #if SKVM_JIT_STATS
jits++; jits++;
fast += n;
#endif #endif
void** a = args; void** a = args;
switch (fImpl->strides.size()) { switch (fImpl->strides.size()) {