[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1422657720-20473-1-git-send-email-fabf@skynet.be>
Date: Fri, 30 Jan 2015 23:42:00 +0100
From: Fabian Frederick <fabf@...net.be>
To: linux-kernel@...r.kernel.org
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Fabian Frederick <fabf@...net.be>,
Jonathan Corbet <corbet@....net>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
linux-doc@...r.kernel.org
Subject: [PATCH 1/1 linux-next] task IO accounting: add conditional read/write counters
This patch adds syscre and syscwe respectively effective read/write
syscall counters. We already had syscr/syscw which were
unconditionally incremented. Doing the difference between those
variables could give interesting statistics.
Signed-off-by: Fabian Frederick <fabf@...net.be>
---
Documentation/filesystems/proc.txt | 16 ++++++++++++++++
fs/proc/base.c | 4 ++++
include/linux/sched.h | 2 ++
include/linux/task_io_accounting.h | 4 ++++
4 files changed, 26 insertions(+)
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index a07ba61..87f32d8 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -1536,6 +1536,22 @@ I/O counter: write syscalls
Attempt to count the number of write I/O operations, i.e. syscalls like
write() and pwrite().
+syscre
+------
+
+I/O counter: Effective read syscalls
+Attempt to count the number of effective read I/O operations,
+i.e. syscalls like read() and pread().
+
+
+syscwe
+------
+
+I/O counter: Effective write syscalls
+Attempt to count the number of effective write I/O operations,
+i.e. syscalls like read() and pread().
+
+
read_bytes
----------
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 3f3d7ae..fad6a3f 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2357,6 +2357,8 @@ static int do_io_accounting(struct task_struct *task, struct seq_file *m, int wh
"wchar: %llu\n"
"syscr: %llu\n"
"syscw: %llu\n"
+ "syscre: %llu\n"
+ "syscwe: %llu\n"
"read_bytes: %llu\n"
"write_bytes: %llu\n"
"cancelled_write_bytes: %llu\n",
@@ -2364,6 +2366,8 @@ static int do_io_accounting(struct task_struct *task, struct seq_file *m, int wh
(unsigned long long)acct.wchar,
(unsigned long long)acct.syscr,
(unsigned long long)acct.syscw,
+ (unsigned long long)acct.syscre,
+ (unsigned long long)acct.syscwe,
(unsigned long long)acct.read_bytes,
(unsigned long long)acct.write_bytes,
(unsigned long long)acct.cancelled_write_bytes);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 22ee0d5..27519ae 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -3012,11 +3012,13 @@ extern int task_can_switch_user(struct user_struct *up,
#ifdef CONFIG_TASK_XACCT
static inline void add_rchar(struct task_struct *tsk, ssize_t amt)
{
+ tsk->ioac.syscre++;
tsk->ioac.rchar += amt;
}
static inline void add_wchar(struct task_struct *tsk, ssize_t amt)
{
+ tsk->ioac.syscwe++;
tsk->ioac.wchar += amt;
}
diff --git a/include/linux/task_io_accounting.h b/include/linux/task_io_accounting.h
index bdf855c..bc94291 100644
--- a/include/linux/task_io_accounting.h
+++ b/include/linux/task_io_accounting.h
@@ -18,6 +18,10 @@ struct task_io_accounting {
u64 syscr;
/* # of write syscalls */
u64 syscw;
+ /* # of effective read syscalls */
+ u64 syscre;
+ /* # of effective write syscalls */
+ u64 syscwe;
#endif /* CONFIG_TASK_XACCT */
#ifdef CONFIG_TASK_IO_ACCOUNTING
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists