| 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 // StatisticsRecorder holds all Histograms and BucketRanges that are used by | 5 // StatisticsRecorder holds all Histograms and BucketRanges that are used by |
| 6 // Histograms in the system. It provides a general place for | 6 // Histograms in the system. It provides a general place for |
| 7 // Histograms/BucketRanges to register, and supports a global API for accessing | 7 // Histograms/BucketRanges to register, and supports a global API for accessing |
| 8 // (i.e., dumping, or graphing) the data. | 8 // (i.e., dumping, or graphing) the data. |
| 9 | 9 |
| 10 #ifndef BASE_METRICS_STATISTICS_RECORDER_H_ | 10 #ifndef BASE_METRICS_STATISTICS_RECORDER_H_ |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // Initializes the StatisticsRecorder system. Safe to call multiple times. | 66 // Initializes the StatisticsRecorder system. Safe to call multiple times. |
| 67 static void Initialize(); | 67 static void Initialize(); |
| 68 | 68 |
| 69 // Find out if histograms can now be registered into our list. | 69 // Find out if histograms can now be registered into our list. |
| 70 static bool IsActive(); | 70 static bool IsActive(); |
| 71 | 71 |
| 72 // Register, or add a new histogram to the collection of statistics. If an | 72 // Register, or add a new histogram to the collection of statistics. If an |
| 73 // identically named histogram is already registered, then the argument | 73 // identically named histogram is already registered, then the argument |
| 74 // |histogram| will deleted. The returned value is always the registered | 74 // |histogram| will deleted. The returned value is always the registered |
| 75 // histogram (either the argument, or the pre-existing registered histogram). | 75 // histogram (either the argument, or the pre-existing registered histogram). |
| 76 static HistogramBase* RegisterOrDeleteDuplicate(HistogramBase* histogram); | 76 static HistogramBase* RegisterOrDeleteDuplicate( |
| 77 scoped_ptr<HistogramBase> histogram); |
| 77 | 78 |
| 78 // Register, or add a new BucketRanges. If an identically BucketRanges is | 79 // Register, or add a new BucketRanges. If an identically BucketRanges is |
| 79 // already registered, then the argument |ranges| will deleted. The returned | 80 // already registered, then the argument |ranges| will deleted. The returned |
| 80 // value is always the registered BucketRanges (either the argument, or the | 81 // value is always the registered BucketRanges (either the argument, or the |
| 81 // pre-existing one). | 82 // pre-existing one). |
| 82 static const BucketRanges* RegisterOrDeleteDuplicateRanges( | 83 static const BucketRanges* RegisterOrDeleteDuplicateRanges( |
| 83 const BucketRanges* ranges); | 84 scoped_ptr<const BucketRanges> ranges); |
| 84 | 85 |
| 85 // Methods for appending histogram data to a string. Only histograms which | 86 // Methods for appending histogram data to a string. Only histograms which |
| 86 // have |query| as a substring are written to |output| (an empty string will | 87 // have |query| as a substring are written to |output| (an empty string will |
| 87 // process all registered histograms). | 88 // process all registered histograms). |
| 88 static void WriteHTMLGraph(const std::string& query, std::string* output); | 89 static void WriteHTMLGraph(const std::string& query, std::string* output); |
| 89 static void WriteGraph(const std::string& query, std::string* output); | 90 static void WriteGraph(const std::string& query, std::string* output); |
| 90 | 91 |
| 91 // Returns the histograms with |query| as a substring as JSON text (an empty | 92 // Returns the histograms with |query| as a substring as JSON text (an empty |
| 92 // |query| will process all registered histograms). | 93 // |query| will process all registered histograms). |
| 93 static std::string ToJSON(const std::string& query); | 94 static std::string ToJSON(const std::string& query); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 176 |
| 176 // Lock protects access to above maps. | 177 // Lock protects access to above maps. |
| 177 static base::Lock* lock_; | 178 static base::Lock* lock_; |
| 178 | 179 |
| 179 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); | 180 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); |
| 180 }; | 181 }; |
| 181 | 182 |
| 182 } // namespace base | 183 } // namespace base |
| 183 | 184 |
| 184 #endif // BASE_METRICS_STATISTICS_RECORDER_H_ | 185 #endif // BASE_METRICS_STATISTICS_RECORDER_H_ |
| OLD | NEW |