summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJin Qian2017-01-17 13:51:51 -0600
committerJin Qian2017-01-17 17:43:25 -0600
commit27506fa41f7b07714b49eb3d36760a2f8c0708d0 (patch)
tree3303c865d4f9f538977479fc338abfc1c250f1a4 /storaged
parent0c77270ffc35ab0f074d7e21e5ca54eac97bb57a (diff)
downloadplatform-system-core-27506fa41f7b07714b49eb3d36760a2f8c0708d0.tar.gz
platform-system-core-27506fa41f7b07714b49eb3d36760a2f8c0708d0.tar.xz
platform-system-core-27506fa41f7b07714b49eb3d36760a2f8c0708d0.zip
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
Diffstat (limited to 'storaged')
-rw-r--r--storaged/include/storaged_utils.h5
-rw-r--r--storaged/storaged.cpp14
-rw-r--r--storaged/storaged_utils.cpp35
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);
37 37
38// Logging 38// Logging
39void log_console_running_tasks_info(std::vector<struct task_info> tasks); 39void log_console_running_tasks_info(std::vector<struct task_info> tasks);
40void log_kernel_disk_stats(struct disk_stats* stats, const char* type); 40
41void log_kernel_disk_perf(struct disk_perf* perf, const char* type); 41void log_debug_disk_perf(struct disk_perf* perf, const char* type);
42void log_kernel_emmc_info(struct emmc_info* info);
43 42
44void log_event_disk_stats(struct disk_stats* stats, const char* type); 43void log_event_disk_stats(struct disk_stats* stats, const char* type);
45void log_event_emmc_info(struct emmc_info* info_); 44void 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 @@
28/* disk_stats_publisher */ 28/* disk_stats_publisher */
29void disk_stats_publisher::publish(void) { 29void disk_stats_publisher::publish(void) {
30 // Logging 30 // Logging
31 log_kernel_disk_stats(&mAccumulate, "regular");
32 struct disk_perf perf = get_disk_perf(&mAccumulate); 31 struct disk_perf perf = get_disk_perf(&mAccumulate);
33 log_kernel_disk_perf(&perf, "regular"); 32 log_debug_disk_perf(&perf, "regular");
34 log_event_disk_stats(&mAccumulate, "regular"); 33 log_event_disk_stats(&mAccumulate, "regular");
35 // Reset global structures 34 // Reset global structures
36 memset(&mAccumulate, 0, sizeof(struct disk_stats)); 35 memset(&mAccumulate, 0, sizeof(struct disk_stats));
@@ -102,16 +101,12 @@ void disk_stats_monitor::update(struct disk_stats* stats) {
102 if (UNLIKELY(detect(&perf))) { 101 if (UNLIKELY(detect(&perf))) {
103 mStall = true; 102 mStall = true;
104 add_disk_stats(&inc, &mAccumulate); 103 add_disk_stats(&inc, &mAccumulate);
105#ifdef DEBUG 104 log_debug_disk_perf(&mMean, "stalled_mean");
106 log_kernel_disk_perf(&mMean, "stalled_mean"); 105 log_debug_disk_perf(&mStd, "stalled_std");
107 log_kernel_disk_perf(&mStd, "stalled_std");
108#endif
109 } else { 106 } else {
110 if (mStall) { 107 if (mStall) {
111 log_kernel_disk_stats(&mAccumulate, "stalled");
112 struct disk_perf acc_perf = get_disk_perf(&mAccumulate); 108 struct disk_perf acc_perf = get_disk_perf(&mAccumulate);
113 log_kernel_disk_perf(&acc_perf, "stalled"); 109 log_debug_disk_perf(&acc_perf, "stalled");
114
115 log_event_disk_stats(&mAccumulate, "stalled"); 110 log_event_disk_stats(&mAccumulate, "stalled");
116 mStall = false; 111 mStall = false;
117 memset(&mAccumulate, 0, sizeof(mAccumulate)); 112 memset(&mAccumulate, 0, sizeof(mAccumulate));
@@ -150,7 +145,6 @@ void disk_stats_monitor::update(void) {
150/* emmc_info_t */ 145/* emmc_info_t */
151void emmc_info_t::publish(void) { 146void emmc_info_t::publish(void) {
152 if (mValid) { 147 if (mValid) {
153 log_kernel_emmc_info(&mInfo);
154 log_event_emmc_info(&mInfo); 148 log_event_emmc_info(&mInfo);
155 } 149 }
156} 150}
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) {
435 fflush(stdout); 435 fflush(stdout);
436} 436}
437 437
438void log_kernel_disk_stats(struct disk_stats* stats, const char* type) { 438#if DEBUG
439 // skip if the input structure are all zeros 439void log_debug_disk_perf(struct disk_perf* perf, const char* type) {
440 if (stats == NULL) return;
441 struct disk_stats zero_cmp;
442 memset(&zero_cmp, 0, sizeof(zero_cmp));
443 if (memcmp(&zero_cmp, stats, sizeof(struct disk_stats)) == 0) return;
444
445 LOG_TO(SYSTEM, INFO) << "diskstats " << type << ": "
446 << stats->start_time << " " << stats->end_time << " "
447 << stats->read_ios << " " << stats->read_merges << " "
448 << stats->read_sectors << " " << stats->read_ticks << " "
449 << stats->write_ios << " " << stats->write_merges << " "
450 << stats->write_sectors << " " << stats->write_ticks << " "
451 << std::setprecision(1) << std::fixed << stats->io_avg << " "
452 << stats->io_ticks << " " << stats->io_in_queue;
453}
454
455void log_kernel_disk_perf(struct disk_perf* perf, const char* type) {
456 // skip if the input structure are all zeros 440 // skip if the input structure are all zeros
457 if (perf == NULL) return; 441 if (perf == NULL) return;
458 struct disk_perf zero_cmp; 442 struct disk_perf zero_cmp;
@@ -464,18 +448,9 @@ void log_kernel_disk_perf(struct disk_perf* perf, const char* type) {
464 << " wr:" << perf->write_perf << "KB/s(" << perf->write_ios << "/s)" 448 << " wr:" << perf->write_perf << "KB/s(" << perf->write_ios << "/s)"
465 << " q:" << perf->queue; 449 << " q:" << perf->queue;
466} 450}
467 451#else
468void log_kernel_emmc_info(struct emmc_info* info) { 452void log_debug_disk_perf(struct disk_perf* /* perf */, const char* /* type */) {}
469 // skip if the input structure are all zeros 453#endif
470 if (info == NULL) return;
471 struct emmc_info zero_cmp;
472 memset(&zero_cmp, 0, sizeof(zero_cmp));
473 if (memcmp(&zero_cmp, info, sizeof(struct emmc_info)) == 0) return;
474
475 LOG_TO(SYSTEM, INFO) << "MMC " << info->mmc_ver << " eol:" << info->eol << ", "
476 << "lifetime typA:" << info->lifetime_a
477 << ", typB:" << info->lifetime_b;
478}
479 454
480void log_event_disk_stats(struct disk_stats* stats, const char* type) { 455void log_event_disk_stats(struct disk_stats* stats, const char* type) {
481 // skip if the input structure are all zeros 456 // skip if the input structure are all zeros