shill: Add preliminary UMA support
Add preliminary UMA framework and support for common service metrics and one
WiFi metric (Network.Shill.WiFi.Channel) so we can thrash out how the
metrics fit in the current code. Other metrics will be added in the
future and are tracked by separate bugs.
BUG=chromium-os:22062
TEST=Unit tests
Change-Id: If3dc6da2e66e846e2178a1700b2576218b90abda
Reviewed-on: https://gerrit.chromium.org/gerrit/12474
Commit-Ready: Thieu Le <thieule@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
diff --git a/wifi_service.cc b/wifi_service.cc
index 1f2d978..995394f 100644
--- a/wifi_service.cc
+++ b/wifi_service.cc
@@ -20,6 +20,7 @@
#include "shill/error.h"
#include "shill/event_dispatcher.h"
#include "shill/ieee80211.h"
+#include "shill/metrics.h"
#include "shill/property_accessor.h"
#include "shill/store_interface.h"
#include "shill/wifi.h"
@@ -158,17 +159,6 @@
string WiFiService::GetStorageIdentifier() const {
return storage_identifier_;
}
-const string &WiFiService::mode() const {
- return mode_;
-}
-
-const string &WiFiService::key_management() const {
- return GetEAPKeyManagement();
-}
-
-const vector<uint8_t> &WiFiService::ssid() const {
- return ssid_;
-}
void WiFiService::SetPassphrase(const string &passphrase, Error *error) {
if (security_ == flimflam::kSecurityWep) {
@@ -265,6 +255,26 @@
return GetSecurityClass(security) == GetSecurityClass(security_);
}
+void WiFiService::InitializeCustomMetrics() const {
+ string histogram = metrics()->GetFullMetricName(
+ Metrics::kMetricTimeToJoinMilliseconds,
+ technology());
+ metrics()->AddServiceStateTransitionTimer(this,
+ histogram,
+ Service::kStateAssociating,
+ Service::kStateConfiguring);
+}
+
+void WiFiService::SendPostReadyStateMetrics() const {
+ // TODO(thieule): Send physical mode and security metrics.
+ // crosbug.com/24441
+ metrics()->SendEnumToUMA(
+ metrics()->GetFullMetricName(Metrics::kMetricNetworkChannel,
+ technology()),
+ Metrics::WiFiFrequencyToChannel(frequency_),
+ Metrics::kMetricNetworkChannelMax);
+}
+
// private methods
void WiFiService::HelpRegisterDerivedString(
PropertyStore *store,