diff options
Diffstat (limited to 'storaged/include/storaged.h')
-rw-r--r-- | storaged/include/storaged.h | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/storaged/include/storaged.h b/storaged/include/storaged.h index 7fa9958bd..d3e6b7140 100644 --- a/storaged/include/storaged.h +++ b/storaged/include/storaged.h | |||
@@ -40,6 +40,12 @@ friend class test_case_name##_##test_name##_Test | |||
40 | #define debuginfo(...) | 40 | #define debuginfo(...) |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #define SECTOR_SIZE ( 512 ) | ||
44 | #define SEC_TO_MSEC ( 1000 ) | ||
45 | #define MSEC_TO_USEC ( 1000 ) | ||
46 | #define USEC_TO_NSEC ( 1000 ) | ||
47 | #define SEC_TO_USEC ( 1000000 ) | ||
48 | |||
43 | // number of attributes diskstats has | 49 | // number of attributes diskstats has |
44 | #define DISK_STATS_SIZE ( 11 ) | 50 | #define DISK_STATS_SIZE ( 11 ) |
45 | // maximum size limit of a stats file | 51 | // maximum size limit of a stats file |
@@ -266,7 +272,10 @@ public: | |||
266 | #define DEFAULT_PERIODIC_CHORES_INTERVAL_UNIT ( 60 ) | 272 | #define DEFAULT_PERIODIC_CHORES_INTERVAL_UNIT ( 60 ) |
267 | #define DEFAULT_PERIODIC_CHORES_INTERVAL_DISK_STATS_PUBLISH ( 3600 ) | 273 | #define DEFAULT_PERIODIC_CHORES_INTERVAL_DISK_STATS_PUBLISH ( 3600 ) |
268 | #define DEFAULT_PERIODIC_CHORES_INTERVAL_EMMC_INFO_PUBLISH ( 86400 ) | 274 | #define DEFAULT_PERIODIC_CHORES_INTERVAL_EMMC_INFO_PUBLISH ( 86400 ) |
269 | #define DEFAULT_PERIODIC_CHORES_INTERVAL_UID_IO_ALERT ( 3600 ) | 275 | #define DEFAULT_PERIODIC_CHORES_INTERVAL_UID_IO ( 3600 ) |
276 | |||
277 | // UID IO threshold in bytes | ||
278 | #define DEFAULT_PERIODIC_CHORES_UID_IO_THRESHOLD ( 1024 * 1024 * 1024ULL ) | ||
270 | 279 | ||
271 | struct storaged_config { | 280 | struct storaged_config { |
272 | int periodic_chores_interval_unit; | 281 | int periodic_chores_interval_unit; |
@@ -277,6 +286,7 @@ struct storaged_config { | |||
277 | bool proc_uid_io_available; // whether uid_io is accessible | 286 | bool proc_uid_io_available; // whether uid_io is accessible |
278 | bool emmc_available; // whether eMMC est_csd file is readable | 287 | bool emmc_available; // whether eMMC est_csd file is readable |
279 | bool diskstats_available; // whether diskstats is accessible | 288 | bool diskstats_available; // whether diskstats is accessible |
289 | int event_time_check_usec; // check how much cputime spent in event loop | ||
280 | }; | 290 | }; |
281 | 291 | ||
282 | class storaged_t { | 292 | class storaged_t { |
@@ -293,21 +303,10 @@ public: | |||
293 | storaged_t(void); | 303 | storaged_t(void); |
294 | ~storaged_t() {} | 304 | ~storaged_t() {} |
295 | void event(void); | 305 | void event(void); |
306 | void event_checked(void); | ||
296 | void pause(void) { | 307 | void pause(void) { |
297 | sleep(mConfig.periodic_chores_interval_unit); | 308 | sleep(mConfig.periodic_chores_interval_unit); |
298 | } | 309 | } |
299 | void set_unit_interval(int unit) { | ||
300 | mConfig.periodic_chores_interval_unit = unit; | ||
301 | } | ||
302 | void set_diskstats_interval(int disk_stats) { | ||
303 | mConfig.periodic_chores_interval_disk_stats_publish = disk_stats; | ||
304 | } | ||
305 | void set_emmc_interval(int emmc_info) { | ||
306 | mConfig.periodic_chores_interval_emmc_info_publish = emmc_info; | ||
307 | } | ||
308 | void set_uid_io_interval(int uid_io) { | ||
309 | mUidm.set_periodic_chores_interval(uid_io); | ||
310 | } | ||
311 | std::vector<struct task_info> get_tasks(void) { | 310 | std::vector<struct task_info> get_tasks(void) { |
312 | // There could be a race when get_tasks() and the main thread is updating at the same time | 311 | // There could be a race when get_tasks() and the main thread is updating at the same time |
313 | // While update_running_tasks() is updating the critical sections at the end of the function | 312 | // While update_running_tasks() is updating the critical sections at the end of the function |