From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: kosaki.motohiro@jp.fujitsu.com,
Tatsuhiro Aoshima <tatsu.pc@gmail.com>,
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Subject: [PATCH] proc: let task status file print utime and stime.
Date: Sat, 15 Aug 2009 23:36:41 +0900 (JST) [thread overview]
Message-ID: <20090815233629.A067.A69D9226@jp.fujitsu.com> (raw)
From: Tatsuhiro Aoshima <tatsu.pc@gmail.com>
Subject: [PATCH] proc: let task status file print utime and stime.
The task status file in proc file system did not contain
user-time and system-time. Thus, users could not get
those information of running task easily. I think
these values should be provived in human readable format.
By this patch, users can get stime and utime very easily.
Signed-off-by: Tatsuhiro Aoshima <tatsu.pc@gmail.com>
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
---
fs/proc/array.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 725a650..29afa68 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -162,6 +162,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
struct fdtable *fdt = NULL;
const struct cred *cred;
pid_t ppid, tpid;
+ struct timeval utime, stime;
rcu_read_lock();
ppid = pid_alive(p) ?
@@ -173,6 +174,8 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
tpid = task_pid_nr_ns(tracer, ns);
}
cred = get_cred((struct cred *) __task_cred(p));
+ cputime_to_timeval(task_utime(p), &utime);
+ cputime_to_timeval(task_stime(p), &stime);
seq_printf(m,
"State:\t%s\n"
"Tgid:\t%d\n"
@@ -180,13 +183,17 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
"PPid:\t%d\n"
"TracerPid:\t%d\n"
"Uid:\t%d\t%d\t%d\t%d\n"
- "Gid:\t%d\t%d\t%d\t%d\n",
+ "Gid:\t%d\t%d\t%d\t%d\n"
+ "Utime:\t%lu.%06lu\n"
+ "Stime:\t%lu.%06lu\n",
get_task_state(p),
task_tgid_nr_ns(p, ns),
pid_nr_ns(pid, ns),
ppid, tpid,
cred->uid, cred->euid, cred->suid, cred->fsuid,
- cred->gid, cred->egid, cred->sgid, cred->fsgid);
+ cred->gid, cred->egid, cred->sgid, cred->fsgid,
+ (unsigned long) utime.tv_sec, (unsigned long) utime.tv_usec,
+ (unsigned long) stime.tv_sec, (unsigned long) stime.tv_usec);
task_lock(p);
if (p->files)
--
1.4.4.4
next reply other threads:[~2009-08-15 14:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-15 14:36 KOSAKI Motohiro [this message]
2009-08-17 2:38 ` Amerigo Wang
2009-08-17 2:42 ` KAMEZAWA Hiroyuki
2009-08-17 6:18 ` Amerigo Wang
2009-08-17 6:22 ` KAMEZAWA Hiroyuki
2009-08-17 6:32 ` Amerigo Wang
2009-08-17 6:32 ` KAMEZAWA Hiroyuki
2009-08-17 8:34 ` Amerigo Wang
2009-08-18 16:27 ` KOSAKI Motohiro
2009-08-29 7:20 Tatsuhiro Aoshima
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=20090815233629.A067.A69D9226@jp.fujitsu.com \
--to=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tatsu.pc@gmail.com \
--cc=yoshfuji@linux-ipv6.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®