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 #ifndef CHROME_BROWSER_PERFORMANCE_MONITOR_METRIC_H_ | 5 #ifndef CHROME_BROWSER_PERFORMANCE_MONITOR_METRIC_H_ |
6 #define CHROME_BROWSER_PERFORMANCE_MONITOR_METRIC_H_ | 6 #define CHROME_BROWSER_PERFORMANCE_MONITOR_METRIC_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 | 10 |
11 namespace performance_monitor { | 11 namespace performance_monitor { |
12 | 12 |
13 // IMPORTANT: To add new metrics, please | 13 // IMPORTANT: To add new metrics, please |
14 // - Place the new metric above METRIC_NUMBER_OF_METRICS. | 14 // - Place the new metric above METRIC_NUMBER_OF_METRICS. |
15 // - Add a member to the MetricKeyChar enum in key_builder.cc. | 15 // - Add a member to the MetricKeyChar enum in key_builder.cc. |
16 // - Add the appropriate messages in generated_resources.grd. | 16 // - Add the appropriate messages in generated_resources.grd. |
17 // - Add the appropriate functions in | 17 // - Add the appropriate functions in |
18 // chrome/browser/ui/webui/performance_monitor/performance_monitor_l10n.h. | 18 // chrome/browser/ui/webui/performance_monitor/performance_monitor_l10n.h. |
19 enum MetricType { | 19 enum MetricType { |
20 METRIC_UNDEFINED, | 20 METRIC_UNDEFINED, |
21 METRIC_CPU_USAGE, | 21 |
22 METRIC_PRIVATE_MEMORY_USAGE, | 22 // CPU and memory usage are combined for all Chrome-related processes. |
23 METRIC_SHARED_MEMORY_USAGE, | 23 METRIC_CPU_USAGE, |
24 METRIC_STARTUP_TIME, | 24 METRIC_PRIVATE_MEMORY_USAGE, |
25 METRIC_TEST_STARTUP_TIME, | 25 METRIC_SHARED_MEMORY_USAGE, |
26 METRIC_SESSION_RESTORE_TIME, | 26 |
27 METRIC_PAGE_LOAD_TIME, | 27 // Timing measurements; these are all independent metrics (e.g., session |
28 METRIC_NETWORK_BYTES_READ, | 28 // restore time is independent of startup time, even though they may happen |
29 METRIC_NUMBER_OF_METRICS | 29 // in sequence). Test startup time refers to any non-normal startup time, e.g. |
| 30 // when we run test suites. |
| 31 METRIC_STARTUP_TIME, |
| 32 METRIC_TEST_STARTUP_TIME, |
| 33 METRIC_SESSION_RESTORE_TIME, |
| 34 METRIC_PAGE_LOAD_TIME, |
| 35 |
| 36 // Total number of bytes read since PerformanceMonitor first started running. |
| 37 METRIC_NETWORK_BYTES_READ, |
| 38 |
| 39 METRIC_NUMBER_OF_METRICS |
30 }; | 40 }; |
31 | 41 |
32 struct Metric { | 42 struct Metric { |
33 public: | 43 public: |
34 Metric(); | 44 Metric(); |
35 Metric(MetricType metric_type, | 45 Metric(MetricType metric_type, |
36 const base::Time& metric_time, | 46 const base::Time& metric_time, |
37 const double metric_value); | 47 const double metric_value); |
38 Metric(MetricType metric_type, | 48 Metric(MetricType metric_type, |
39 const std::string& metric_time, | 49 const std::string& metric_time, |
(...skipping 11 matching lines...) Expand all Loading... |
51 std::string ValueAsString() const; | 61 std::string ValueAsString() const; |
52 | 62 |
53 MetricType type; | 63 MetricType type; |
54 base::Time time; | 64 base::Time time; |
55 double value; | 65 double value; |
56 }; | 66 }; |
57 | 67 |
58 } // namespace performance_monitor | 68 } // namespace performance_monitor |
59 | 69 |
60 #endif // CHROME_BROWSER_PERFORMANCE_MONITOR_METRIC_H_ | 70 #endif // CHROME_BROWSER_PERFORMANCE_MONITOR_METRIC_H_ |
OLD | NEW |