storaged: remove redundant logging

Don't log disk_stats and emmc_info to system buffer since they
are already uploaded to events buffer.

Use DEBUG flag to control disk perf logging.

Bug: 34331490
Change-Id: I5f628a1a46e1f72588da064523da69737bd67dcb
diff --git a/storaged/include/storaged_utils.h b/storaged/include/storaged_utils.h
index b0e5146..83538c2 100644
--- a/storaged/include/storaged_utils.h
+++ b/storaged/include/storaged_utils.h
@@ -37,9 +37,8 @@
 
 // Logging
 void log_console_running_tasks_info(std::vector<struct task_info> tasks);
-void log_kernel_disk_stats(struct disk_stats* stats, const char* type);
-void log_kernel_disk_perf(struct disk_perf* perf, const char* type);
-void log_kernel_emmc_info(struct emmc_info* info);
+
+void log_debug_disk_perf(struct disk_perf* perf, const char* type);
 
 void log_event_disk_stats(struct disk_stats* stats, const char* type);
 void log_event_emmc_info(struct emmc_info* info_);
diff --git a/storaged/storaged.cpp b/storaged/storaged.cpp
index 7b0c3ad..8f7ce62 100644
--- a/storaged/storaged.cpp
+++ b/storaged/storaged.cpp
@@ -28,9 +28,8 @@
 /* disk_stats_publisher */
 void disk_stats_publisher::publish(void) {
     // Logging
-    log_kernel_disk_stats(&mAccumulate, "regular");
     struct disk_perf perf = get_disk_perf(&mAccumulate);
-    log_kernel_disk_perf(&perf, "regular");
+    log_debug_disk_perf(&perf, "regular");
     log_event_disk_stats(&mAccumulate, "regular");
     // Reset global structures
     memset(&mAccumulate, 0, sizeof(struct disk_stats));
@@ -102,16 +101,12 @@
         if (UNLIKELY(detect(&perf))) {
             mStall = true;
             add_disk_stats(&inc, &mAccumulate);
-#ifdef DEBUG
-            log_kernel_disk_perf(&mMean, "stalled_mean");
-            log_kernel_disk_perf(&mStd, "stalled_std");
-#endif
+            log_debug_disk_perf(&mMean, "stalled_mean");
+            log_debug_disk_perf(&mStd, "stalled_std");
         } else {
             if (mStall) {
-                log_kernel_disk_stats(&mAccumulate, "stalled");
                 struct disk_perf acc_perf = get_disk_perf(&mAccumulate);
-                log_kernel_disk_perf(&acc_perf, "stalled");
-
+                log_debug_disk_perf(&acc_perf, "stalled");
                 log_event_disk_stats(&mAccumulate, "stalled");
                 mStall = false;
                 memset(&mAccumulate, 0, sizeof(mAccumulate));
@@ -150,7 +145,6 @@
 /* emmc_info_t */
 void emmc_info_t::publish(void) {
     if (mValid) {
-        log_kernel_emmc_info(&mInfo);
         log_event_emmc_info(&mInfo);
     }
 }
diff --git a/storaged/storaged_utils.cpp b/storaged/storaged_utils.cpp
index e91b1bb..27b9c62 100644
--- a/storaged/storaged_utils.cpp
+++ b/storaged/storaged_utils.cpp
@@ -435,24 +435,8 @@
     fflush(stdout);
 }
 
-void log_kernel_disk_stats(struct disk_stats* stats, const char* type) {
-    // skip if the input structure are all zeros
-    if (stats == NULL) return;
-    struct disk_stats zero_cmp;
-    memset(&zero_cmp, 0, sizeof(zero_cmp));
-    if (memcmp(&zero_cmp, stats, sizeof(struct disk_stats)) == 0) return;
-
-    LOG_TO(SYSTEM, INFO) << "diskstats " << type << ": "
-              << stats->start_time << " " << stats->end_time << " "
-              << stats->read_ios << " " << stats->read_merges << " "
-              << stats->read_sectors << " " << stats->read_ticks << " "
-              << stats->write_ios << " " << stats->write_merges << " "
-              << stats->write_sectors << " " << stats->write_ticks << " "
-              << std::setprecision(1) << std::fixed << stats->io_avg << " "
-              << stats->io_ticks << " " << stats->io_in_queue;
-}
-
-void log_kernel_disk_perf(struct disk_perf* perf, const char* type) {
+#if DEBUG
+void log_debug_disk_perf(struct disk_perf* perf, const char* type) {
     // skip if the input structure are all zeros
     if (perf == NULL) return;
     struct disk_perf zero_cmp;
@@ -464,18 +448,9 @@
               << " wr:" << perf->write_perf << "KB/s(" << perf->write_ios << "/s)"
               << " q:" << perf->queue;
 }
-
-void log_kernel_emmc_info(struct emmc_info* info) {
-    // skip if the input structure are all zeros
-    if (info == NULL) return;
-    struct emmc_info zero_cmp;
-    memset(&zero_cmp, 0, sizeof(zero_cmp));
-    if (memcmp(&zero_cmp, info, sizeof(struct emmc_info)) == 0) return;
-
-    LOG_TO(SYSTEM, INFO) << "MMC " << info->mmc_ver << " eol:" << info->eol << ", "
-              << "lifetime typA:" << info->lifetime_a
-              << ", typB:" << info->lifetime_b;
-}
+#else
+void log_debug_disk_perf(struct disk_perf* /* perf */, const char* /* type */) {}
+#endif
 
 void log_event_disk_stats(struct disk_stats* stats, const char* type) {
     // skip if the input structure are all zeros