| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // value is always the registered BucketRanges (either the argument, or the | 47 // value is always the registered BucketRanges (either the argument, or the |
| 48 // pre-existing one). | 48 // pre-existing one). |
| 49 static const BucketRanges* RegisterOrDeleteDuplicateRanges( | 49 static const BucketRanges* RegisterOrDeleteDuplicateRanges( |
| 50 const BucketRanges* ranges); | 50 const BucketRanges* ranges); |
| 51 | 51 |
| 52 // Methods for printing histograms. Only histograms which have query as | 52 // Methods for printing histograms. Only histograms which have query as |
| 53 // a substring are written to output (an empty string will process all | 53 // a substring are written to output (an empty string will process all |
| 54 // registered histograms). | 54 // registered histograms). |
| 55 static void WriteHTMLGraph(const std::string& query, std::string* output); | 55 static void WriteHTMLGraph(const std::string& query, std::string* output); |
| 56 static void WriteGraph(const std::string& query, std::string* output); | 56 static void WriteGraph(const std::string& query, std::string* output); |
| 57 static void WriteJSON(const std::string& query, std::string* output); |
| 57 | 58 |
| 58 // Method for extracting histograms which were marked for use by UMA. | 59 // Method for extracting histograms which were marked for use by UMA. |
| 59 static void GetHistograms(Histograms* output); | 60 static void GetHistograms(Histograms* output); |
| 60 | 61 |
| 61 // Method for extracting BucketRanges used by all histograms registered. | 62 // Method for extracting BucketRanges used by all histograms registered. |
| 62 static void GetBucketRanges(std::vector<const BucketRanges*>* output); | 63 static void GetBucketRanges(std::vector<const BucketRanges*>* output); |
| 63 | 64 |
| 64 // Find a histogram by name. It matches the exact name. This method is thread | 65 // Find a histogram by name. It matches the exact name. This method is thread |
| 65 // safe. It returns NULL if a matching histogram is not found. | 66 // safe. It returns NULL if a matching histogram is not found. |
| 66 static HistogramBase* FindHistogram(const std::string& name); | 67 static HistogramBase* FindHistogram(const std::string& name); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 102 |
| 102 // Lock protects access to above maps. | 103 // Lock protects access to above maps. |
| 103 static base::Lock* lock_; | 104 static base::Lock* lock_; |
| 104 | 105 |
| 105 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); | 106 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); |
| 106 }; | 107 }; |
| 107 | 108 |
| 108 } // namespace base | 109 } // namespace base |
| 109 | 110 |
| 110 #endif // BASE_METRICS_STATISTICS_RECORDER_H_ | 111 #endif // BASE_METRICS_STATISTICS_RECORDER_H_ |
| OLD | NEW |