aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar ericrk <ericrk@chromium.org>2016-02-05 15:32:36 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-05 15:32:36 -0800
commit369e9375a3ab7bb56580fc6b22690a76ad759240 (patch)
tree2f5acce207039a5208d711de64380090ff43a9eb /src/gpu
parent60dcd3cb85797b555e47f3e66de81728a2eca40f (diff)
Add Histogram Macros to Skia
Adds a set of histogram macros to Skia, modeled after Chrome's UMA_HISTOGRAM_* macros. These allow logging of high frequency events, and are useful to analyze real world usage of certain features. By default, these macros are no-ops. Users can provide a custom header file which defines these macros if they wish to collect histogram data. Chrome will provide such a header. I've currently only added two macros: - SK_HISTOGRAM_BOOLEAN - logs a true/false type relationship (whether we are tiling a texture or not on each draw). - SK_HISTOGRAM_ENUMERATION - logs a set of potential values (which of a number of choices were selected for the texture upload path). We could add more unused macros at the moment, but it seems easier to add these as needed, WDYT? BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1652053004 Review URL: https://codereview.chromium.org/1652053004
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/SkGpuDevice.cpp4
-rw-r--r--src/gpu/SkGpuDevice_drawTexture.cpp3
2 files changed, 7 insertions, 0 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index c0a05797ea..060b2a1e45 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -925,6 +925,10 @@ void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap,
int tileSize,
bool bicubic) {
ASSERT_SINGLE_OWNER
+
+ // This is the funnel for all paths that draw tiled bitmaps/images. Log histogram entry.
+ SK_HISTOGRAM_BOOLEAN("DrawTiled", true);
+
// The following pixel lock is technically redundant, but it is desirable
// to lock outside of the tile loop to prevent redecoding the whole image
// at each tile in cases where 'bitmap' holds an SkDiscardablePixelRef that
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index efbc6c98d5..5c5fb12421 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -94,6 +94,9 @@ void SkGpuDevice::drawTextureProducer(GrTextureProducer* producer,
const SkMatrix& viewMatrix,
const GrClip& clip,
const SkPaint& paint) {
+ // This is the funnel for all non-tiled bitmap/image draw calls. Log a histogram entry.
+ SK_HISTOGRAM_BOOLEAN("DrawTiled", false);
+
// Figure out the actual dst and src rect by clipping the src rect to the bounds of the
// adjuster. If the src rect is clipped then the dst rect must be recomputed. Also determine
// the matrix that maps the src rect to the dst rect.