| 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 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 METRIC_TEST_STARTUP_TIME, | 25 METRIC_TEST_STARTUP_TIME, |
| 26 METRIC_SESSION_RESTORE_TIME, | 26 METRIC_SESSION_RESTORE_TIME, |
| 27 METRIC_PAGE_LOAD_TIME, | 27 METRIC_PAGE_LOAD_TIME, |
| 28 METRIC_NETWORK_BYTES_READ, | 28 METRIC_NETWORK_BYTES_READ, |
| 29 METRIC_NUMBER_OF_METRICS | 29 METRIC_NUMBER_OF_METRICS |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 struct Metric { | 32 struct Metric { |
| 33 public: | 33 public: |
| 34 Metric(); | 34 Metric(); |
| 35 Metric(MetricType metric_type, | 35 Metric(const base::Time& metric_time, const double metric_value); |
| 36 const base::Time& metric_time, | 36 Metric(const std::string& metric_time, const std::string& metric_value); |
| 37 const double metric_value); | |
| 38 Metric(MetricType metric_type, | |
| 39 const std::string& metric_time, | |
| 40 const std::string& metric_value); | |
| 41 ~Metric(); | 37 ~Metric(); |
| 42 | 38 |
| 43 // Check the value in the metric to make sure that it is reasonable. Since | |
| 44 // some metric-gathering methods will fail and return incorrect values, we | |
| 45 // need to try to weed these out as best we can. | |
| 46 bool IsValid() const; | |
| 47 | |
| 48 // This converts the double stored in value to a string format. This will | |
| 49 // not perform any checking on the validity of the metric, and only makes | |
| 50 // sense if the metric IsValid(). | |
| 51 std::string ValueAsString() const; | |
| 52 | |
| 53 MetricType type; | |
| 54 base::Time time; | 39 base::Time time; |
| 55 double value; | 40 double value; |
| 56 }; | 41 }; |
| 57 | 42 |
| 58 } // namespace performance_monitor | 43 } // namespace performance_monitor |
| 59 | 44 |
| 60 #endif // CHROME_BROWSER_PERFORMANCE_MONITOR_METRIC_H_ | 45 #endif // CHROME_BROWSER_PERFORMANCE_MONITOR_METRIC_H_ |
| OLD | NEW |