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

Side by Side Diff: base/metrics/statistics_recorder.cc

Issue 1083603002: Add histograms to record the number of writes to the prefs file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/metrics/statistics_recorder.h" 5 #include "base/metrics/statistics_recorder.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/debug/leak_annotations.h" 8 #include "base/debug/leak_annotations.h"
9 #include "base/json/string_escape.h" 9 #include "base/json/string_escape.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 13 matching lines...) Expand all
24 } // namespace 24 } // namespace
25 25
26 namespace base { 26 namespace base {
27 27
28 // static 28 // static
29 void StatisticsRecorder::Initialize() { 29 void StatisticsRecorder::Initialize() {
30 // Ensure that an instance of the StatisticsRecorder object is created. 30 // Ensure that an instance of the StatisticsRecorder object is created.
31 g_statistics_recorder_.Get(); 31 g_statistics_recorder_.Get();
32 } 32 }
33 33
34 // static
35 void StatisticsRecorder::InitializeForTest() {
36 Initialize();
37 histograms_->clear();
38 ranges_->clear();
39 }
34 40
35 // static 41 // static
36 bool StatisticsRecorder::IsActive() { 42 bool StatisticsRecorder::IsActive() {
37 if (lock_ == NULL) 43 if (lock_ == NULL)
38 return false; 44 return false;
39 base::AutoLock auto_lock(*lock_); 45 base::AutoLock auto_lock(*lock_);
40 return NULL != histograms_; 46 return NULL != histograms_;
41 } 47 }
42 48
43 // static 49 // static
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 320
315 321
316 // static 322 // static
317 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; 323 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL;
318 // static 324 // static
319 StatisticsRecorder::RangesMap* StatisticsRecorder::ranges_ = NULL; 325 StatisticsRecorder::RangesMap* StatisticsRecorder::ranges_ = NULL;
320 // static 326 // static
321 base::Lock* StatisticsRecorder::lock_ = NULL; 327 base::Lock* StatisticsRecorder::lock_ = NULL;
322 328
323 } // namespace base 329 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698