| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Histogram is an object that aggregates statistics, and can summarize them in | 5 // Histogram is an object that aggregates statistics, and can summarize them in |
| 6 // various forms, including ASCII graphical, HTML, and numerically (as a | 6 // various forms, including ASCII graphical, HTML, and numerically (as a |
| 7 // vector of numbers corresponding to each of the aggregating buckets). | 7 // vector of numbers corresponding to each of the aggregating buckets). |
| 8 // See header file for details and examples. | 8 // See header file for details and examples. |
| 9 | 9 |
| 10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 pickle.WriteInt(histogram.declared_max()); | 357 pickle.WriteInt(histogram.declared_max()); |
| 358 pickle.WriteSize(histogram.bucket_count()); | 358 pickle.WriteSize(histogram.bucket_count()); |
| 359 pickle.WriteInt(histogram.histogram_type()); | 359 pickle.WriteInt(histogram.histogram_type()); |
| 360 pickle.WriteInt(histogram.flags()); | 360 pickle.WriteInt(histogram.flags()); |
| 361 | 361 |
| 362 snapshot.Serialize(&pickle); | 362 snapshot.Serialize(&pickle); |
| 363 return std::string(static_cast<const char*>(pickle.data()), pickle.size()); | 363 return std::string(static_cast<const char*>(pickle.data()), pickle.size()); |
| 364 } | 364 } |
| 365 | 365 |
| 366 // static | 366 // static |
| 367 void Histogram::DeserializeHistogramList( | |
| 368 const std::vector<std::string>& histograms) { | |
| 369 for (std::vector<std::string>::const_iterator it = histograms.begin(); | |
| 370 it < histograms.end(); | |
| 371 ++it) { | |
| 372 DeserializeHistogramInfo(*it); | |
| 373 } | |
| 374 } | |
| 375 | |
| 376 // static | |
| 377 bool Histogram::DeserializeHistogramInfo(const std::string& histogram_info) { | 367 bool Histogram::DeserializeHistogramInfo(const std::string& histogram_info) { |
| 378 if (histogram_info.empty()) { | 368 if (histogram_info.empty()) { |
| 379 return false; | 369 return false; |
| 380 } | 370 } |
| 381 | 371 |
| 382 Pickle pickle(histogram_info.data(), | 372 Pickle pickle(histogram_info.data(), |
| 383 static_cast<int>(histogram_info.size())); | 373 static_cast<int>(histogram_info.size())); |
| 384 void* iter = NULL; | 374 void* iter = NULL; |
| 385 size_t bucket_count; | 375 size_t bucket_count; |
| 386 int declared_min; | 376 int declared_min; |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 snapshot->push_back(it->second); | 775 snapshot->push_back(it->second); |
| 786 } | 776 } |
| 787 } | 777 } |
| 788 | 778 |
| 789 // static | 779 // static |
| 790 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; | 780 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; |
| 791 // static | 781 // static |
| 792 Lock* StatisticsRecorder::lock_ = NULL; | 782 Lock* StatisticsRecorder::lock_ = NULL; |
| 793 // static | 783 // static |
| 794 bool StatisticsRecorder::dump_on_exit_ = false; | 784 bool StatisticsRecorder::dump_on_exit_ = false; |
| OLD | NEW |