diff options
author | jvoung@chromium.org <jvoung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-20 19:49:13 +0000 |
---|---|---|
committer | jvoung@chromium.org <jvoung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-20 19:49:13 +0000 |
commit | 7f7408e8026b001ddab934660eae9c46f9b321d8 (patch) | |
tree | 12fcae76a4c5920f05018122a3878ea20d3ee332 /ppapi | |
parent | 37b63f556570e9abfc52bad7f2f8780654eb8ffb (diff) | |
download | chromium_src-7f7408e8026b001ddab934660eae9c46f9b321d8.zip chromium_src-7f7408e8026b001ddab934660eae9c46f9b321d8.tar.gz chromium_src-7f7408e8026b001ddab934660eae9c46f9b321d8.tar.bz2 |
Add UMA entry for PNaCl's optimization level setting.
Goes with: https://chromereviews.googleplex.com/7176013
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3325
Review URL: https://chromiumcodereview.appspot.com/12756004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189368 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc index cc2ea36..bcf6362 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc +++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc @@ -189,11 +189,17 @@ const int32_t kKBPSMin = 1; const int32_t kKBPSMax = 30*1000; // max of 30 MB / sec. const uint32_t kKBPSBuckets = 100; +const PPB_UMA_Private* uma_interface = NULL; + const PPB_UMA_Private* GetUMAInterface() { + if (uma_interface != NULL) { + return uma_interface; + } pp::Module *module = pp::Module::Get(); DCHECK(module); - return static_cast<const PPB_UMA_Private*>( + uma_interface = static_cast<const PPB_UMA_Private*>( module->GetBrowserInterface(PPB_UMA_PRIVATE_INTERFACE)); + return uma_interface; } void HistogramTime(const std::string& name, int64_t ms) { @@ -251,6 +257,19 @@ void HistogramEnumerateTranslationCache(bool hit) { hit, 2); } +// Opt level is expected to be 0 to 3. Treating 4 as unknown. +const int8_t kOptUnknown = 4; + +void HistogramOptLevel(int8_t opt_level) { + const PPB_UMA_Private* ptr = GetUMAInterface(); + if (ptr == NULL) return; + if (opt_level < 0 || opt_level > 3) { + opt_level = kOptUnknown; + } + ptr->HistogramEnumeration(pp::Var("NaCl.Options.PNaCl.OptLevel").pp_var(), + opt_level, kOptUnknown+1); +} + } // namespace @@ -416,6 +435,7 @@ void PnaclCoordinator::TranslateFinished(int32_t pp_error) { } // If there are no errors, report stats from this thread (the main thread). + HistogramOptLevel(pnacl_options_.opt_level()); const plugin::PnaclTimeStats& time_stats = translate_thread_->GetTimeStats(); HistogramTime("NaCl.Perf.PNaClLoadTime.LoadCompiler", time_stats.pnacl_llc_load_time / NACL_MICROS_PER_MILLI); |