Re: [RESEND][PATCH 1/4] Introduce a new field "guest" in cpustat

2007-09-10 Thread Laurent Vivier
Rik van Riel wrote:
> Laurent Vivier wrote:
>> [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.
> 
> I think it would be good to always print out that number, even if
> it is zero without the CONFIG option set.
> 
> Changing the format of /proc/stat depending on config options is
> probably worse than changing it when moving kernel versions.
> 
> I guess reusing the "steal" field is not a good idea, since your
> new "guest time" has different semantics than the steal time field.
> 

I agree with all.

Laurent
-- 
- [EMAIL PROTECTED]  --
  "Software is hard" - Donald Knuth



signature.asc
Description: OpenPGP digital signature


Re: [RESEND][PATCH 1/4] Introduce a new field "guest" in cpustat

2007-09-10 Thread Rik van Riel

Laurent Vivier wrote:

[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.


I think it would be good to always print out that number, even if
it is zero without the CONFIG option set.

Changing the format of /proc/stat depending on config options is
probably worse than changing it when moving kernel versions.

I guess reusing the "steal" field is not a good idea, since your
new "guest time" has different semantics than the steal time field.

--
Politics is the struggle between those who want to make their country
the best in the world, and those who believe it already is.  Each group
calls the other unpatriotic.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RESEND][PATCH 1/4] Introduce a new field "guest" in cpustat

2007-09-10 Thread Laurent Vivier
[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 <[EMAIL PROTECTED]>
-- 
- [EMAIL PROTECTED]  --
  "Software is hard" - Donald Knuth

Index: linux-2.6/fs/proc/proc_misc.c
===
--- linux-2.6.orig/fs/proc/proc_misc.c  2007-09-10 12:58:31.0 +0200
+++ linux-2.6/fs/proc/proc_misc.c   2007-09-10 12:58:37.0 +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();
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: linux-2.6/include/linux/kernel_stat.h
===
--- linux-2.6.orig/include/linux/kernel_stat.h  2007-09-10 

[RESEND][PATCH 1/4] Introduce a new field guest in cpustat

2007-09-10 Thread Laurent Vivier
[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 [EMAIL PROTECTED]
-- 
- [EMAIL PROTECTED]  --
  Software is hard - Donald Knuth

Index: linux-2.6/fs/proc/proc_misc.c
===
--- linux-2.6.orig/fs/proc/proc_misc.c  2007-09-10 12:58:31.0 +0200
+++ linux-2.6/fs/proc/proc_misc.c   2007-09-10 12:58:37.0 +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: linux-2.6/include/linux/kernel_stat.h
===
--- linux-2.6.orig/include/linux/kernel_stat.h  2007-09-10 

Re: [RESEND][PATCH 1/4] Introduce a new field guest in cpustat

2007-09-10 Thread Rik van Riel

Laurent Vivier wrote:

[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.


I think it would be good to always print out that number, even if
it is zero without the CONFIG option set.

Changing the format of /proc/stat depending on config options is
probably worse than changing it when moving kernel versions.

I guess reusing the steal field is not a good idea, since your
new guest time has different semantics than the steal time field.

--
Politics is the struggle between those who want to make their country
the best in the world, and those who believe it already is.  Each group
calls the other unpatriotic.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RESEND][PATCH 1/4] Introduce a new field guest in cpustat

2007-09-10 Thread Laurent Vivier
Rik van Riel wrote:
 Laurent Vivier wrote:
 [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.
 
 I think it would be good to always print out that number, even if
 it is zero without the CONFIG option set.
 
 Changing the format of /proc/stat depending on config options is
 probably worse than changing it when moving kernel versions.
 
 I guess reusing the steal field is not a good idea, since your
 new guest time has different semantics than the steal time field.
 

I agree with all.

Laurent
-- 
- [EMAIL PROTECTED]  --
  Software is hard - Donald Knuth



signature.asc
Description: OpenPGP digital signature