shill: Log boot statistics for service state changes.
BUG=chromium-os:30169
TEST=unit tests, booted device, /tmp/disk-network-ready is populated
Change-Id: I8f0de3d3f9da2f73ca10977d46262fbbbbd56584
Reviewed-on: https://gerrit.chromium.org/gerrit/25084
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Darin Petkov <petkov@chromium.org>
diff --git a/metrics.cc b/metrics.cc
index 57de815..61b75cf 100644
--- a/metrics.cc
+++ b/metrics.cc
@@ -8,6 +8,7 @@
#include <base/string_util.h>
#include <base/stringprintf.h>
#include <chromeos/dbus/service_constants.h>
+#include <metrics/bootstat.h>
#include "shill/scope_logger.h"
#include "shill/wifi_service.h"
@@ -96,7 +97,8 @@
was_online_(false),
time_online_timer_(new chromeos_metrics::Timer),
time_to_drop_timer_(new chromeos_metrics::Timer),
- time_resume_to_ready_timer_(new chromeos_metrics::Timer) {
+ time_resume_to_ready_timer_(new chromeos_metrics::Timer),
+ collect_bootstats_(true) {
metrics_library_.Init();
chromeos_metrics::TimerReporter::set_metrics_lib(library_);
}
@@ -324,6 +326,14 @@
if (new_state == Service::kStateFailure)
SendServiceFailure(service);
+ if (collect_bootstats_) {
+ bootstat_log(
+ StringPrintf("network-%s-%s",
+ Technology::NameFromIdentifier(
+ service->technology()).c_str(),
+ service->GetStateString().c_str()).c_str());
+ }
+
if (new_state != Service::kStateConnected)
return;