Skip to contentSkip to conversation

io-accounting: via taskstats

PATCH In review [email protected] 1 participant 1 message Dec 8, 2006 Taskstats statistics interface

lore
Share & tools
lore
#0 lore raw

PATCH 11/13 io-accounting: via taskstats

From: Andrew Morton <[email protected]>

Deliver IO accounting via taskstats.

Cc Jay Lan <[email protected]>
Cc Shailabh Nagar <[email protected]>
Cc Balbir Singh <[email protected]>
Cc Chris Sturtivant <[email protected]>
Cc Tony Ernst <[email protected]>
Cc Guillaume Thouvenin <[email protected]>
Cc David Wright <[email protected]>

---

 include/linux/taskstats.h |    8 +++++++-
 kernel/tsacct.c           |    9 +++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
include/linux/taskstats.h renamed from include/linux/taskstats.h~io-accounting-via-taskstats +7 -1
diff -puN include/linux/taskstats.h~io-accounting-via-taskstats include/linux/taskstats.h
@@ -31,7 +31,7 @@
  */
 
 
-#define TASKSTATS_VERSION	2
+#define TASKSTATS_VERSION	3
 #define TS_COMM_LEN		32	/* should be >= TASK_COMM_LEN
 					 * in linux/sched.h */
 
@@ -140,6 +140,12 @@ struct taskstats {
 	__u64	read_syscalls;		/* read syscalls */
 	__u64	write_syscalls;		/* write syscalls */
 	/* Extended accounting fields end */
+
+#define TASKSTATS_HAS_IO_ACCOUNTING
+	/* Per-task storage I/O accounting starts */
+	__u64	read_bytes;		/* bytes of read I/O */
+	__u64	write_bytes;		/* bytes of write I/O */
+	__u64	cancelled_write_bytes;	/* bytes of cancelled write I/O */
 };
 
 
kernel/tsacct.c renamed from kernel/tsacct.c~io-accounting-via-taskstats +9 -0
diff -puN kernel/tsacct.c~io-accounting-via-taskstats kernel/tsacct.c
@@ -96,6 +96,15 @@ void xacct_add_tsk(struct taskstats *sta
 	stats->write_char	= p->wchar;
 	stats->read_syscalls	= p->syscr;
 	stats->write_syscalls	= p->syscw;
+#ifdef CONFIG_TASK_IO_ACCOUNTING
+	stats->read_bytes	= p->ioac.read_bytes;
+	stats->write_bytes	= p->ioac.write_bytes;
+	stats->cancelled_write_bytes = p->ioac.cancelled_write_bytes;
+#else
+	stats->read_bytes	= 0;
+	stats->write_bytes	= 0;
+	stats->cancelled_write_bytes = 0;
+#endif
 }
 #undef KB
 #undef MB

_