- improve sar thickless kernel support

(fix the output per separate cpu "-P ALL" option )
This commit is contained in:
Ivana Hutarova Varekova 2010-10-07 16:11:58 +02:00
parent f20fd839cb
commit d1812840b7
2 changed files with 43 additions and 20 deletions

View File

@ -1,7 +1,27 @@
diff -up sysstat-9.0.6.1/pr_stats.c.pom sysstat-9.0.6.1/pr_stats.c diff -up sysstat-9.0.6.1/pr_stats.c.tl2 sysstat-9.0.6.1/pr_stats.c
--- sysstat-9.0.6.1/pr_stats.c.pom 2009-09-12 20:59:04.000000000 +0200 --- sysstat-9.0.6.1/pr_stats.c.tl2 2009-09-12 20:59:04.000000000 +0200
+++ sysstat-9.0.6.1/pr_stats.c 2010-09-08 15:39:20.000000000 +0200 +++ sysstat-9.0.6.1/pr_stats.c 2010-10-07 16:05:51.000000000 +0200
@@ -118,7 +118,32 @@ __print_funct_t print_cpu_stats(struct a @@ -110,15 +110,50 @@ __print_funct_t print_cpu_stats(struct a
if (!g_itv) {
/* Current CPU is offline */
printf(" 0.00 0.00 0.00"
- " 0.00 0.00 0.00");
+ " 0.00 0.00");
if (DISPLAY_CPU_ALL(a->opt_flags)) {
printf(" 0.00 0.00 0.00");
}
+ if (scc->cpu_user + scc->cpu_nice + scc->cpu_sys +
+ scc->cpu_iowait + scc->cpu_idle + scc->cpu_steal +
+ scc->cpu_hardirq + scc->cpu_softirq == 0) {
+ /* cpu is offline */
+ printf(" 0.00");
+ } else {
+ /* if the CPU is tickless then
+ there is no change in CPU values but the sum of
+ values is not null */
+ printf(" 100.00");
+ }
printf("\n");
continue; continue;
} }
} }
@ -10,32 +30,31 @@ diff -up sysstat-9.0.6.1/pr_stats.c.pom sysstat-9.0.6.1/pr_stats.c
+ /* set the idle value */ + /* set the idle value */
+ if (scc->cpu_user + scc->cpu_nice + scc->cpu_sys + + if (scc->cpu_user + scc->cpu_nice + scc->cpu_sys +
+ scc->cpu_iowait + scc->cpu_idle + scc->cpu_steal + + scc->cpu_iowait + scc->cpu_idle + scc->cpu_steal +
+ scc->cpu_hardirq + scc->cpu_softirq ==
+ scp->cpu_user + scp->cpu_nice + scp->cpu_sys +
+ scp->cpu_iowait + scp->cpu_idle + scp->cpu_steal +
+ scp->cpu_hardirq + scp->cpu_softirq) {
+
+ if (scc->cpu_user + scc->cpu_nice + scc->cpu_sys +
+ scc->cpu_iowait + scc->cpu_idle + scc->cpu_steal +
+ scc->cpu_hardirq + scc->cpu_softirq == 0) { + scc->cpu_hardirq + scc->cpu_softirq == 0) {
+ /* cpu is offline */ + /* cpu is offline */
+ c_idle = 0; + c_idle = 0;
+ } else { + } else {
+ if (scc->cpu_user + scc->cpu_nice + scc->cpu_sys +
+ scc->cpu_iowait + scc->cpu_idle + scc->cpu_steal +
+ scc->cpu_hardirq + scc->cpu_softirq ==
+ scp->cpu_user + scp->cpu_nice + scp->cpu_sys +
+ scp->cpu_iowait + scp->cpu_idle + scp->cpu_steal +
+ scp->cpu_hardirq + scp->cpu_softirq) {
+ /* if the CPU is tickless then + /* if the CPU is tickless then
+ there is no change in CPU values but the sum of values is not null */ + there is no change in CPU values but the sum of values is not null */
+ c_idle = 100; + c_idle = 100;
+ }
+ } else { + } else {
+ if (scc->cpu_idle < scp->cpu_idle) + if (scc->cpu_idle < scp->cpu_idle)
+ c_idle = 0; + c_idle = 0;
+ else + else
+ c_idle = ll_sp_value(scp->cpu_idle, scc->cpu_idle, g_itv); + c_idle = ll_sp_value(scp->cpu_idle, scc->cpu_idle, g_itv);
+ } + }
+ }
+ +
if (DISPLAY_CPU_DEF(a->opt_flags)) { if (DISPLAY_CPU_DEF(a->opt_flags)) {
printf(" %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f\n", printf(" %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f\n",
ll_sp_value(scp->cpu_user, scc->cpu_user, g_itv), ll_sp_value(scp->cpu_user, scc->cpu_user, g_itv),
@@ -128,9 +153,7 @@ __print_funct_t print_cpu_stats(struct a @@ -128,9 +163,7 @@ __print_funct_t print_cpu_stats(struct a
g_itv), g_itv),
ll_sp_value(scp->cpu_iowait, scc->cpu_iowait, g_itv), ll_sp_value(scp->cpu_iowait, scc->cpu_iowait, g_itv),
ll_sp_value(scp->cpu_steal, scc->cpu_steal, g_itv), ll_sp_value(scp->cpu_steal, scc->cpu_steal, g_itv),
@ -46,7 +65,7 @@ diff -up sysstat-9.0.6.1/pr_stats.c.pom sysstat-9.0.6.1/pr_stats.c
} }
else if (DISPLAY_CPU_ALL(a->opt_flags)) { else if (DISPLAY_CPU_ALL(a->opt_flags)) {
printf(" %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f" printf(" %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f"
@@ -144,9 +167,7 @@ __print_funct_t print_cpu_stats(struct a @@ -144,9 +177,7 @@ __print_funct_t print_cpu_stats(struct a
ll_sp_value(scp->cpu_hardirq, scc->cpu_hardirq, g_itv), ll_sp_value(scp->cpu_hardirq, scc->cpu_hardirq, g_itv),
ll_sp_value(scp->cpu_softirq, scc->cpu_softirq, g_itv), ll_sp_value(scp->cpu_softirq, scc->cpu_softirq, g_itv),
ll_sp_value(scp->cpu_guest, scc->cpu_guest, g_itv), ll_sp_value(scp->cpu_guest, scc->cpu_guest, g_itv),

View File

@ -1,6 +1,6 @@
Name: sysstat Name: sysstat
Version: 9.0.6.1 Version: 9.0.6.1
Release: 11%{?dist} Release: 12%{?dist}
Summary: The sar and iostat system monitoring commands Summary: The sar and iostat system monitoring commands
License: GPLv2+ License: GPLv2+
Group: Applications/System Group: Applications/System
@ -97,6 +97,10 @@ rm -rf %{buildroot}
%{_localstatedir}/log/sa %{_localstatedir}/log/sa
%changelog %changelog
* Thu Oct 7 2010 Ivana Hutarova Varekova <varekova@redhat.com> - 9.0.6.1-12
- improve sar thickless kernel support
(fix the output per separate cpu "-P ALL" option )
* Mon Oct 4 2010 Ivana Hutarova Varekova <varekova@redhat.com> - 9.0.6.1-11 * Mon Oct 4 2010 Ivana Hutarova Varekova <varekova@redhat.com> - 9.0.6.1-11
- resolves: #635646 - resolves: #635646
test the output of localtime properly test the output of localtime properly