Commit 9a2dbf2b authored by wychen's avatar wychen Committed by Commit bot

Add UMA histogram DomDistiller.Time.DistillPage

This measures time spent in DistillPageImpl(), which is mostly
ExecuteJavaScript(). This includes JavaScript compilation and execution.

We already have DomDistiller.Time.DistillationTotal, but it is measured
within JavaScript.

Review URL: https://codereview.chromium.org/1131493005

Cr-Commit-Position: refs/heads/master@{#329472}
parent 50883590
...@@ -88,6 +88,7 @@ void DistillerPage::DistillPage( ...@@ -88,6 +88,7 @@ void DistillerPage::DistillPage(
// the callback to OnDistillationDone happens. // the callback to OnDistillationDone happens.
ready_ = false; ready_ = false;
distiller_page_callback_ = callback; distiller_page_callback_ = callback;
distillation_start_ = base::TimeTicks::Now();
DistillPageImpl(gurl, GetDistillerScriptWithOptions(options, DistillPageImpl(gurl, GetDistillerScriptWithOptions(options,
StringifyOutput(), StringifyOutput(),
CreateNewContext())); CreateNewContext()));
...@@ -110,6 +111,11 @@ void DistillerPage::OnDistillationDone(const GURL& page_url, ...@@ -110,6 +111,11 @@ void DistillerPage::OnDistillationDone(const GURL& page_url,
if (!found_content) { if (!found_content) {
DVLOG(1) << "Unable to parse DomDistillerResult."; DVLOG(1) << "Unable to parse DomDistillerResult.";
} else { } else {
base::TimeDelta distillation_time =
base::TimeTicks::Now() - distillation_start_;
UMA_HISTOGRAM_TIMES("DomDistiller.Time.DistillPage", distillation_time);
VLOG(1) << "DomDistiller.Time.DistillPage = " << distillation_time;
if (distiller_result->has_timing_info()) { if (distiller_result->has_timing_info()) {
const dom_distiller::proto::TimingInfo& timing = const dom_distiller::proto::TimingInfo& timing =
distiller_result->timing_info(); distiller_result->timing_info();
...@@ -139,6 +145,8 @@ void DistillerPage::OnDistillationDone(const GURL& page_url, ...@@ -139,6 +145,8 @@ void DistillerPage::OnDistillationDone(const GURL& page_url,
UMA_HISTOGRAM_TIMES( UMA_HISTOGRAM_TIMES(
"DomDistiller.Time.DistillationTotal", "DomDistiller.Time.DistillationTotal",
base::TimeDelta::FromMillisecondsD(timing.total_time())); base::TimeDelta::FromMillisecondsD(timing.total_time()));
VLOG(1) << "DomDistiller.Time.DistillationTotal = " <<
base::TimeDelta::FromMillisecondsD(timing.total_time());
} }
} }
if (distiller_result->has_statistics_info()) { if (distiller_result->has_statistics_info()) {
......
...@@ -66,6 +66,7 @@ class DistillerPage { ...@@ -66,6 +66,7 @@ class DistillerPage {
private: private:
bool ready_; bool ready_;
DistillerPageCallback distiller_page_callback_; DistillerPageCallback distiller_page_callback_;
base::TimeTicks distillation_start_;
DISALLOW_COPY_AND_ASSIGN(DistillerPage); DISALLOW_COPY_AND_ASSIGN(DistillerPage);
}; };
......
...@@ -6009,6 +6009,14 @@ Therefore, the affected-histogram name has to have at least one dot in it. ...@@ -6009,6 +6009,14 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<summary>Complete time spent in DomDistiller's processing of a page.</summary> <summary>Complete time spent in DomDistiller's processing of a page.</summary>
</histogram> </histogram>
<histogram name="DomDistiller.Time.DistillPage" units="milliseconds">
<owner>wychen@chromium.org</owner>
<summary>
Time spent in DistillPageImpl(), mostly ExecuteJavaScript(), including
compilation and execution.
</summary>
</histogram>
<histogram name="DomDistiller.Time.DocumentConstruction" units="milliseconds"> <histogram name="DomDistiller.Time.DocumentConstruction" units="milliseconds">
<owner>yfriedman@chromium.org</owner> <owner>yfriedman@chromium.org</owner>
<summary> <summary>
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