| 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 MetricDetails kMetricDetailsList[] = { | 15 const MetricDetails kMetricDetailsList[] = { |
| 16 { | 16 { |
| 17 kMetricCPUUsageName, | 17 kMetricCPUUsageName, |
| 18 kMetricCPUUsageDescription, | 18 kMetricCPUUsageDescription, |
| 19 kMetricCPUUsageUnits, | 19 kMetricCPUUsageUnits, |
| 20 kMetricCPUUsageTickSize, | 20 kMetricCPUUsageTickSize, |
| 21 }, | 21 }, |
| 22 { | 22 { |
| 23 kMetricPrivateMemoryUsageName, | 23 kMetricPrivateMemoryUsageName, |
| 24 kMetricPrivateMemoryUsageDescription, | 24 kMetricPrivateMemoryUsageDescription, |
| 25 kMetricPrivateMemoryUsageUnits, | 25 kMetricPrivateMemoryUsageUnits, |
| 26 kMetricPrivateMemoryUsageTickSize | 26 kMetricPrivateMemoryUsageTickSize |
| 27 }, | 27 }, |
| 28 { |
| 29 kMetricSharedMemoryUsageName, |
| 30 kMetricSharedMemoryUsageDescription, |
| 31 kMetricSharedMemoryUsageUnits, |
| 32 kMetricSharedMemoryUsageTickSize |
| 33 }, |
| 28 }; | 34 }; |
| 29 COMPILE_ASSERT(ARRAYSIZE_UNSAFE(kMetricDetailsList) == METRIC_NUMBER_OF_METRICS, | 35 COMPILE_ASSERT(ARRAYSIZE_UNSAFE(kMetricDetailsList) == METRIC_NUMBER_OF_METRICS, |
| 30 metric_names_incorrect_size); | 36 metric_names_incorrect_size); |
| 31 | 37 |
| 32 } // namespace | 38 } // namespace |
| 33 | 39 |
| 34 const MetricDetails* GetMetricDetails(MetricType metric_type) { | 40 const MetricDetails* GetMetricDetails(MetricType metric_type) { |
| 35 DCHECK_GT(METRIC_NUMBER_OF_METRICS, metric_type); | 41 DCHECK_GT(METRIC_NUMBER_OF_METRICS, metric_type); |
| 36 return &kMetricDetailsList[metric_type]; | 42 return &kMetricDetailsList[metric_type]; |
| 37 } | 43 } |
| 38 | 44 |
| 39 } // namespace performance_monitor | 45 } // namespace performance_monitor |
| OLD | NEW |