Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: chrome/browser/performance_monitor/metric.h

Issue 10907121: Add guards to metric values; erase bad events/metrics from db (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_use_units
Patch Set: Estade's requests Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(const base::Time& metric_time, const double metric_value); 35 Metric(MetricType metric_type,
36 Metric(const std::string& metric_time, const std::string& metric_value); 36 const base::Time& metric_time,
37 const double metric_value);
38 Metric(MetricType metric_type,
39 const std::string& metric_time,
40 const std::string& metric_value);
37 ~Metric(); 41 ~Metric();
38 42
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;
39 base::Time time; 54 base::Time time;
40 double value; 55 double value;
41 }; 56 };
42 57
43 } // namespace performance_monitor 58 } // namespace performance_monitor
44 59
45 #endif // CHROME_BROWSER_PERFORMANCE_MONITOR_METRIC_H_ 60 #endif // CHROME_BROWSER_PERFORMANCE_MONITOR_METRIC_H_
OLDNEW
« no previous file with comments | « chrome/browser/performance_monitor/database_unittest.cc ('k') | chrome/browser/performance_monitor/metric.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698