OLD | NEW |
---|---|
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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
279 base::AutoLock auto_lock(*lock_); | 279 base::AutoLock auto_lock(*lock_); |
280 histograms_ = new HistogramMap; | 280 histograms_ = new HistogramMap; |
281 ranges_ = new RangesMap; | 281 ranges_ = new RangesMap; |
282 | 282 |
283 if (VLOG_IS_ON(1)) | 283 if (VLOG_IS_ON(1)) |
284 AtExitManager::RegisterCallback(&DumpHistogramsToVlog, this); | 284 AtExitManager::RegisterCallback(&DumpHistogramsToVlog, this); |
285 } | 285 } |
286 | 286 |
287 // static | 287 // static |
288 void StatisticsRecorder::DumpHistogramsToVlog(void* instance) { | 288 void StatisticsRecorder::DumpHistogramsToVlog(void* instance) { |
289 DCHECK(VLOG_IS_ON(1)); | 289 if (!VLOG_IS_ON(1)) |
290 return; | |
Ilya Sherman
2015/05/12 20:18:34
I think we can just remove this check. The functi
| |
290 | 291 |
291 string output; | 292 string output; |
292 StatisticsRecorder::WriteGraph(std::string(), &output); | 293 StatisticsRecorder::WriteGraph(std::string(), &output); |
293 VLOG(1) << output; | 294 VLOG(1) << output; |
294 } | 295 } |
295 | 296 |
296 StatisticsRecorder::~StatisticsRecorder() { | 297 StatisticsRecorder::~StatisticsRecorder() { |
297 DCHECK(histograms_ && ranges_ && lock_); | 298 DCHECK(histograms_ && ranges_ && lock_); |
298 | 299 |
299 // Clean up. | 300 // Clean up. |
(...skipping 13 matching lines...) Expand all Loading... | |
313 | 314 |
314 | 315 |
315 // static | 316 // static |
316 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; | 317 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; |
317 // static | 318 // static |
318 StatisticsRecorder::RangesMap* StatisticsRecorder::ranges_ = NULL; | 319 StatisticsRecorder::RangesMap* StatisticsRecorder::ranges_ = NULL; |
319 // static | 320 // static |
320 base::Lock* StatisticsRecorder::lock_ = NULL; | 321 base::Lock* StatisticsRecorder::lock_ = NULL; |
321 | 322 |
322 } // namespace base | 323 } // namespace base |
OLD | NEW |