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

Unified Diff: chrome/browser/performance_monitor/database.h

Issue 10805050: Chrome Performance Monitor: MetricDetails refactor. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/performance_monitor/database.h
diff --git a/chrome/browser/performance_monitor/database.h b/chrome/browser/performance_monitor/database.h
index 765a30321f386f1bc4fa3940e55963c7e6228f64..ecd368958dc6ec3bc486db40f4dfd26af293703a 100644
--- a/chrome/browser/performance_monitor/database.h
+++ b/chrome/browser/performance_monitor/database.h
@@ -141,55 +141,55 @@ class Database {
}
// Add a metric instance to the database.
- bool AddMetric(const std::string& activity, const std::string& metric,
+ bool AddMetric(const std::string& activity,
+ MetricType metric_type,
const std::string& value);
- bool AddMetric(const std::string& metric, const std::string& value) {
- return AddMetric(kProcessChromeAggregate, metric, value);
+ bool AddMetric(MetricType metric_type, const std::string& value) {
+ return AddMetric(kProcessChromeAggregate, metric_type, value);
}
- void AddMetricDetails(const MetricDetails& details);
-
// Get the metrics that are active for the given process between |start|
// (inclusive) and |end| (exclusive).
- std::vector<MetricDetails> GetActiveMetrics(const base::Time& start,
- const base::Time& end);
+ std::vector<const MetricDetails*> GetActiveMetrics(const base::Time& start,
+ const base::Time& end);
// Get the activities that are active for the given metric after |start|.
- std::vector<std::string> GetActiveActivities(const std::string& metric,
+ std::vector<std::string> GetActiveActivities(MetricType metric_type,
const base::Time& start);
- // Query given metric and activity.
+ // Query given |metric_type| and |activity|.
MetricInfoVector GetStatsForActivityAndMetric(const std::string& activity,
- const std::string& metric,
+ MetricType metric_type,
const base::Time& start,
const base::Time& end);
- MetricInfoVector GetStatsForActivityAndMetric(const std::string& metric,
+ MetricInfoVector GetStatsForActivityAndMetric(MetricType metric_type,
const base::Time& start,
const base::Time& end) {
- return GetStatsForActivityAndMetric(kProcessChromeAggregate, metric,
+ return GetStatsForActivityAndMetric(kProcessChromeAggregate, metric_type,
start, end);
}
MetricInfoVector GetStatsForActivityAndMetric(const std::string& activity,
- const std::string& metric) {
- return GetStatsForActivityAndMetric(activity, metric, base::Time(),
+ MetricType metric_type) {
+ return GetStatsForActivityAndMetric(activity, metric_type, base::Time(),
clock_->GetTime());
}
- MetricInfoVector GetStatsForActivityAndMetric(const std::string& metric) {
- return GetStatsForActivityAndMetric(kProcessChromeAggregate, metric,
+ MetricInfoVector GetStatsForActivityAndMetric(MetricType metric_type) {
+ return GetStatsForActivityAndMetric(kProcessChromeAggregate, metric_type,
base::Time(), clock_->GetTime());
}
- // Query given metric. The returned map is keyed by activity.
- MetricVectorMap GetStatsForMetricByActivity(const std::string& metric,
+ // Query given |metric_type|. The returned map is keyed by activity.
+ MetricVectorMap GetStatsForMetricByActivity(MetricType metric_type,
const base::Time& start,
const base::Time& end);
- MetricVectorMap GetStatsForMetricByActivity(const std::string& metric) {
- return GetStatsForMetricByActivity(metric, base::Time(), clock_->GetTime());
+ MetricVectorMap GetStatsForMetricByActivity(MetricType metric_type) {
+ return GetStatsForMetricByActivity(
+ metric_type, base::Time(), clock_->GetTime());
}
// Returns the active time intervals that overlap with the time interval
@@ -208,7 +208,6 @@ class Database {
FRIEND_TEST_ALL_PREFIXES(PerformanceMonitorDatabaseSetupTest, ActiveInterval);
typedef std::map<std::string, std::string> RecentMap;
- typedef std::map<std::string, MetricDetails> MetricDetailsMap;
// By default, the database uses a clock that simply returns the current time.
class SystemClock : public Clock {
@@ -222,8 +221,6 @@ class Database {
void InitDBs();
- void InitMetricDetails();
-
bool Close();
// Load recent info from the db into recent_map_.
@@ -237,10 +234,6 @@ class Database {
// insert.
RecentMap recent_map_;
- // A mapping of a metric key to details about that metric. New metrics should
- // modify InitMetricDetails to add an entry in this map.
- MetricDetailsMap metric_details_map_;
-
// The directory where all the databases will reside.
FilePath path_;
« no previous file with comments | « no previous file | chrome/browser/performance_monitor/database.cc » ('j') | chrome/browser/performance_monitor/database.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698