ANDROID: sched: add a counter to track fsync

Change-Id: I6c138de5b2332eea70f57e098134d1d141247b3f
Signed-off-by: Jin Qian <jinqian@google.com>
This commit is contained in:
Jin Qian 2017-03-02 13:32:59 -08:00
parent 5c866b0f8a
commit a4f5f251e9
4 changed files with 12 additions and 0 deletions

View file

@ -218,6 +218,7 @@ static int do_fsync(unsigned int fd, int datasync)
if (f.file) { if (f.file) {
ret = vfs_fsync(f.file, datasync); ret = vfs_fsync(f.file, datasync);
fdput(f); fdput(f);
inc_syscfs(current);
} }
return ret; return ret;
} }

View file

@ -3227,6 +3227,11 @@ static inline void inc_syscw(struct task_struct *tsk)
{ {
tsk->ioac.syscw++; tsk->ioac.syscw++;
} }
static inline void inc_syscfs(struct task_struct *tsk)
{
tsk->ioac.syscfs++;
}
#else #else
static inline void add_rchar(struct task_struct *tsk, ssize_t amt) static inline void add_rchar(struct task_struct *tsk, ssize_t amt)
{ {
@ -3243,6 +3248,9 @@ static inline void inc_syscr(struct task_struct *tsk)
static inline void inc_syscw(struct task_struct *tsk) static inline void inc_syscw(struct task_struct *tsk)
{ {
} }
static inline void inc_syscfs(struct task_struct *tsk)
{
}
#endif #endif
#ifndef TASK_SIZE_OF #ifndef TASK_SIZE_OF

View file

@ -18,6 +18,8 @@ struct task_io_accounting {
u64 syscr; u64 syscr;
/* # of write syscalls */ /* # of write syscalls */
u64 syscw; u64 syscw;
/* # of fsync syscalls */
u64 syscfs;
#endif /* CONFIG_TASK_XACCT */ #endif /* CONFIG_TASK_XACCT */
#ifdef CONFIG_TASK_IO_ACCOUNTING #ifdef CONFIG_TASK_IO_ACCOUNTING

View file

@ -96,6 +96,7 @@ static inline void task_chr_io_accounting_add(struct task_io_accounting *dst,
dst->wchar += src->wchar; dst->wchar += src->wchar;
dst->syscr += src->syscr; dst->syscr += src->syscr;
dst->syscw += src->syscw; dst->syscw += src->syscw;
dst->syscfs += src->syscfs;
} }
#else #else
static inline void task_chr_io_accounting_add(struct task_io_accounting *dst, static inline void task_chr_io_accounting_add(struct task_io_accounting *dst,