0

Add a new PDF histogram to measure renderer performance

Add a new histogram `PDF.RenderAndPaintVisiblePagesTime` to track the
time taken to fully display the visible part of the PDF inside the PDF
viewer. This metric will help us measure the rendering performance of
different PDF renderers, such as AGG and Skia.

Bug: 1394159
Change-Id: I5bae86c801e4dd4ce2f69ec9e35947956a528173
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4068144
Reviewed-by: Alan Screen <awscreen@chromium.org>
Commit-Queue: Nigi <nigi@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1078139}
This commit is contained in:
Hui Yingst
2022-12-01 17:39:53 +00:00
committed by Chromium LUCI CQ
parent 59332c563b
commit 5075bdfbb5
2 changed files with 19 additions and 0 deletions
pdf/pdfium
tools/metrics/histograms/metadata/pdf

@ -23,6 +23,7 @@
#include "base/debug/alias.h"
#include "base/feature_list.h"
#include "base/location.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@ -642,6 +643,11 @@ void PDFiumEngine::Paint(const gfx::Rect& rect,
std::vector<gfx::Rect>& ready,
std::vector<gfx::Rect>& pending) {
gfx::Rect leftover = rect;
// Set a timer here to check how long it takes to finish rendering and
// painting the visible pages.
base::TimeTicks begin_time = base::TimeTicks::Now();
for (size_t i = 0; i < visible_pages_.size(); ++i) {
int index = visible_pages_[i];
// Convert the current page's rectangle to screen rectangle. We do this
@ -707,6 +713,9 @@ void PDFiumEngine::Paint(const gfx::Rect& rect,
ready.push_back(dirty_in_screen);
}
}
base::UmaHistogramMediumTimes("PDF.RenderAndPaintVisiblePagesTime",
base::TimeTicks::Now() - begin_time);
}
void PDFiumEngine::PostPaint() {

@ -104,6 +104,16 @@ chromium-metrics-reviews@google.com.
</summary>
</histogram>
<histogram name="PDF.RenderAndPaintVisiblePagesTime" units="ms"
expires_after="2023-05-31">
<owner>nigi@chromium.org</owner>
<owner>thestig@chromium.org</owner>
<summary>
Time used for rendering and painting all the visible pages in the PDF
viewer.
</summary>
</histogram>
<histogram name="PDF.Version" enum="PDFVersion" expires_after="2023-04-16">
<owner>dhoss@chromium.org</owner>
<owner>thestig@chromium.org</owner>