All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jay Lan <jlan@engr.sgi.com>
To: lse-tech <lse-tech@lists.sourceforge.net>
Cc: Andrew Morton <akpm@osdl.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Guillaume Thouvenin <guillaume.thouvenin@bull.net>
Subject: [Lse-tech] [PATCH 2.6.9 1/2] enhanced accounting data collection
Date: Thu, 21 Oct 2004 18:32:52 -0700	[thread overview]
Message-ID: <41786344.9070504@engr.sgi.com> (raw)
In-Reply-To: <41785FE3.806@engr.sgi.com>

[-- Attachment #1: Type: text/plain, Size: 96 bytes --]

1/2: acct_io

Enahanced I/O accounting data collection.

Signed-off-by: Jay Lan <jlan@sgi.com>


[-- Attachment #2: acct_io --]
[-- Type: text/plain, Size: 2291 bytes --]

Index: linux/fs/read_write.c
===================================================================
--- linux.orig/fs/read_write.c	2004-09-29 20:05:18.000000000 -0700
+++ linux/fs/read_write.c	2004-10-01 17:09:42.711763439 -0700
@@ -216,8 +216,11 @@
 				ret = file->f_op->read(file, buf, count, pos);
 			else
 				ret = do_sync_read(file, buf, count, pos);
-			if (ret > 0)
+			if (ret > 0) {
 				dnotify_parent(file->f_dentry, DN_ACCESS);
+				current->rchar += ret;
+			}
+			current->syscr++;
 		}
 	}
 
@@ -260,8 +263,11 @@
 				ret = file->f_op->write(file, buf, count, pos);
 			else
 				ret = do_sync_write(file, buf, count, pos);
-			if (ret > 0)
+			if (ret > 0) {
 				dnotify_parent(file->f_dentry, DN_MODIFY);
+				current->wchar += ret;
+			}
+			current->syscw++;
 		}
 	}
 
@@ -540,6 +546,10 @@
 		fput_light(file, fput_needed);
 	}
 
+	if (ret > 0) {
+		current->rchar += ret;
+	}
+	current->syscr++;
 	return ret;
 }
 
@@ -558,6 +568,10 @@
 		fput_light(file, fput_needed);
 	}
 
+	if (ret > 0) {
+		current->wchar += ret;
+	}
+	current->syscw++;
 	return ret;
 }
 
@@ -636,6 +650,13 @@
 
 	retval = in_file->f_op->sendfile(in_file, ppos, count, file_send_actor, out_file);
 
+	if (retval > 0) {
+		current->rchar += retval;
+		current->wchar += retval;
+	}
+	current->syscr++;
+	current->syscw++;
+
 	if (*ppos > max)
 		retval = -EOVERFLOW;
 
Index: linux/include/linux/sched.h
===================================================================
--- linux.orig/include/linux/sched.h	2004-10-01 17:01:21.412848229 -0700
+++ linux/include/linux/sched.h	2004-10-01 17:09:42.723482260 -0700
@@ -591,6 +591,9 @@
 	struct rw_semaphore pagg_sem;
 #endif
 
+/* i/o counters(bytes read/written, #syscalls */
+	unsigned long rchar, wchar, syscr, syscw;
+
 };
 
 static inline pid_t process_group(struct task_struct *tsk)
Index: linux/kernel/fork.c
===================================================================
--- linux.orig/kernel/fork.c	2004-10-01 17:01:21.432379595 -0700
+++ linux/kernel/fork.c	2004-10-01 17:09:42.732271376 -0700
@@ -995,6 +995,7 @@
 	p->real_timer.data = (unsigned long) p;
 
 	p->utime = p->stime = 0;
+	p->rchar = p->wchar = p->syscr = p->syscw = 0;
 	p->lock_depth = -1;		/* -1 = no lock */
 	p->start_time = get_jiffies_64();
 	p->security = NULL;

  reply	other threads:[~2004-10-22  1:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-22  1:18 [PATCH 2.6.9 0/2] enhanced accounting data collection Jay Lan
2004-10-22  1:32 ` Jay Lan [this message]
2004-10-22  2:16   ` [Lse-tech] [PATCH 2.6.9 1/2] " Andrew Morton
2004-11-04 23:48     ` Jay Lan
2004-10-22  1:35 ` [Lse-tech] [PATCH 2.6.9 2/2] " Jay Lan
2004-10-22  2:25   ` Andrew Morton
2004-11-04 23:54     ` Jay Lan
2004-10-22  2:11 ` [PATCH 2.6.9 0/2] " Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41786344.9070504@engr.sgi.com \
    --to=jlan@engr.sgi.com \
    --cc=akpm@osdl.org \
    --cc=guillaume.thouvenin@bull.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lse-tech@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.