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

Unified Diff: content/browser/battery_status/battery_status_manager_linux.cc

Issue 480113003: Battery Status API: add UMA logging for Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added enum for "5+" label Created 6 years, 4 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/battery_status/battery_status_manager_linux.cc
diff --git a/content/browser/battery_status/battery_status_manager_linux.cc b/content/browser/battery_status/battery_status_manager_linux.cc
index e6abf88ed4eb11b4f53ee7b1e9d771e87caf98d5..eab83c383f9f06cd644900c181dc1e5e1ce622b4 100644
--- a/content/browser/battery_status/battery_status_manager_linux.cc
+++ b/content/browser/battery_status/battery_status_manager_linux.cc
@@ -5,6 +5,7 @@
#include "content/browser/battery_status/battery_status_manager_linux.h"
#include "base/macros.h"
+#include "base/metrics/histogram.h"
#include "base/threading/thread.h"
#include "base/values.h"
#include "content/browser/battery_status/battery_status_manager.h"
@@ -96,6 +97,11 @@ scoped_ptr<PathsVector> GetPowerSourcesPaths(dbus::ObjectProxy* proxy) {
return paths.Pass();;
}
+void UpdateNumberBatteriesHistogram(int count) {
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ "BatteryStatus.NumberBatteriesLinux", count, 1, 5, 6);
+}
+
// Class that represents a dedicated thread which communicates with DBus to
// obtain battery information and receives battery change notifications.
class BatteryStatusNotificationThread : public base::Thread {
@@ -131,6 +137,7 @@ class BatteryStatusNotificationThread : public base::Thread {
system_bus_->GetObjectProxy(kUPowerServiceName,
dbus::ObjectPath(kUPowerPath));
scoped_ptr<PathsVector> device_paths = GetPowerSourcesPaths(power_proxy);
+ int num_batteries = 0;
for (size_t i = 0; i < device_paths->size(); ++i) {
const dbus::ObjectPath& device_path = device_paths->at(i);
@@ -157,14 +164,16 @@ class BatteryStatusNotificationThread : public base::Thread {
// TODO(timvolodine): add support for multiple batteries. Currently we
// only collect information from the first battery we encounter
// (crbug.com/400780).
- // TODO(timvolodine): add UMA logging for this case.
LOG(WARNING) << "multiple batteries found, "
<< "using status data of the first battery only.";
} else {
battery_proxy_ = device_proxy;
}
+ num_batteries++;
}
+ UpdateNumberBatteriesHistogram(num_batteries);
+
if (!battery_proxy_) {
callback_.Run(blink::WebBatteryStatus());
return;
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698