summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorynwang2016-06-17 16:30:48 -0500
committerJin Qian2016-12-21 13:08:24 -0600
commitaf49d9756f8b0e29be517101c83c696031cd1dd9 (patch)
tree4c2ffe491ccf1a33ec1fcc548d329ca2adb4335d /storaged
parent2131e59cc882e33bbc7b712e0a815cb3ec1df1f5 (diff)
downloadplatform-system-core-af49d9756f8b0e29be517101c83c696031cd1dd9.tar.gz
platform-system-core-af49d9756f8b0e29be517101c83c696031cd1dd9.tar.xz
platform-system-core-af49d9756f8b0e29be517101c83c696031cd1dd9.zip
Storaged cleanup
Compliance with Android Coding standards Test: compile Bug: 28826771 Change-Id: I10bc4a793bb1da75e8600b81a5d7ff913e310da1
Diffstat (limited to 'storaged')
-rw-r--r--storaged/EventLogTags.logtags2
-rw-r--r--storaged/main.cpp3
-rw-r--r--storaged/storaged.cpp11
-rw-r--r--storaged/storaged_utils.cpp16
-rw-r--r--storaged/tests/storaged_test.cpp1
5 files changed, 14 insertions, 19 deletions
diff --git a/storaged/EventLogTags.logtags b/storaged/EventLogTags.logtags
index 2e25d4a29..ee92dd1b2 100644
--- a/storaged/EventLogTags.logtags
+++ b/storaged/EventLogTags.logtags
@@ -36,4 +36,4 @@
36 36
372732 storaged_disk_stats (type|3),(start_time|2|3),(end_time|2|3),(read_ios|2|1),(read_merges|2|1),(read_sectors|2|1),(read_ticks|2|3),(write_ios|2|1),(write_merges|2|1),(write_sectors|2|1),(write_ticks|2|3),(o_in_flight|2|1),(io_ticks|2|3),(io_in_queue|2|1) 372732 storaged_disk_stats (type|3),(start_time|2|3),(end_time|2|3),(read_ios|2|1),(read_merges|2|1),(read_sectors|2|1),(read_ticks|2|3),(write_ios|2|1),(write_merges|2|1),(write_sectors|2|1),(write_ticks|2|3),(o_in_flight|2|1),(io_ticks|2|3),(io_in_queue|2|1)
38 38
392733 storaged_emmc_info (mmc_ver|3),(eol|1),(lifetime_a|1),(lifetime_b|1) \ No newline at end of file 392733 storaged_emmc_info (mmc_ver|3),(eol|1),(lifetime_a|1),(lifetime_b|1)
diff --git a/storaged/main.cpp b/storaged/main.cpp
index bd1166a6c..31ada686a 100644
--- a/storaged/main.cpp
+++ b/storaged/main.cpp
@@ -290,9 +290,8 @@ int main(int argc, char** argv) {
290 sort_running_tasks_info(res); 290 sort_running_tasks_info(res);
291 log_console_running_tasks_info(res); 291 log_console_running_tasks_info(res);
292 292
293
294 return 0; 293 return 0;
295 } 294 }
296 295
297 return 0; 296 return 0;
298} \ No newline at end of file 297}
diff --git a/storaged/storaged.cpp b/storaged/storaged.cpp
index 140220867..7b0c3ad61 100644
--- a/storaged/storaged.cpp
+++ b/storaged/storaged.cpp
@@ -20,7 +20,6 @@
20#include <time.h> 20#include <time.h>
21#include <unistd.h> 21#include <unistd.h>
22 22
23
24#include <android-base/logging.h> 23#include <android-base/logging.h>
25 24
26#include <storaged.h> 25#include <storaged.h>
@@ -42,12 +41,12 @@ void disk_stats_publisher::update(void) {
42 if (parse_disk_stats(DISK_STATS_PATH, &curr)) { 41 if (parse_disk_stats(DISK_STATS_PATH, &curr)) {
43 struct disk_stats inc = get_inc_disk_stats(&mPrevious, &curr); 42 struct disk_stats inc = get_inc_disk_stats(&mPrevious, &curr);
44 add_disk_stats(&inc, &mAccumulate); 43 add_disk_stats(&inc, &mAccumulate);
45 #ifdef DEBUG 44#ifdef DEBUG
46// log_kernel_disk_stats(&mPrevious, "prev stats"); 45// log_kernel_disk_stats(&mPrevious, "prev stats");
47// log_kernel_disk_stats(&curr, "curr stats"); 46// log_kernel_disk_stats(&curr, "curr stats");
48// log_kernel_disk_stats(&inc, "inc stats"); 47// log_kernel_disk_stats(&inc, "inc stats");
49// log_kernel_disk_stats(&mAccumulate, "accumulated stats"); 48// log_kernel_disk_stats(&mAccumulate, "accumulated stats");
50 #endif 49#endif
51 mPrevious = curr; 50 mPrevious = curr;
52 } 51 }
53} 52}
@@ -103,10 +102,10 @@ void disk_stats_monitor::update(struct disk_stats* stats) {
103 if (UNLIKELY(detect(&perf))) { 102 if (UNLIKELY(detect(&perf))) {
104 mStall = true; 103 mStall = true;
105 add_disk_stats(&inc, &mAccumulate); 104 add_disk_stats(&inc, &mAccumulate);
106 #ifdef DEBUG 105#ifdef DEBUG
107 log_kernel_disk_perf(&mMean, "stalled_mean"); 106 log_kernel_disk_perf(&mMean, "stalled_mean");
108 log_kernel_disk_perf(&mStd, "stalled_std"); 107 log_kernel_disk_perf(&mStd, "stalled_std");
109 #endif 108#endif
110 } else { 109 } else {
111 if (mStall) { 110 if (mStall) {
112 log_kernel_disk_stats(&mAccumulate, "stalled"); 111 log_kernel_disk_stats(&mAccumulate, "stalled");
@@ -208,4 +207,4 @@ void storaged_t::event(void) {
208 } 207 }
209 208
210 mTimer += mConfig.periodic_chores_interval_unit; 209 mTimer += mConfig.periodic_chores_interval_unit;
211} \ No newline at end of file 210}
diff --git a/storaged/storaged_utils.cpp b/storaged/storaged_utils.cpp
index 9c0b62595..5e0488822 100644
--- a/storaged/storaged_utils.cpp
+++ b/storaged/storaged_utils.cpp
@@ -16,15 +16,15 @@
16 16
17#define LOG_TAG "storaged" 17#define LOG_TAG "storaged"
18 18
19#include <dirent.h>
19#include <fcntl.h> 20#include <fcntl.h>
20#include <sys/stat.h>
21#include <linux/time.h> 21#include <linux/time.h>
22
23#include <dirent.h>
24#include <stdio.h>
25#include <stdint.h> 22#include <stdint.h>
23#include <stdio.h>
26#include <stdlib.h> 24#include <stdlib.h>
27#include <string.h> 25#include <string.h>
26#include <sys/stat.h>
27#include <time.h>
28#include <unistd.h> 28#include <unistd.h>
29 29
30#include <sstream> 30#include <sstream>
@@ -32,18 +32,16 @@
32#include <unordered_map> 32#include <unordered_map>
33 33
34#include <android-base/file.h> 34#include <android-base/file.h>
35#include <android-base/logging.h>
35#include <android-base/stringprintf.h> 36#include <android-base/stringprintf.h>
36#include <android-base/strings.h> 37#include <android-base/strings.h>
37#include <android-base/logging.h> 38#include <cutils/klog.h>
38#include <log/log.h> 39#include <log/log.h>
39#include <log/log_event_list.h> 40#include <log/log_event_list.h>
40#include <cutils/klog.h>
41 41
42#include <storaged.h> 42#include <storaged.h>
43#include <storaged_utils.h> 43#include <storaged_utils.h>
44 44
45#include <time.h>
46
47#define SECTOR_SIZE ( 512 ) 45#define SECTOR_SIZE ( 512 )
48#define SEC_TO_MSEC ( 1000 ) 46#define SEC_TO_MSEC ( 1000 )
49#define MSEC_TO_USEC ( 1000 ) 47#define MSEC_TO_USEC ( 1000 )
@@ -416,7 +414,7 @@ void tasks_t::update_running_tasks(void) {
416 } 414 }
417 } 415 }
418 } 416 }
419 { // update critical area 417 { // update critical area
420 // this is really fast! 418 // this is really fast!
421 std::unique_ptr<lock_t> lock(new lock_t(&mSem)); 419 std::unique_ptr<lock_t> lock(new lock_t(&mSem));
422 mRunning = tasks_latest; 420 mRunning = tasks_latest;
diff --git a/storaged/tests/storaged_test.cpp b/storaged/tests/storaged_test.cpp
index 4ca9839b6..99b21ac0f 100644
--- a/storaged/tests/storaged_test.cpp
+++ b/storaged/tests/storaged_test.cpp
@@ -23,7 +23,6 @@
23#include <unistd.h> 23#include <unistd.h>
24 24
25#include <gtest/gtest.h> 25#include <gtest/gtest.h>
26//#include <private/android_logger.h>
27 26
28#include <storaged.h> // data structures 27#include <storaged.h> // data structures
29#include <storaged_utils.h> // functions to test 28#include <storaged_utils.h> // functions to test