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_main.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_main.cc')
-rw-r--r-- | chrome/browser/browser_main.cc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index dd0e825..19b505a 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -41,6 +41,7 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/histogram_synchronizer.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/main_function_params.h" #include "chrome/common/pref_names.h" @@ -427,6 +428,13 @@ int BrowserMain(const MainFunctionParams& parameters) { // Initialize histogram statistics gathering system. StatisticsRecorder statistics; + // Initialize histogram synchronizer system. This is a singleton and is used + // for posting tasks via NewRunnableMethod. Its deleted when it goes out of + // scope. Even though NewRunnableMethod does AddRef and Release, the object + // will not be deleted after the Task is executed. + scoped_refptr<HistogramSynchronizer> histogram_synchronizer = + new HistogramSynchronizer(); + // Initialize the shared instance of user data manager. scoped_ptr<UserDataManager> user_data_manager(UserDataManager::Create()); @@ -565,14 +573,18 @@ int BrowserMain(const MainFunctionParams& parameters) { // Set up a field trial to see what disabling DNS pre-resolution does to // latency of network transactions. FieldTrial::Probability kDIVISOR = 100; - FieldTrial::Probability k_PROBABILITY_PER_GROUP = 10; // 10%. + FieldTrial::Probability k_PROBABILITY_PER_GROUP = 10; // 10% probability. + // For options we don't (currently) wish to test, we use zero probability. + FieldTrial::Probability k_PROBABILITY_DISABLED = 0; scoped_refptr<FieldTrial> dns_trial = new FieldTrial("DnsImpact", kDIVISOR); dns_trial->AppendGroup("_disabled_prefetch", k_PROBABILITY_PER_GROUP); + // Don't discard names (erase these lines) yet, as we may use them, and we + // have histogram data named for these options. int disabled_plus_4_connections = dns_trial->AppendGroup( - "_disabled_prefetch_4_connections", k_PROBABILITY_PER_GROUP); + "_disabled_prefetch_4_connections", k_PROBABILITY_DISABLED); int enabled_plus_4_connections = dns_trial->AppendGroup( - "_enabled_prefetch_4_connections", k_PROBABILITY_PER_GROUP); + "_enabled_prefetch_4_connections", k_PROBABILITY_DISABLED); scoped_ptr<chrome_browser_net::DnsPrefetcherInit> dns_prefetch_init; if (dns_trial->group() == FieldTrial::kNotParticipating || |