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

Unified Diff: src/platform/metrics/metrics_daemon.cc

Issue 1642018: Update the libmetrics API to match the new Chrome interface. (Closed)
Patch Set: Address review comments. Created 10 years, 8 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
« no previous file with comments | « src/platform/metrics/metrics_daemon.h ('k') | src/platform/metrics/metrics_library.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/metrics/metrics_daemon.cc
diff --git a/src/platform/metrics/metrics_daemon.cc b/src/platform/metrics/metrics_daemon.cc
index 9bb9c205f1e8b199762d928e604fa2db479b9143..940085167c9dc4cb279cf40b4bdd7be9a7081e41 100644
--- a/src/platform/metrics/metrics_daemon.cc
+++ b/src/platform/metrics/metrics_daemon.cc
@@ -17,7 +17,7 @@ extern "C" {
MetricsDaemon::NetworkState
MetricsDaemon::network_states_[MetricsDaemon::kNumberNetworkStates] = {
-#define STATE(name, capname) { #name, "Connman" # capname },
+#define STATE(name, capname) { #name, "Network.Connman" # capname },
#include "network_states.h"
};
@@ -113,11 +113,11 @@ void MetricsDaemon::LogNetworkStateChange(const char* newstate) {
if (diff.tv_sec >= INT_MAX / 1000) {
diff_ms = INT_MAX;
}
- if (testing_) {
- TestPublishMetric(network_states_[old_id].stat_name, diff_ms);
- } else {
- ChromePublishMetric(network_states_[old_id].stat_name, diff_ms);
- }
+ PublishMetric(network_states_[old_id].stat_name,
+ diff_ms,
+ 1,
+ 8 * 60 * 60 * 1000, // 8 hours in milliseconds
+ 100);
}
network_state_id_ = new_id;
network_state_start_ = now;
@@ -133,10 +133,12 @@ MetricsDaemon::GetNetworkStateId(const char* state_name) {
return static_cast<NetworkStateId>(-1);
}
-void MetricsDaemon::ChromePublishMetric(const char* name, int value) {
- MetricsLibrary::SendToChrome(name, value);
-}
-
-void MetricsDaemon::TestPublishMetric(const char* name, int value) {
- LOG(INFO) << "received metric: " << name << " " << value;
+void MetricsDaemon::PublishMetric(const char* name, int sample,
+ int min, int max, int nbuckets) {
+ if (testing_) {
+ LOG(INFO) << "received metric: " << name << " " << sample <<
+ " " << min << " " << max << " " << nbuckets;
+ } else {
+ MetricsLibrary::SendToChrome(name, sample, min, max, nbuckets);
+ }
}
« no previous file with comments | « src/platform/metrics/metrics_daemon.h ('k') | src/platform/metrics/metrics_library.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698