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

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

Issue 10843010: Adds a method to the Performance Monitor Database to fetch the most recent metric. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: using get instead of an iterator 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.cc
diff --git a/chrome/browser/performance_monitor/database.cc b/chrome/browser/performance_monitor/database.cc
index 8eb135080a00cedf9b51c82893712d7fc4520b0b..5844ff237728d931aae7bcf299349b2d8f152bed 100644
--- a/chrome/browser/performance_monitor/database.cc
+++ b/chrome/browser/performance_monitor/database.cc
@@ -379,6 +379,23 @@ std::vector<std::string> Database::GetActiveActivities(
return results;
}
+bool Database::GetRecentStatsForActivityAndMetric(
+ const std::string& activity,
+ MetricType metric,
+ MetricInfo* info) {
+ CHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ std::string recent_map_key = CreateRecentMapKey(metric, activity);
+ if (!recent_map_.count(recent_map_key))
Yoyo Zhou 2012/08/02 11:54:57 Use ContainsKey from stl_util.h.
+ return false;
+ std::string recent_key = recent_map_[recent_map_key];
+
+ std::string result;
+ leveldb::Status status = recent_db_->Get(read_options_, recent_key, &result);
+ if (status.ok())
+ *info = MetricInfo(SplitRecentKey(recent_key).time, result);
+ return status.ok();
+}
+
Database::MetricInfoVector Database::GetStatsForActivityAndMetric(
const std::string& activity, MetricType metric_type,
const base::Time& start, const base::Time& end) {

Powered by Google App Engine
This is Rietveld 408576698