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

Unified Diff: metrics_daemon.h

Issue 2864009: Log active use time between kernel crashes. (Closed) Base URL: ssh://git@chromiumos-git/metrics.git
Patch Set: Fix potential memory leaks and usage of freed resources. Created 10 years, 6 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 | « Makefile ('k') | metrics_daemon.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: metrics_daemon.h
diff --git a/metrics_daemon.h b/metrics_daemon.h
index 50958b8d9a02bfb35c9e5dbb9473c129c649179e..437cafd0ec2e33af5e4de272dc84a422f4b25bb9 100644
--- a/metrics_daemon.h
+++ b/metrics_daemon.h
@@ -31,7 +31,9 @@ class MetricsDaemon {
private:
friend class MetricsDaemonTest;
+ FRIEND_TEST(MetricsDaemonTest, CheckKernelCrash);
FRIEND_TEST(MetricsDaemonTest, DailyUseReporter);
+ FRIEND_TEST(MetricsDaemonTest, KernelCrashIntervalReporter);
FRIEND_TEST(MetricsDaemonTest, LookupNetworkState);
FRIEND_TEST(MetricsDaemonTest, LookupPowerState);
FRIEND_TEST(MetricsDaemonTest, LookupScreenSaverState);
@@ -40,6 +42,7 @@ class MetricsDaemon {
FRIEND_TEST(MetricsDaemonTest, NetStateChangedSimpleDrop);
FRIEND_TEST(MetricsDaemonTest, NetStateChangedSuspend);
FRIEND_TEST(MetricsDaemonTest, PowerStateChanged);
+ FRIEND_TEST(MetricsDaemonTest, ProcessKernelCrash);
FRIEND_TEST(MetricsDaemonTest, ProcessUserCrash);
FRIEND_TEST(MetricsDaemonTest, ScreenSaverStateChanged);
FRIEND_TEST(MetricsDaemonTest, SendMetric);
@@ -85,6 +88,10 @@ class MetricsDaemon {
static const int kMetricDailyUseTimeMin;
static const int kMetricDailyUseTimeMax;
static const int kMetricDailyUseTimeBuckets;
+ static const char kMetricKernelCrashIntervalName[];
+ static const int kMetricKernelCrashIntervalMin;
+ static const int kMetricKernelCrashIntervalMax;
+ static const int kMetricKernelCrashIntervalBuckets;
static const char kMetricTimeToNetworkDropName[];
static const int kMetricTimeToNetworkDropMin;
static const int kMetricTimeToNetworkDropMax;
@@ -152,6 +159,14 @@ class MetricsDaemon {
// process crashes.
void ProcessUserCrash();
+ // Updates the active use time and logs time between kernel crashes.
+ void ProcessKernelCrash();
+
+ // Checks if a kernel crash has been detected and processes if so.
+ // The method assumes that a kernel crash has happened if
+ // |crash_file| exists.
+ void CheckKernelCrash(const std::string& crash_file);
+
// Callbacks for the daily use monitor. The daily use monitor uses
// LogDailyUseRecord to aggregate current usage data and send it to
// UMA, if necessary. It also reschedules itself using an
@@ -187,6 +202,10 @@ class MetricsDaemon {
// crashes and send to UMA.
static void UserCrashIntervalReporter(void* data, int tag, int count);
+ // TaggedCounter callback to process time between kernel crashes and
+ // send to UMA.
+ static void KernelCrashIntervalReporter(void* data, int tag, int count);
+
// Test mode.
bool testing_;
@@ -222,6 +241,9 @@ class MetricsDaemon {
// Active use time between user-space process crashes.
scoped_ptr<chromeos_metrics::TaggedCounterInterface> user_crash_interval_;
+ // Active use time between kernel crashes.
+ scoped_ptr<chromeos_metrics::TaggedCounterInterface> kernel_crash_interval_;
+
// Sleep period until the next daily usage aggregation performed by
// the daily use monitor (see ScheduleUseMonitor).
int usemon_interval_;
« no previous file with comments | « Makefile ('k') | metrics_daemon.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698