ANDROID: uid_sys_stats: account for fsync syscalls
Change-Id: Ie888d8a0f4ec7a27dea86dc4afba8e6fd4203488 Signed-off-by: Jin Qian <jinqian@google.com>
This commit is contained in:
parent
0d1e81ffe0
commit
16d838d2c9
1 changed files with 9 additions and 2 deletions
|
@ -39,6 +39,7 @@ struct io_stats {
|
|||
u64 write_bytes;
|
||||
u64 rchar;
|
||||
u64 wchar;
|
||||
u64 fsync;
|
||||
};
|
||||
|
||||
#define UID_STATE_FOREGROUND 0
|
||||
|
@ -217,6 +218,7 @@ static void add_uid_io_curr_stats(struct uid_entry *uid_entry,
|
|||
io_curr->write_bytes += compute_write_bytes(task);
|
||||
io_curr->rchar += task->ioac.rchar;
|
||||
io_curr->wchar += task->ioac.wchar;
|
||||
io_curr->fsync += task->ioac.syscfs;
|
||||
}
|
||||
|
||||
static void clean_uid_io_last_stats(struct uid_entry *uid_entry,
|
||||
|
@ -228,6 +230,7 @@ static void clean_uid_io_last_stats(struct uid_entry *uid_entry,
|
|||
io_last->write_bytes -= compute_write_bytes(task);
|
||||
io_last->rchar -= task->ioac.rchar;
|
||||
io_last->wchar -= task->ioac.wchar;
|
||||
io_last->fsync -= task->ioac.syscfs;
|
||||
}
|
||||
|
||||
static void update_io_stats_locked(void)
|
||||
|
@ -264,11 +267,13 @@ static void update_io_stats_locked(void)
|
|||
io_curr->write_bytes - io_last->write_bytes;
|
||||
io_bucket->rchar += io_curr->rchar - io_last->rchar;
|
||||
io_bucket->wchar += io_curr->wchar - io_last->wchar;
|
||||
io_bucket->fsync += io_curr->fsync - io_last->fsync;
|
||||
|
||||
io_last->read_bytes = io_curr->read_bytes;
|
||||
io_last->write_bytes = io_curr->write_bytes;
|
||||
io_last->rchar = io_curr->rchar;
|
||||
io_last->wchar = io_curr->wchar;
|
||||
io_last->fsync = io_curr->fsync;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,7 +287,7 @@ static int uid_io_show(struct seq_file *m, void *v)
|
|||
update_io_stats_locked();
|
||||
|
||||
hash_for_each(hash_table, bkt, uid_entry, hash) {
|
||||
seq_printf(m, "%d %llu %llu %llu %llu %llu %llu %llu %llu\n",
|
||||
seq_printf(m, "%d %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
|
||||
uid_entry->uid,
|
||||
uid_entry->io[UID_STATE_FOREGROUND].rchar,
|
||||
uid_entry->io[UID_STATE_FOREGROUND].wchar,
|
||||
|
@ -291,7 +296,9 @@ static int uid_io_show(struct seq_file *m, void *v)
|
|||
uid_entry->io[UID_STATE_BACKGROUND].rchar,
|
||||
uid_entry->io[UID_STATE_BACKGROUND].wchar,
|
||||
uid_entry->io[UID_STATE_BACKGROUND].read_bytes,
|
||||
uid_entry->io[UID_STATE_BACKGROUND].write_bytes);
|
||||
uid_entry->io[UID_STATE_BACKGROUND].write_bytes,
|
||||
uid_entry->io[UID_STATE_FOREGROUND].fsync,
|
||||
uid_entry->io[UID_STATE_BACKGROUND].fsync);
|
||||
}
|
||||
|
||||
mutex_unlock(&uid_lock);
|
||||
|
|
Loading…
Reference in a new issue