Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2141)

Unified Diff: chrome/browser/jankometer.cc

Issue 6780035: Use lock-free lazy initialization for static histogram references (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/jankometer.cc
===================================================================
--- chrome/browser/jankometer.cc (revision 79771)
+++ chrome/browser/jankometer.cc (working copy)
@@ -119,8 +119,8 @@
// Counters for the two types of jank we measure.
base::StatsCounter slow_processing_counter_; // Msgs w/ long proc time.
base::StatsCounter queueing_delay_counter_; // Msgs w/ long queueing delay.
- scoped_refptr<base::Histogram> process_times_; // Time spent proc. task.
- scoped_refptr<base::Histogram> total_times_; // Total queueing plus proc.
+ base::Histogram* const process_times_; // Time spent proc. task.
+ base::Histogram* const total_times_; // Total queueing plus proc.
JankWatchdog total_time_watchdog_; // Watching for excessive total_time.
DISALLOW_COPY_AND_ASSIGN(JankObserverHelper);
@@ -135,13 +135,14 @@
events_till_measurement_(0),
slow_processing_counter_(std::string("Chrome.SlowMsg") + thread_name),
queueing_delay_counter_(std::string("Chrome.DelayMsg") + thread_name),
+ process_times_(base::Histogram::FactoryGet(
+ std::string("Chrome.ProcMsgL ") + thread_name,
+ 1, 3600000, 50, base::Histogram::kUmaTargetedHistogramFlag)),
+ total_times_(base::Histogram::FactoryGet(
+ std::string("Chrome.TotalMsgL ") + thread_name,
+ 1, 3600000, 50, base::Histogram::kUmaTargetedHistogramFlag)),
total_time_watchdog_(excessive_duration, thread_name, watchdog_enable) {
- process_times_ = base::Histogram::FactoryGet(
- std::string("Chrome.ProcMsgL ") + thread_name,
- 1, 3600000, 50, base::Histogram::kUmaTargetedHistogramFlag);
- total_times_ = base::Histogram::FactoryGet(
- std::string("Chrome.TotalMsgL ") + thread_name,
- 1, 3600000, 50, base::Histogram::kUmaTargetedHistogramFlag);
+ ;
ramant (doing other things) 2011/04/01 20:07:26 Extra semicolon?
jar (doing other things) 2011/04/01 21:50:27 Done.
if (discard_count_ > 0) {
// Select a vaguely random sample-start-point.
events_till_measurement_ = static_cast<int>(

Powered by Google App Engine
This is Rietveld 408576698