Loading metricsd/metrics_daemon.cc +17 −18 Original line number Original line Diff line number Diff line Loading @@ -241,7 +241,7 @@ void MetricsDaemon::Init(bool testing, daily_active_use_.reset( daily_active_use_.reset( new PersistentInteger("Platform.DailyUseTime")); new PersistentInteger("Platform.DailyUseTime")); version_cumulative_active_use_.reset( version_cumulative_active_use_.reset( new PersistentInteger("Platform.CumulativeDailyUseTime")); new PersistentInteger("Platform.CumulativeUseTime")); version_cumulative_cpu_use_.reset( version_cumulative_cpu_use_.reset( new PersistentInteger("Platform.CumulativeCpuTime")); new PersistentInteger("Platform.CumulativeCpuTime")); Loading Loading @@ -444,7 +444,7 @@ void MetricsDaemon::ProcessUserCrash() { UpdateStats(TimeTicks::Now(), Time::Now()); UpdateStats(TimeTicks::Now(), Time::Now()); // Reports the active use time since the last crash and resets it. // Reports the active use time since the last crash and resets it. SendCrashIntervalSample(user_crash_interval_); SendAndResetCrashIntervalSample(user_crash_interval_); any_crashes_daily_count_->Add(1); any_crashes_daily_count_->Add(1); any_crashes_weekly_count_->Add(1); any_crashes_weekly_count_->Add(1); Loading @@ -457,7 +457,7 @@ void MetricsDaemon::ProcessKernelCrash() { UpdateStats(TimeTicks::Now(), Time::Now()); UpdateStats(TimeTicks::Now(), Time::Now()); // Reports the active use time since the last crash and resets it. // Reports the active use time since the last crash and resets it. SendCrashIntervalSample(kernel_crash_interval_); SendAndResetCrashIntervalSample(kernel_crash_interval_); any_crashes_daily_count_->Add(1); any_crashes_daily_count_->Add(1); any_crashes_weekly_count_->Add(1); any_crashes_weekly_count_->Add(1); Loading @@ -472,7 +472,7 @@ void MetricsDaemon::ProcessUncleanShutdown() { UpdateStats(TimeTicks::Now(), Time::Now()); UpdateStats(TimeTicks::Now(), Time::Now()); // Reports the active use time since the last crash and resets it. // Reports the active use time since the last crash and resets it. SendCrashIntervalSample(unclean_shutdown_interval_); SendAndResetCrashIntervalSample(unclean_shutdown_interval_); unclean_shutdowns_daily_count_->Add(1); unclean_shutdowns_daily_count_->Add(1); unclean_shutdowns_weekly_count_->Add(1); unclean_shutdowns_weekly_count_->Add(1); Loading Loading @@ -1033,7 +1033,7 @@ void MetricsDaemon::SendKernelCrashesCumulativeCountStats() { int64_t active_use_seconds = version_cumulative_active_use_->Get(); int64_t active_use_seconds = version_cumulative_active_use_->Get(); if (active_use_seconds > 0) { if (active_use_seconds > 0) { SendSample(version_cumulative_active_use_->Name(), SendSample(version_cumulative_active_use_->Name(), active_use_seconds / 1000, // stat is in seconds active_use_seconds, 1, // device may be used very little... 1, // device may be used very little... 8 * 1000 * 1000, // ... or a lot (about 90 days) 8 * 1000 * 1000, // ... or a lot (about 90 days) 100); 100); Loading @@ -1046,7 +1046,7 @@ void MetricsDaemon::SendKernelCrashesCumulativeCountStats() { } } } } void MetricsDaemon::SendDailyUseSample( void MetricsDaemon::SendAndResetDailyUseSample( const scoped_ptr<PersistentInteger>& use) { const scoped_ptr<PersistentInteger>& use) { SendSample(use->Name(), SendSample(use->Name(), use->GetAndClear(), use->GetAndClear(), Loading @@ -1055,7 +1055,7 @@ void MetricsDaemon::SendDailyUseSample( 50); // number of buckets 50); // number of buckets } } void MetricsDaemon::SendCrashIntervalSample( void MetricsDaemon::SendAndResetCrashIntervalSample( const scoped_ptr<PersistentInteger>& interval) { const scoped_ptr<PersistentInteger>& interval) { SendSample(interval->Name(), SendSample(interval->Name(), interval->GetAndClear(), interval->GetAndClear(), Loading @@ -1064,7 +1064,7 @@ void MetricsDaemon::SendCrashIntervalSample( 50); // number of buckets 50); // number of buckets } } void MetricsDaemon::SendCrashFrequencySample( void MetricsDaemon::SendAndResetCrashFrequencySample( const scoped_ptr<PersistentInteger>& frequency) { const scoped_ptr<PersistentInteger>& frequency) { SendSample(frequency->Name(), SendSample(frequency->Name(), frequency->GetAndClear(), frequency->GetAndClear(), Loading Loading @@ -1097,21 +1097,20 @@ void MetricsDaemon::UpdateStats(TimeTicks now_ticks, if (daily_cycle_->Get() != day) { if (daily_cycle_->Get() != day) { daily_cycle_->Set(day); daily_cycle_->Set(day); SendDailyUseSample(daily_active_use_); SendAndResetDailyUseSample(daily_active_use_); SendDailyUseSample(version_cumulative_active_use_); SendAndResetCrashFrequencySample(any_crashes_daily_count_); SendCrashFrequencySample(any_crashes_daily_count_); SendAndResetCrashFrequencySample(user_crashes_daily_count_); SendCrashFrequencySample(user_crashes_daily_count_); SendAndResetCrashFrequencySample(kernel_crashes_daily_count_); SendCrashFrequencySample(kernel_crashes_daily_count_); SendAndResetCrashFrequencySample(unclean_shutdowns_daily_count_); SendCrashFrequencySample(unclean_shutdowns_daily_count_); SendKernelCrashesCumulativeCountStats(); SendKernelCrashesCumulativeCountStats(); } } if (weekly_cycle_->Get() != week) { if (weekly_cycle_->Get() != week) { weekly_cycle_->Set(week); weekly_cycle_->Set(week); SendCrashFrequencySample(any_crashes_weekly_count_); SendAndResetCrashFrequencySample(any_crashes_weekly_count_); SendCrashFrequencySample(user_crashes_weekly_count_); SendAndResetCrashFrequencySample(user_crashes_weekly_count_); SendCrashFrequencySample(kernel_crashes_weekly_count_); SendAndResetCrashFrequencySample(kernel_crashes_weekly_count_); SendCrashFrequencySample(unclean_shutdowns_weekly_count_); SendAndResetCrashFrequencySample(unclean_shutdowns_weekly_count_); } } } } Loading metricsd/metrics_daemon.h +11 −7 Original line number Original line Diff line number Diff line Loading @@ -171,15 +171,19 @@ class MetricsDaemon : public chromeos::DBusDaemon { base::TimeDelta GetIncrementalCpuUse(); base::TimeDelta GetIncrementalCpuUse(); // Sends a sample representing the number of seconds of active use // Sends a sample representing the number of seconds of active use // for a 24-hour period. // for a 24-hour period and reset |use|. void SendDailyUseSample(const scoped_ptr<PersistentInteger>& use); void SendAndResetDailyUseSample( const scoped_ptr<PersistentInteger>& use); // Sends a sample representing a time interval between two crashes of the // Sends a sample representing a time interval between two crashes of the // same type. // same type and reset |interval|. void SendCrashIntervalSample(const scoped_ptr<PersistentInteger>& interval); void SendAndResetCrashIntervalSample( const scoped_ptr<PersistentInteger>& interval); // Sends a sample representing a frequency of crashes of some type. void SendCrashFrequencySample(const scoped_ptr<PersistentInteger>& frequency); // Sends a sample representing a frequency of crashes of some type and reset // |frequency|. void SendAndResetCrashFrequencySample( const scoped_ptr<PersistentInteger>& frequency); // Initializes vm and disk stats reporting. // Initializes vm and disk stats reporting. void StatsReporterInit(); void StatsReporterInit(); Loading Loading
metricsd/metrics_daemon.cc +17 −18 Original line number Original line Diff line number Diff line Loading @@ -241,7 +241,7 @@ void MetricsDaemon::Init(bool testing, daily_active_use_.reset( daily_active_use_.reset( new PersistentInteger("Platform.DailyUseTime")); new PersistentInteger("Platform.DailyUseTime")); version_cumulative_active_use_.reset( version_cumulative_active_use_.reset( new PersistentInteger("Platform.CumulativeDailyUseTime")); new PersistentInteger("Platform.CumulativeUseTime")); version_cumulative_cpu_use_.reset( version_cumulative_cpu_use_.reset( new PersistentInteger("Platform.CumulativeCpuTime")); new PersistentInteger("Platform.CumulativeCpuTime")); Loading Loading @@ -444,7 +444,7 @@ void MetricsDaemon::ProcessUserCrash() { UpdateStats(TimeTicks::Now(), Time::Now()); UpdateStats(TimeTicks::Now(), Time::Now()); // Reports the active use time since the last crash and resets it. // Reports the active use time since the last crash and resets it. SendCrashIntervalSample(user_crash_interval_); SendAndResetCrashIntervalSample(user_crash_interval_); any_crashes_daily_count_->Add(1); any_crashes_daily_count_->Add(1); any_crashes_weekly_count_->Add(1); any_crashes_weekly_count_->Add(1); Loading @@ -457,7 +457,7 @@ void MetricsDaemon::ProcessKernelCrash() { UpdateStats(TimeTicks::Now(), Time::Now()); UpdateStats(TimeTicks::Now(), Time::Now()); // Reports the active use time since the last crash and resets it. // Reports the active use time since the last crash and resets it. SendCrashIntervalSample(kernel_crash_interval_); SendAndResetCrashIntervalSample(kernel_crash_interval_); any_crashes_daily_count_->Add(1); any_crashes_daily_count_->Add(1); any_crashes_weekly_count_->Add(1); any_crashes_weekly_count_->Add(1); Loading @@ -472,7 +472,7 @@ void MetricsDaemon::ProcessUncleanShutdown() { UpdateStats(TimeTicks::Now(), Time::Now()); UpdateStats(TimeTicks::Now(), Time::Now()); // Reports the active use time since the last crash and resets it. // Reports the active use time since the last crash and resets it. SendCrashIntervalSample(unclean_shutdown_interval_); SendAndResetCrashIntervalSample(unclean_shutdown_interval_); unclean_shutdowns_daily_count_->Add(1); unclean_shutdowns_daily_count_->Add(1); unclean_shutdowns_weekly_count_->Add(1); unclean_shutdowns_weekly_count_->Add(1); Loading Loading @@ -1033,7 +1033,7 @@ void MetricsDaemon::SendKernelCrashesCumulativeCountStats() { int64_t active_use_seconds = version_cumulative_active_use_->Get(); int64_t active_use_seconds = version_cumulative_active_use_->Get(); if (active_use_seconds > 0) { if (active_use_seconds > 0) { SendSample(version_cumulative_active_use_->Name(), SendSample(version_cumulative_active_use_->Name(), active_use_seconds / 1000, // stat is in seconds active_use_seconds, 1, // device may be used very little... 1, // device may be used very little... 8 * 1000 * 1000, // ... or a lot (about 90 days) 8 * 1000 * 1000, // ... or a lot (about 90 days) 100); 100); Loading @@ -1046,7 +1046,7 @@ void MetricsDaemon::SendKernelCrashesCumulativeCountStats() { } } } } void MetricsDaemon::SendDailyUseSample( void MetricsDaemon::SendAndResetDailyUseSample( const scoped_ptr<PersistentInteger>& use) { const scoped_ptr<PersistentInteger>& use) { SendSample(use->Name(), SendSample(use->Name(), use->GetAndClear(), use->GetAndClear(), Loading @@ -1055,7 +1055,7 @@ void MetricsDaemon::SendDailyUseSample( 50); // number of buckets 50); // number of buckets } } void MetricsDaemon::SendCrashIntervalSample( void MetricsDaemon::SendAndResetCrashIntervalSample( const scoped_ptr<PersistentInteger>& interval) { const scoped_ptr<PersistentInteger>& interval) { SendSample(interval->Name(), SendSample(interval->Name(), interval->GetAndClear(), interval->GetAndClear(), Loading @@ -1064,7 +1064,7 @@ void MetricsDaemon::SendCrashIntervalSample( 50); // number of buckets 50); // number of buckets } } void MetricsDaemon::SendCrashFrequencySample( void MetricsDaemon::SendAndResetCrashFrequencySample( const scoped_ptr<PersistentInteger>& frequency) { const scoped_ptr<PersistentInteger>& frequency) { SendSample(frequency->Name(), SendSample(frequency->Name(), frequency->GetAndClear(), frequency->GetAndClear(), Loading Loading @@ -1097,21 +1097,20 @@ void MetricsDaemon::UpdateStats(TimeTicks now_ticks, if (daily_cycle_->Get() != day) { if (daily_cycle_->Get() != day) { daily_cycle_->Set(day); daily_cycle_->Set(day); SendDailyUseSample(daily_active_use_); SendAndResetDailyUseSample(daily_active_use_); SendDailyUseSample(version_cumulative_active_use_); SendAndResetCrashFrequencySample(any_crashes_daily_count_); SendCrashFrequencySample(any_crashes_daily_count_); SendAndResetCrashFrequencySample(user_crashes_daily_count_); SendCrashFrequencySample(user_crashes_daily_count_); SendAndResetCrashFrequencySample(kernel_crashes_daily_count_); SendCrashFrequencySample(kernel_crashes_daily_count_); SendAndResetCrashFrequencySample(unclean_shutdowns_daily_count_); SendCrashFrequencySample(unclean_shutdowns_daily_count_); SendKernelCrashesCumulativeCountStats(); SendKernelCrashesCumulativeCountStats(); } } if (weekly_cycle_->Get() != week) { if (weekly_cycle_->Get() != week) { weekly_cycle_->Set(week); weekly_cycle_->Set(week); SendCrashFrequencySample(any_crashes_weekly_count_); SendAndResetCrashFrequencySample(any_crashes_weekly_count_); SendCrashFrequencySample(user_crashes_weekly_count_); SendAndResetCrashFrequencySample(user_crashes_weekly_count_); SendCrashFrequencySample(kernel_crashes_weekly_count_); SendAndResetCrashFrequencySample(kernel_crashes_weekly_count_); SendCrashFrequencySample(unclean_shutdowns_weekly_count_); SendAndResetCrashFrequencySample(unclean_shutdowns_weekly_count_); } } } } Loading
metricsd/metrics_daemon.h +11 −7 Original line number Original line Diff line number Diff line Loading @@ -171,15 +171,19 @@ class MetricsDaemon : public chromeos::DBusDaemon { base::TimeDelta GetIncrementalCpuUse(); base::TimeDelta GetIncrementalCpuUse(); // Sends a sample representing the number of seconds of active use // Sends a sample representing the number of seconds of active use // for a 24-hour period. // for a 24-hour period and reset |use|. void SendDailyUseSample(const scoped_ptr<PersistentInteger>& use); void SendAndResetDailyUseSample( const scoped_ptr<PersistentInteger>& use); // Sends a sample representing a time interval between two crashes of the // Sends a sample representing a time interval between two crashes of the // same type. // same type and reset |interval|. void SendCrashIntervalSample(const scoped_ptr<PersistentInteger>& interval); void SendAndResetCrashIntervalSample( const scoped_ptr<PersistentInteger>& interval); // Sends a sample representing a frequency of crashes of some type. void SendCrashFrequencySample(const scoped_ptr<PersistentInteger>& frequency); // Sends a sample representing a frequency of crashes of some type and reset // |frequency|. void SendAndResetCrashFrequencySample( const scoped_ptr<PersistentInteger>& frequency); // Initializes vm and disk stats reporting. // Initializes vm and disk stats reporting. void StatsReporterInit(); void StatsReporterInit(); Loading