From: Laurent Vivier <Laurent.Vivier@bull.net>
To: Ingo Molnar <mingo@elte.hu>
Cc: kvm-devel <kvm-devel@lists.sourceforge.net>,
linux-kernel <linux-kernel@vger.kernel.org>,
virtualization <virtualization@lists.linux-foundation.org>
Subject: [PATCH 1/4] Introduce a new field "guest" in cpustat
Date: Mon, 20 Aug 2007 15:13:40 +0200 [thread overview]
Message-ID: <46C99384.8020904@bull.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 386 bytes --]
[PATCH 1/4] as recent CPUs introduce a third running state, after "user" and
"system", we need a new field, "guest", in cpustat to store the time used by
the CPU to run virtual CPU. Modify /proc/stat to display this new field.
Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
--
------------- Laurent.Vivier@bull.net --------------
"Software is hard" - Donald Knuth
[-- Attachment #2: proc_stat_guest --]
[-- Type: text/plain, Size: 4608 bytes --]
Index: kvm/fs/proc/proc_misc.c
===================================================================
--- kvm.orig/fs/proc/proc_misc.c 2007-08-20 14:17:13.000000000 +0200
+++ kvm/fs/proc/proc_misc.c 2007-08-20 14:17:16.000000000 +0200
@@ -443,6 +443,9 @@ static int show_stat(struct seq_file *p,
int i;
unsigned long jif;
cputime64_t user, nice, system, idle, iowait, irq, softirq, steal;
+#ifdef CONFIG_GUEST_ACCOUNTING
+ cputime64_t guest;
+#endif
u64 sum = 0;
struct timespec boottime;
unsigned int *per_irq_sum;
@@ -453,6 +456,9 @@ static int show_stat(struct seq_file *p,
user = nice = system = idle = iowait =
irq = softirq = steal = cputime64_zero;
+#ifdef CONFIG_GUEST_ACCOUNTING
+ guest = cputime64_zero;
+#endif
getboottime(&boottime);
jif = boottime.tv_sec;
@@ -467,6 +473,9 @@ static int show_stat(struct seq_file *p,
irq = cputime64_add(irq, kstat_cpu(i).cpustat.irq);
softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq);
steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal);
+#ifdef CONFIG_GUEST_ACCOUNTING
+ guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest);
+#endif
for (j = 0; j < NR_IRQS; j++) {
unsigned int temp = kstat_cpu(i).irqs[j];
sum += temp;
@@ -474,6 +483,18 @@ static int show_stat(struct seq_file *p,
}
}
+#ifdef CONFIG_GUEST_ACCOUNTING
+ seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
+ (unsigned long long)cputime64_to_clock_t(user),
+ (unsigned long long)cputime64_to_clock_t(nice),
+ (unsigned long long)cputime64_to_clock_t(system),
+ (unsigned long long)cputime64_to_clock_t(idle),
+ (unsigned long long)cputime64_to_clock_t(iowait),
+ (unsigned long long)cputime64_to_clock_t(irq),
+ (unsigned long long)cputime64_to_clock_t(softirq),
+ (unsigned long long)cputime64_to_clock_t(steal),
+ (unsigned long long)cputime64_to_clock_t(guest));
+#else
seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu\n",
(unsigned long long)cputime64_to_clock_t(user),
(unsigned long long)cputime64_to_clock_t(nice),
@@ -483,6 +504,7 @@ static int show_stat(struct seq_file *p,
(unsigned long long)cputime64_to_clock_t(irq),
(unsigned long long)cputime64_to_clock_t(softirq),
(unsigned long long)cputime64_to_clock_t(steal));
+#endif
for_each_online_cpu(i) {
/* Copy values here to work around gcc-2.95.3, gcc-2.96 */
@@ -494,6 +516,21 @@ static int show_stat(struct seq_file *p,
irq = kstat_cpu(i).cpustat.irq;
softirq = kstat_cpu(i).cpustat.softirq;
steal = kstat_cpu(i).cpustat.steal;
+#ifdef CONFIG_GUEST_ACCOUNTING
+ guest = kstat_cpu(i).cpustat.guest;
+ seq_printf(p,
+ "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
+ i,
+ (unsigned long long)cputime64_to_clock_t(user),
+ (unsigned long long)cputime64_to_clock_t(nice),
+ (unsigned long long)cputime64_to_clock_t(system),
+ (unsigned long long)cputime64_to_clock_t(idle),
+ (unsigned long long)cputime64_to_clock_t(iowait),
+ (unsigned long long)cputime64_to_clock_t(irq),
+ (unsigned long long)cputime64_to_clock_t(softirq),
+ (unsigned long long)cputime64_to_clock_t(steal),
+ (unsigned long long)cputime64_to_clock_t(guest));
+#else
seq_printf(p, "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu\n",
i,
(unsigned long long)cputime64_to_clock_t(user),
@@ -504,6 +541,7 @@ static int show_stat(struct seq_file *p,
(unsigned long long)cputime64_to_clock_t(irq),
(unsigned long long)cputime64_to_clock_t(softirq),
(unsigned long long)cputime64_to_clock_t(steal));
+#endif
}
seq_printf(p, "intr %llu", (unsigned long long)sum);
Index: kvm/include/linux/kernel_stat.h
===================================================================
--- kvm.orig/include/linux/kernel_stat.h 2007-08-20 14:17:13.000000000 +0200
+++ kvm/include/linux/kernel_stat.h 2007-08-20 14:17:16.000000000 +0200
@@ -23,6 +23,9 @@ struct cpu_usage_stat {
cputime64_t idle;
cputime64_t iowait;
cputime64_t steal;
+#ifdef CONFIG_GUEST_ACCOUNTING
+ cputime64_t guest;
+#endif
};
struct kernel_stat {
Index: kvm/init/Kconfig
===================================================================
--- kvm.orig/init/Kconfig 2007-08-20 14:17:13.000000000 +0200
+++ kvm/init/Kconfig 2007-08-20 14:17:35.000000000 +0200
@@ -167,6 +167,10 @@ config BSD_PROCESS_ACCT_V3
for processing it. A preliminary version of these tools is available
at <http://www.physik3.uni-rostock.de/tim/kernel/utils/acct/>.
+config GUEST_ACCOUNTING
+ bool
+ default n
+
config TASKSTATS
bool "Export task/process statistics through netlink (EXPERIMENTAL)"
depends on NET
WARNING: multiple messages have this Message-ID (diff)
From: Laurent Vivier <Laurent.Vivier-6ktuUTfB/bM@public.gmane.org>
To: Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org>
Cc: kvm-devel
<kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
linux-kernel
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
virtualization
<virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
Subject: [PATCH 1/4] Introduce a new field "guest" in cpustat
Date: Mon, 20 Aug 2007 15:13:40 +0200 [thread overview]
Message-ID: <46C99384.8020904@bull.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 426 bytes --]
[PATCH 1/4] as recent CPUs introduce a third running state, after "user" and
"system", we need a new field, "guest", in cpustat to store the time used by
the CPU to run virtual CPU. Modify /proc/stat to display this new field.
Signed-off-by: Laurent Vivier <Laurent.Vivier-6ktuUTfB/bM@public.gmane.org>
--
------------- Laurent.Vivier-6ktuUTfB/bM@public.gmane.org --------------
"Software is hard" - Donald Knuth
[-- Attachment #2: proc_stat_guest --]
[-- Type: text/plain, Size: 4608 bytes --]
Index: kvm/fs/proc/proc_misc.c
===================================================================
--- kvm.orig/fs/proc/proc_misc.c 2007-08-20 14:17:13.000000000 +0200
+++ kvm/fs/proc/proc_misc.c 2007-08-20 14:17:16.000000000 +0200
@@ -443,6 +443,9 @@ static int show_stat(struct seq_file *p,
int i;
unsigned long jif;
cputime64_t user, nice, system, idle, iowait, irq, softirq, steal;
+#ifdef CONFIG_GUEST_ACCOUNTING
+ cputime64_t guest;
+#endif
u64 sum = 0;
struct timespec boottime;
unsigned int *per_irq_sum;
@@ -453,6 +456,9 @@ static int show_stat(struct seq_file *p,
user = nice = system = idle = iowait =
irq = softirq = steal = cputime64_zero;
+#ifdef CONFIG_GUEST_ACCOUNTING
+ guest = cputime64_zero;
+#endif
getboottime(&boottime);
jif = boottime.tv_sec;
@@ -467,6 +473,9 @@ static int show_stat(struct seq_file *p,
irq = cputime64_add(irq, kstat_cpu(i).cpustat.irq);
softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq);
steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal);
+#ifdef CONFIG_GUEST_ACCOUNTING
+ guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest);
+#endif
for (j = 0; j < NR_IRQS; j++) {
unsigned int temp = kstat_cpu(i).irqs[j];
sum += temp;
@@ -474,6 +483,18 @@ static int show_stat(struct seq_file *p,
}
}
+#ifdef CONFIG_GUEST_ACCOUNTING
+ seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
+ (unsigned long long)cputime64_to_clock_t(user),
+ (unsigned long long)cputime64_to_clock_t(nice),
+ (unsigned long long)cputime64_to_clock_t(system),
+ (unsigned long long)cputime64_to_clock_t(idle),
+ (unsigned long long)cputime64_to_clock_t(iowait),
+ (unsigned long long)cputime64_to_clock_t(irq),
+ (unsigned long long)cputime64_to_clock_t(softirq),
+ (unsigned long long)cputime64_to_clock_t(steal),
+ (unsigned long long)cputime64_to_clock_t(guest));
+#else
seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu\n",
(unsigned long long)cputime64_to_clock_t(user),
(unsigned long long)cputime64_to_clock_t(nice),
@@ -483,6 +504,7 @@ static int show_stat(struct seq_file *p,
(unsigned long long)cputime64_to_clock_t(irq),
(unsigned long long)cputime64_to_clock_t(softirq),
(unsigned long long)cputime64_to_clock_t(steal));
+#endif
for_each_online_cpu(i) {
/* Copy values here to work around gcc-2.95.3, gcc-2.96 */
@@ -494,6 +516,21 @@ static int show_stat(struct seq_file *p,
irq = kstat_cpu(i).cpustat.irq;
softirq = kstat_cpu(i).cpustat.softirq;
steal = kstat_cpu(i).cpustat.steal;
+#ifdef CONFIG_GUEST_ACCOUNTING
+ guest = kstat_cpu(i).cpustat.guest;
+ seq_printf(p,
+ "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
+ i,
+ (unsigned long long)cputime64_to_clock_t(user),
+ (unsigned long long)cputime64_to_clock_t(nice),
+ (unsigned long long)cputime64_to_clock_t(system),
+ (unsigned long long)cputime64_to_clock_t(idle),
+ (unsigned long long)cputime64_to_clock_t(iowait),
+ (unsigned long long)cputime64_to_clock_t(irq),
+ (unsigned long long)cputime64_to_clock_t(softirq),
+ (unsigned long long)cputime64_to_clock_t(steal),
+ (unsigned long long)cputime64_to_clock_t(guest));
+#else
seq_printf(p, "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu\n",
i,
(unsigned long long)cputime64_to_clock_t(user),
@@ -504,6 +541,7 @@ static int show_stat(struct seq_file *p,
(unsigned long long)cputime64_to_clock_t(irq),
(unsigned long long)cputime64_to_clock_t(softirq),
(unsigned long long)cputime64_to_clock_t(steal));
+#endif
}
seq_printf(p, "intr %llu", (unsigned long long)sum);
Index: kvm/include/linux/kernel_stat.h
===================================================================
--- kvm.orig/include/linux/kernel_stat.h 2007-08-20 14:17:13.000000000 +0200
+++ kvm/include/linux/kernel_stat.h 2007-08-20 14:17:16.000000000 +0200
@@ -23,6 +23,9 @@ struct cpu_usage_stat {
cputime64_t idle;
cputime64_t iowait;
cputime64_t steal;
+#ifdef CONFIG_GUEST_ACCOUNTING
+ cputime64_t guest;
+#endif
};
struct kernel_stat {
Index: kvm/init/Kconfig
===================================================================
--- kvm.orig/init/Kconfig 2007-08-20 14:17:13.000000000 +0200
+++ kvm/init/Kconfig 2007-08-20 14:17:35.000000000 +0200
@@ -167,6 +167,10 @@ config BSD_PROCESS_ACCT_V3
for processing it. A preliminary version of these tools is available
at <http://www.physik3.uni-rostock.de/tim/kernel/utils/acct/>.
+config GUEST_ACCOUNTING
+ bool
+ default n
+
config TASKSTATS
bool "Export task/process statistics through netlink (EXPERIMENTAL)"
depends on NET
[-- Attachment #3: Type: text/plain, Size: 315 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
[-- Attachment #4: Type: text/plain, Size: 186 bytes --]
_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel
next reply other threads:[~2007-08-20 13:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-20 13:13 Laurent Vivier [this message]
2007-08-20 13:13 ` [PATCH 1/4] Introduce a new field "guest" in cpustat Laurent Vivier
-- strict thread matches above, loose matches on Subject: below --
2007-08-20 13:13 Laurent Vivier
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=46C99384.8020904@bull.net \
--to=laurent.vivier@bull.net \
--cc=kvm-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=virtualization@lists.linux-foundation.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 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.