diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-28 22:02:46 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-28 22:02:46 +0000 |
commit | c9a3ef84a7d486d4dd24fe8332b8b83ed833885d (patch) | |
tree | e1180399782984b4f1ffd909be6149c5ce1cc736 /chrome/browser/browser_about_handler.cc | |
parent | c2a44c4852ad9f800968dcc32e3344c948c2bc88 (diff) | |
download | chromium_src-c9a3ef84a7d486d4dd24fe8332b8b83ed833885d.zip chromium_src-c9a3ef84a7d486d4dd24fe8332b8b83ed833885d.tar.gz chromium_src-c9a3ef84a7d486d4dd24fe8332b8b83ed833885d.tar.bz2 |
Automatically adapt to faster/slower uploads of renderer histograms
This replaces the current time based approach (chrome is given N seconds
to upload all renederer histograms) with an asynch callback approach
that waits until all renderers have responded (with their updates). It
uses a fall-back timer to ensure that a hung renderer won't delay things
forever as well.
This causes faster (and complete) updates in about:histograms as well
as generally assuring complete updates during UMA gatherings.
This code was contributed by Raman Tenneti in CL 42496
http://codereview.chromium.org/42496
bug=12850
r=raman
Review URL: http://codereview.chromium.org/113473
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17123 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_about_handler.cc')
-rw-r--r-- | chrome/browser/browser_about_handler.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 6c46f18..f699b1e 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -24,6 +24,7 @@ #include "chrome/browser/net/dns_global.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_view_host.h" +#include "chrome/common/histogram_synchronizer.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" @@ -45,6 +46,9 @@ #include "chrome/browser/views/about_network_dialog.h" #endif +using base::Time; +using base::TimeDelta; + namespace { // The paths used for the about pages. @@ -137,16 +141,14 @@ std::string AboutDns() { } std::string AboutHistograms(const std::string& query) { - std::string data; - for (RenderProcessHost::iterator it = RenderProcessHost::begin(); - it != RenderProcessHost::end(); ++it) { - it->second->Send(new ViewMsg_GetRendererHistograms()); - } + TimeDelta wait_time = TimeDelta::FromMilliseconds(10000); - // TODO(raman): Delay page layout until we get respnoses - // back from renderers, and not have to use a fixed size delay. - PlatformThread::Sleep(1000); + HistogramSynchronizer* current_synchronizer = + HistogramSynchronizer::CurrentSynchronizer(); + DCHECK(current_synchronizer != NULL); + current_synchronizer->FetchRendererHistogramsSynchronously(wait_time); + std::string data; StatisticsRecorder::WriteHTMLGraph(query, &data); return data; } |