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 "chrome/browser/performance_monitor/metric_details.h" | 5 #include "chrome/browser/performance_monitor/metric_details.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/performance_monitor/constants.h" | 8 #include "chrome/browser/performance_monitor/constants.h" |
9 | 9 |
10 namespace performance_monitor { | 10 namespace performance_monitor { |
11 namespace { | 11 namespace { |
12 | 12 |
13 // Keep this array synced with MetricTypes in the header file. | 13 // Keep this array synced with MetricTypes in the header file. |
14 // TODO(mtytel): i18n. | 14 // TODO(mtytel): i18n. |
15 const char* kMetricTypeNames[] = { | 15 const MetricDetails kMetricDetailsList[] = { |
16 kSampleMetricName | 16 { |
| 17 kMetricCPUUsageName, |
| 18 kMetricCPUUsageDescription, |
| 19 kMetricCPUUsageUnits, |
| 20 kMetricCPUUsageTickSize, |
| 21 }, |
| 22 { |
| 23 kMetricPrivateMemoryUsageName, |
| 24 kMetricPrivateMemoryUsageDescription, |
| 25 kMetricPrivateMemoryUsageUnits, |
| 26 kMetricPrivateMemoryUsageTickSize |
| 27 }, |
17 }; | 28 }; |
18 COMPILE_ASSERT(ARRAYSIZE_UNSAFE(kMetricTypeNames) == METRIC_NUMBER_OF_METRICS, | 29 COMPILE_ASSERT(ARRAYSIZE_UNSAFE(kMetricDetailsList) == METRIC_NUMBER_OF_METRICS, |
19 metric_names_incorrect_size); | 30 metric_names_incorrect_size); |
20 | 31 |
21 } // namespace | 32 } // namespace |
22 | 33 |
23 const char* MetricTypeToString(MetricType metric_type) { | 34 const MetricDetails* GetMetricDetails(MetricType metric_type) { |
24 DCHECK_GT(METRIC_NUMBER_OF_METRICS, metric_type); | 35 DCHECK_GT(METRIC_NUMBER_OF_METRICS, metric_type); |
25 return kMetricTypeNames[metric_type]; | 36 return &kMetricDetailsList[metric_type]; |
26 } | |
27 | |
28 MetricDetails::MetricDetails() { | |
29 } | |
30 | |
31 MetricDetails::MetricDetails(const std::string& metric_name, | |
32 const std::string& metric_description) | |
33 : name(metric_name), | |
34 description(metric_description) { | |
35 } | |
36 | |
37 MetricDetails::~MetricDetails() { | |
38 } | 37 } |
39 | 38 |
40 } // namespace performance_monitor | 39 } // namespace performance_monitor |
OLD | NEW |