Commit 44788894 authored by Greg Daniel's avatar Greg Daniel Committed by Commit Bot

Enable support for uma histograms from Skia.

The histogram definitions were landed in Skia at:
https://skia-review.googlesource.com/c/skia/+/329963
https://skia-review.googlesource.com/c/skia/+/329776

The key change that enables these histograms is the including of
skia_historgram.h in SkUserConfig.h. This was disabled (by removing the
include) about 4 years ago because of "issues" but there is no bug
associated so its not clear what those issues are. The disable CL says
that "Skia histograms are generating invalid data". Building and running
locally I don't seem to get an errors being reported by chrome, and
the values in chrome://histograms all looks correct.

The plan here is that once this lands we will monitor the add metrics
for statistical anomalies to validate whether the previous errors from
four years ago have been fixed.

This also adds support for additional macros to be used.

Bug: skia:10871
Change-Id: Ic7447ecc66d882df7e1b6e5e1f4088a50ce56921
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505594
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Reviewed-by: default avatarBrian Salomon <bsalomon@google.com>
Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826753}
parent 68b9dea4
...@@ -119,8 +119,10 @@ ...@@ -119,8 +119,10 @@
* Skia consumers can provide their own definitions of these macros to * Skia consumers can provide their own definitions of these macros to
* integrate with their histogram collection backend. * integrate with their histogram collection backend.
*/ */
//#define SK_HISTOGRAM_BOOLEAN(name, value) //#define SK_HISTOGRAM_BOOLEAN(name, sample)
//#define SK_HISTOGRAM_ENUMERATION(name, value, boundary_value) //#define SK_HISTOGRAM_EXACT_LINEAR(name, sample, value_max)
//#define SK_HISTOGRAM_MEMORY_KB(name, sample)
#include "skia/ext/skia_histogram.h"
// ===== Begin Chrome-specific definitions ===== // ===== Begin Chrome-specific definitions =====
......
...@@ -20,15 +20,26 @@ void HistogramBoolean(std::atomic_uintptr_t* atomic_histogram_pointer, ...@@ -20,15 +20,26 @@ void HistogramBoolean(std::atomic_uintptr_t* atomic_histogram_pointer,
name, base::HistogramBase::kUmaTargetedHistogramFlag)); name, base::HistogramBase::kUmaTargetedHistogramFlag));
} }
// Wrapper around HISTOGRAM_POINTER_USE - mimics UMA_HISTOGRAM_ENUMERATION but // Wrapper around HISTOGRAM_POINTER_USE - mimics UMA_HISTOGRAM_EXACT_LINEAR but
// allows for an external atomic_histogram_pointer. // allows for an external atomic_histogram_pointer.
void HistogramEnumeration(std::atomic_uintptr_t* atomic_histogram_pointer, void HistogramExactLinear(std::atomic_uintptr_t* atomic_histogram_pointer,
const char* name, const char* name,
int sample, int sample,
int boundary_value) { int value_max) {
HISTOGRAM_POINTER_USE(atomic_histogram_pointer, name, Add(sample), HISTOGRAM_POINTER_USE(atomic_histogram_pointer, name, Add(sample),
base::LinearHistogram::FactoryGet( base::LinearHistogram::FactoryGet(
name, 1, boundary_value, boundary_value + 1, name, 1, value_max, value_max + 1,
base::HistogramBase::kUmaTargetedHistogramFlag));
}
// Wrapper around HISTOGRAM_POINTER_USE - mimics UMA_HISTOGRAM_MEMORY_KB but
// allows for an external atomic_histogram_pointer.
void HistogramMemoryKB(std::atomic_uintptr_t* atomic_histogram_pointer,
const char* name,
int sample) {
HISTOGRAM_POINTER_USE(atomic_histogram_pointer, name, Add(sample),
base::Histogram::FactoryGet(
name, 1000, 500000, 50,
base::HistogramBase::kUmaTargetedHistogramFlag)); base::HistogramBase::kUmaTargetedHistogramFlag));
} }
......
...@@ -24,19 +24,25 @@ ...@@ -24,19 +24,25 @@
#define SK_HISTOGRAM_BOOLEAN(name, sample) \ #define SK_HISTOGRAM_BOOLEAN(name, sample) \
SK_HISTOGRAM_POINTER_HELPER(skia::HistogramBoolean, "Skia." name, sample) SK_HISTOGRAM_POINTER_HELPER(skia::HistogramBoolean, "Skia." name, sample)
#define SK_HISTOGRAM_ENUMERATION(name, sample, boundary_value) \ #define SK_HISTOGRAM_EXACT_LINEAR(name, sample, value_max) \
SK_HISTOGRAM_POINTER_HELPER(skia::HistogramEnumeration, "Skia." name, \ SK_HISTOGRAM_POINTER_HELPER(skia::HistogramExactLinear, "Skia." name, \
sample, boundary_value) sample, value_max)
#define SK_HISTOGRAM_MEMORY_KB(name, sample) \
SK_HISTOGRAM_POINTER_HELPER(skia::HistogramMemoryKB, "Skia." name, sample)
namespace skia { namespace skia {
void HistogramBoolean(std::atomic_uintptr_t* atomic_histogram_pointer, void HistogramBoolean(std::atomic_uintptr_t* atomic_histogram_pointer,
const char* name, const char* name,
bool sample); bool sample);
void HistogramEnumeration(std::atomic_uintptr_t* atomic_histogram_pointer, void HistogramExactLinear(std::atomic_uintptr_t* atomic_histogram_pointer,
const char* name, const char* name,
int sample, int sample,
int boundary_value); int value_max);
void HistogramMemoryKB(std::atomic_uintptr_t* atomic_histogram_pointer,
const char* name,
int sample);
} // namespace skia } // namespace skia
......
...@@ -13497,11 +13497,17 @@ should be kept until we remove incident reporting. --> ...@@ -13497,11 +13497,17 @@ should be kept until we remove incident reporting. -->
<histogram name="Skia.DrawScaleFactor" enum="SkiaScaleFactor" <histogram name="Skia.DrawScaleFactor" enum="SkiaScaleFactor"
expires_after="M85"> expires_after="M85">
<obsolete>
Removed in Oct 2020.
</obsolete>
<owner>ericrk@chromium.org</owner> <owner>ericrk@chromium.org</owner>
<summary>The scale factor of any images drawn by Skia.</summary> <summary>The scale factor of any images drawn by Skia.</summary>
</histogram> </histogram>
<histogram name="Skia.DrawTiled" enum="BooleanTiled" expires_after="M85"> <histogram name="Skia.DrawTiled" enum="BooleanTiled" expires_after="M85">
<obsolete>
Removed in Oct 2020.
</obsolete>
<owner>ericrk@chromium.org</owner> <owner>ericrk@chromium.org</owner>
<summary> <summary>
Whether a call to drawBitmap(Rect) or drawImage(Rect) used the tiled or Whether a call to drawBitmap(Rect) or drawImage(Rect) used the tiled or
...@@ -13511,6 +13517,9 @@ should be kept until we remove incident reporting. --> ...@@ -13511,6 +13517,9 @@ should be kept until we remove incident reporting. -->
<histogram name="Skia.FilterQuality" enum="SkiaFilterQuality" <histogram name="Skia.FilterQuality" enum="SkiaFilterQuality"
expires_after="M85"> expires_after="M85">
<obsolete>
Removed in Oct 2020.
</obsolete>
<owner>ericrk@chromium.org</owner> <owner>ericrk@chromium.org</owner>
<summary> <summary>
The count of images drawn by Skia with a given filter quality. The count of images drawn by Skia with a given filter quality.
...@@ -13519,12 +13528,54 @@ should be kept until we remove incident reporting. --> ...@@ -13519,12 +13528,54 @@ should be kept until we remove incident reporting. -->
<histogram name="Skia.LockTexturePath" enum="SkiaLockTexturePath" <histogram name="Skia.LockTexturePath" enum="SkiaLockTexturePath"
expires_after="M85"> expires_after="M85">
<obsolete>
Removed in Oct 2020.
</obsolete>
<owner>ericrk@chromium.org</owner> <owner>ericrk@chromium.org</owner>
<summary> <summary>
The path taken by Skia when it attempts to lock a texture for use. The path taken by Skia when it attempts to lock a texture for use.
</summary> </summary>
</histogram> </histogram>
<histogram name="Skia.SubmitRenderPasses" units="renderpasses"
expires_after="2021-04-29">
<owner>egdaniel@google.com</owner>
<owner>bsalomon@google.com</owner>
<summary>
The number of Skia render passes sent to the GPU during a GrContext::submit
call. The max value that is sent here is 100 so anything in the 100 bucket
actually includes render pass counts of 100+. Though we don't expect to be
reaching 100 render passes often. This is collected each time we submit to
the GPU in Skia.
</summary>
</histogram>
<histogram name="Skia.VulkanMemoryAllocator.AmountAllocated" units="KB"
expires_after="2021-04-29">
<owner>egdaniel@google.com</owner>
<owner>bsalomon@google.com</owner>
<summary>
The total amount of memory that the GrVkMemoryAllocator used by Skia's
Vulkan backend has allocated. This is GPU memory for VkImages and VkBuffers.
Note that the allocator may be shared with other users outside of Skia and
this amount includes their uses as well. This is collected each time we
request an allocation from Skia.
</summary>
</histogram>
<histogram name="Skia.VulkanMemoryAllocator.PercentUsed" units="%"
expires_after="2021-04-29">
<owner>egdaniel@google.com</owner>
<owner>bsalomon@google.com</owner>
<summary>
The percent of allocated memory that is in use by the GrVkMemoryAllocator
used by Skia's Vulkan backend. This is GPU memory for VkImages and
VkBuffers. Note that the allocator may be shared with other users outside of
Skia and this includes their allocations as well. This is collected each
time we request an allocation from Skia.
</summary>
</histogram>
<histogram name="Snackbar.Shown" enum="SnackbarIdentifier" <histogram name="Snackbar.Shown" enum="SnackbarIdentifier"
expires_after="never"> expires_after="never">
<!-- expires-never: Required as long as snackbars exist. --> <!-- expires-never: Required as long as snackbars exist. -->
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment