Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc865898 authored by Luigi Semenzato's avatar Luigi Semenzato Committed by ChromeOS Commit Bot
Browse files

metrics: replace "Logging.*" with "Platform.*"

"Logging.*" is not a good name.
Also remove unused function ReportDailyUse().

BUG=chromium:508535
TEST=it compiles

Change-Id: I070bada4857abd80989ecc746adcbf1dcf6239a3
Reviewed-on: https://chromium-review.googlesource.com/284610


Tested-by: default avatarLuigi Semenzato <semenzato@chromium.org>
Reviewed-by: default avatarSonny Rao <sonnyrao@chromium.org>
Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
parent 1eea1618
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -52,7 +52,7 @@ Histogram Naming Convention


Use TrackerArea.MetricName. For example:
Use TrackerArea.MetricName. For example:


Logging.CrashCounter
Platform.DailyUseTime
Network.TimeToDrop
Network.TimeToDrop




+15 −27
Original line number Original line Diff line number Diff line
@@ -243,37 +243,37 @@ void MetricsDaemon::Init(bool testing,
  ticks_per_second_ = sysconf(_SC_CLK_TCK);
  ticks_per_second_ = sysconf(_SC_CLK_TCK);


  daily_active_use_.reset(
  daily_active_use_.reset(
      new PersistentInteger("Logging.DailyUseTime"));
      new PersistentInteger("Platform.DailyUseTime"));
  version_cumulative_active_use_.reset(
  version_cumulative_active_use_.reset(
      new PersistentInteger("Logging.CumulativeDailyUseTime"));
      new PersistentInteger("Platform.CumulativeDailyUseTime"));
  version_cumulative_cpu_use_.reset(
  version_cumulative_cpu_use_.reset(
      new PersistentInteger("Logging.CumulativeCpuTime"));
      new PersistentInteger("Platform.CumulativeCpuTime"));


  kernel_crash_interval_.reset(
  kernel_crash_interval_.reset(
      new PersistentInteger("Logging.KernelCrashInterval"));
      new PersistentInteger("Platform.KernelCrashInterval"));
  unclean_shutdown_interval_.reset(
  unclean_shutdown_interval_.reset(
      new PersistentInteger("Logging.UncleanShutdownInterval"));
      new PersistentInteger("Platform.UncleanShutdownInterval"));
  user_crash_interval_.reset(
  user_crash_interval_.reset(
      new PersistentInteger("Logging.UserCrashInterval"));
      new PersistentInteger("Platform.UserCrashInterval"));


  any_crashes_daily_count_.reset(
  any_crashes_daily_count_.reset(
      new PersistentInteger("Logging.AnyCrashesDaily"));
      new PersistentInteger("Platform.AnyCrashesDaily"));
  any_crashes_weekly_count_.reset(
  any_crashes_weekly_count_.reset(
      new PersistentInteger("Logging.AnyCrashesWeekly"));
      new PersistentInteger("Platform.AnyCrashesWeekly"));
  user_crashes_daily_count_.reset(
  user_crashes_daily_count_.reset(
      new PersistentInteger("Logging.UserCrashesDaily"));
      new PersistentInteger("Platform.UserCrashesDaily"));
  user_crashes_weekly_count_.reset(
  user_crashes_weekly_count_.reset(
      new PersistentInteger("Logging.UserCrashesWeekly"));
      new PersistentInteger("Platform.UserCrashesWeekly"));
  kernel_crashes_daily_count_.reset(
  kernel_crashes_daily_count_.reset(
      new PersistentInteger("Logging.KernelCrashesDaily"));
      new PersistentInteger("Platform.KernelCrashesDaily"));
  kernel_crashes_weekly_count_.reset(
  kernel_crashes_weekly_count_.reset(
      new PersistentInteger("Logging.KernelCrashesWeekly"));
      new PersistentInteger("Platform.KernelCrashesWeekly"));
  kernel_crashes_version_count_.reset(
  kernel_crashes_version_count_.reset(
      new PersistentInteger("Logging.KernelCrashesSinceUpdate"));
      new PersistentInteger("Platform.KernelCrashesSinceUpdate"));
  unclean_shutdowns_daily_count_.reset(
  unclean_shutdowns_daily_count_.reset(
      new PersistentInteger("Logging.UncleanShutdownsDaily"));
      new PersistentInteger("Platform.UncleanShutdownsDaily"));
  unclean_shutdowns_weekly_count_.reset(
  unclean_shutdowns_weekly_count_.reset(
      new PersistentInteger("Logging.UncleanShutdownsWeekly"));
      new PersistentInteger("Platform.UncleanShutdownsWeekly"));


  daily_cycle_.reset(new PersistentInteger("daily.cycle"));
  daily_cycle_.reset(new PersistentInteger("daily.cycle"));
  weekly_cycle_.reset(new PersistentInteger("weekly.cycle"));
  weekly_cycle_.reset(new PersistentInteger("weekly.cycle"));
@@ -1039,18 +1039,6 @@ bool MetricsDaemon::ProcessMemuse(const string& meminfo_raw) {
  return true;
  return true;
}
}


void MetricsDaemon::ReportDailyUse(int use_seconds) {
  if (use_seconds <= 0)
    return;

  int minutes = (use_seconds + kSecondsPerMinute / 2) / kSecondsPerMinute;
  SendSample("Logging.DailyUseTime",
             minutes,
             1,
             kMinutesPerDay * 30 * 2,  // cumulative---two months worth
             50);
}

void MetricsDaemon::SendSample(const string& name, int sample,
void MetricsDaemon::SendSample(const string& name, int sample,
                               int min, int max, int nbuckets) {
                               int min, int max, int nbuckets) {
  metrics_lib_->SendToUMA(name, sample, min, max, nbuckets);
  metrics_lib_->SendToUMA(name, sample, min, max, nbuckets);
+0 −4
Original line number Original line Diff line number Diff line
@@ -75,7 +75,6 @@ class MetricsDaemon : public chromeos::DBusDaemon {
  FRIEND_TEST(MetricsDaemonTest, ProcessUserCrash);
  FRIEND_TEST(MetricsDaemonTest, ProcessUserCrash);
  FRIEND_TEST(MetricsDaemonTest, ReportCrashesDailyFrequency);
  FRIEND_TEST(MetricsDaemonTest, ReportCrashesDailyFrequency);
  FRIEND_TEST(MetricsDaemonTest, ReadFreqToInt);
  FRIEND_TEST(MetricsDaemonTest, ReadFreqToInt);
  FRIEND_TEST(MetricsDaemonTest, ReportDailyUse);
  FRIEND_TEST(MetricsDaemonTest, ReportDiskStats);
  FRIEND_TEST(MetricsDaemonTest, ReportDiskStats);
  FRIEND_TEST(MetricsDaemonTest, ReportKernelCrashInterval);
  FRIEND_TEST(MetricsDaemonTest, ReportKernelCrashInterval);
  FRIEND_TEST(MetricsDaemonTest, ReportUncleanShutdownInterval);
  FRIEND_TEST(MetricsDaemonTest, ReportUncleanShutdownInterval);
@@ -179,9 +178,6 @@ class MetricsDaemon : public chromeos::DBusDaemon {
  // exists, so it must not be called more than once.
  // exists, so it must not be called more than once.
  bool CheckSystemCrash(const std::string& crash_file);
  bool CheckSystemCrash(const std::string& crash_file);


  // Report daily use through UMA.
  void ReportDailyUse(int use_seconds);

  // Sends a regular (exponential) histogram sample to Chrome for
  // Sends a regular (exponential) histogram sample to Chrome for
  // transport to UMA. See MetricsLibrary::SendToUMA in
  // transport to UMA. See MetricsLibrary::SendToUMA in
  // metrics_library.h for a description of the arguments.
  // metrics_library.h for a description of the arguments.
+0 −12
Original line number Original line Diff line number Diff line
@@ -212,18 +212,6 @@ TEST_F(MetricsDaemonTest, CheckSystemCrash) {
  base::DeleteFile(crash_detected, false);
  base::DeleteFile(crash_detected, false);
}
}


TEST_F(MetricsDaemonTest, ReportDailyUse) {
  ExpectSample("Logging.DailyUseTime", 2);
  daemon_.ReportDailyUse(90);

  ExpectSample("Logging.DailyUseTime", 1);
  daemon_.ReportDailyUse(89);

  // There should be no metrics generated for the calls below.
  daemon_.ReportDailyUse(0);
  daemon_.ReportDailyUse(-5);
}

TEST_F(MetricsDaemonTest, MessageFilter) {
TEST_F(MetricsDaemonTest, MessageFilter) {
  // Ignore calls to SendToUMA.
  // Ignore calls to SendToUMA.
  EXPECT_CALL(metrics_lib_, SendToUMA(_, _, _, _, _)).Times(AnyNumber());
  EXPECT_CALL(metrics_lib_, SendToUMA(_, _, _, _, _)).Times(AnyNumber());