Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f4eeb5d6 authored by Jin Qian's avatar Jin Qian Committed by Alistair Strachan
Browse files

ANDROID: uid_cputime: add per-uid IO usage accounting



IO usages are accounted in foreground and background buckets.
For each uid, io usage is calculated in two steps.

delta = current total of all uid tasks - previus total
current bucket += delta

Bucket is determined by current uid stat. Userspace writes to
/proc/uid_procstat/set <uid> <stat> when uid stat is updated.

/proc/uid_io/stats shows IO usage in this format.
<uid> <foreground IO> <background IO>

Bug: 34198239
Bug: 120442023
Change-Id: Ib8bebda53e7a56f45ea3eb0ec9a3153d44188102
Signed-off-by: default avatarJin Qian <jinqian@google.com>
[connoro: Used by storaged.]
[astrachan: Note: this version does not track fsync syscalls; this is
            implemented in a follow up due to the fact it depends on
            modifications to the task_xacct feature.]
[astrachan: Folded in the following changes:
            e003a91d8f42 ("ANDROID: uid_sys_stats: allow writing same state")
            89b984bf2efd ("ANDROID: uid_sys_stats: fix negative write bytes.")
            bb5ee21cc4dd ("ANDROID: uid_sys_stats: change to use rt_mutex")
            9297d5a160c7 ("ANDROID: uid_sys_stats: reduce update_io_stats overhead")
            89402d07fe91 ("ANDROID: uid_sys_stats: defer io stats calulation for dead tasks")
            6dc5d8173a8c ("ANDROID: uid_sys_stats: check previous uid_entry before call find_or_register_uid")
            0ca2ece8f7ec ("ANDROID: uid_sys_stats: log task io with a debug flag")
            c9c096ef0e67 ("ANDROID: uid_sys_stats: Copy task_struct comm field to bigger buffer")]
Signed-off-by: default avatarAlistair Strachan <astrachan@google.com>
parent ad237bb3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment