diff options
Diffstat (limited to 'storaged')
-rw-r--r-- | storaged/include/storaged_utils.h | 5 | ||||
-rw-r--r-- | storaged/storaged.cpp | 14 | ||||
-rw-r--r-- | storaged/storaged_utils.cpp | 35 |
3 files changed, 11 insertions, 43 deletions
diff --git a/storaged/include/storaged_utils.h b/storaged/include/storaged_utils.h index b0e514605..83538c215 100644 --- a/storaged/include/storaged_utils.h +++ b/storaged/include/storaged_utils.h @@ -37,9 +37,8 @@ void sort_running_tasks_info(std::vector<struct task_info> &tasks); // 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 7b0c3ad61..8f7ce62c8 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 @@ void disk_stats_monitor::update(struct disk_stats* stats) { 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 @@ void disk_stats_monitor::update(void) { /* 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 e91b1bb1d..27b9c6290 100644 --- a/storaged/storaged_utils.cpp +++ b/storaged/storaged_utils.cpp @@ -435,24 +435,8 @@ void log_console_running_tasks_info(std::vector<struct task_info> tasks) { 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 @@ void log_kernel_disk_perf(struct disk_perf* perf, const char* type) { << " 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 |