| 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 ranges_ = new RangesMap; | 282 ranges_ = new RangesMap; |
| 283 | 283 |
| 284 if (VLOG_IS_ON(1)) | 284 if (VLOG_IS_ON(1)) |
| 285 AtExitManager::RegisterCallback(&DumpHistogramsToVlog, this); | 285 AtExitManager::RegisterCallback(&DumpHistogramsToVlog, this); |
| 286 } | 286 } |
| 287 | 287 |
| 288 // static | 288 // static |
| 289 void StatisticsRecorder::DumpHistogramsToVlog(void* instance) { | 289 void StatisticsRecorder::DumpHistogramsToVlog(void* instance) { |
| 290 DCHECK(VLOG_IS_ON(1)); | 290 DCHECK(VLOG_IS_ON(1)); |
| 291 | 291 |
| 292 StatisticsRecorder* me = reinterpret_cast<StatisticsRecorder*>(instance); | |
| 293 string output; | 292 string output; |
| 294 me->WriteGraph(std::string(), &output); | 293 StatisticsRecorder::WriteGraph(std::string(), &output); |
| 295 VLOG(1) << output; | 294 VLOG(1) << output; |
| 296 } | 295 } |
| 297 | 296 |
| 298 StatisticsRecorder::~StatisticsRecorder() { | 297 StatisticsRecorder::~StatisticsRecorder() { |
| 299 DCHECK(histograms_ && ranges_ && lock_); | 298 DCHECK(histograms_ && ranges_ && lock_); |
| 300 | 299 |
| 301 // Clean up. | 300 // Clean up. |
| 302 scoped_ptr<HistogramMap> histograms_deleter; | 301 scoped_ptr<HistogramMap> histograms_deleter; |
| 303 scoped_ptr<RangesMap> ranges_deleter; | 302 scoped_ptr<RangesMap> ranges_deleter; |
| 304 // We don't delete lock_ on purpose to avoid having to properly protect | 303 // We don't delete lock_ on purpose to avoid having to properly protect |
| (...skipping 10 matching lines...) Expand all Loading... |
| 315 | 314 |
| 316 | 315 |
| 317 // static | 316 // static |
| 318 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; | 317 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; |
| 319 // static | 318 // static |
| 320 StatisticsRecorder::RangesMap* StatisticsRecorder::ranges_ = NULL; | 319 StatisticsRecorder::RangesMap* StatisticsRecorder::ranges_ = NULL; |
| 321 // static | 320 // static |
| 322 base::Lock* StatisticsRecorder::lock_ = NULL; | 321 base::Lock* StatisticsRecorder::lock_ = NULL; |
| 323 | 322 |
| 324 } // namespace base | 323 } // namespace base |
| OLD | NEW |