[SIGAR-106] rename cpu steal -> stolen

This commit is contained in:
Doug MacEachern 2008-05-28 18:14:00 +00:00
parent 87b194fbb1
commit 51dd062f7e
13 changed files with 26 additions and 25 deletions

View File

@ -453,7 +453,7 @@ use vars qw(%classes %cmds);
plat => 'L' plat => 'L'
}, },
{ {
name => 'steal', type => 'Long', name => 'stolen', type => 'Long',
desc => 'Total system cpu involuntary wait time', desc => 'Total system cpu involuntary wait time',
plat => 'L' plat => 'L'
}, },
@ -500,7 +500,7 @@ use vars qw(%classes %cmds);
plat => 'L' plat => 'L'
}, },
{ {
name => 'steal', type => 'Double', name => 'stolen', type => 'Double',
desc => 'Percent system cpu involuntary wait time', desc => 'Percent system cpu involuntary wait time',
plat => 'L' plat => 'L'
}, },

View File

@ -32,7 +32,7 @@ public class CpuPerc implements java.io.Serializable {
private double wait; private double wait;
private double irq; private double irq;
private double softIrq; private double softIrq;
private double steal; private double stolen;
private double combined; private double combined;
CpuPerc() {} CpuPerc() {}
@ -85,8 +85,8 @@ public class CpuPerc implements java.io.Serializable {
return this.softIrq; return this.softIrq;
} }
public double getSteal() { public double getStolen() {
return this.steal; return this.stolen;
} }
/** /**

View File

@ -52,7 +52,7 @@ public class CpuInfo extends SigarCommandBase {
println("Irq Time......" + CpuPerc.format(cpu.getIrq())); println("Irq Time......" + CpuPerc.format(cpu.getIrq()));
if (SigarLoader.IS_LINUX) { if (SigarLoader.IS_LINUX) {
println("SoftIrq Time.." + CpuPerc.format(cpu.getSoftIrq())); println("SoftIrq Time.." + CpuPerc.format(cpu.getSoftIrq()));
println("Steal Time...." + CpuPerc.format(cpu.getSteal())); println("Stolen Time...." + CpuPerc.format(cpu.getStolen()));
} }
println(""); println("");
} }

View File

@ -49,8 +49,8 @@ public class TestCpu extends SigarTestCase {
traceln("SIrq.." + cpu.getSoftIrq()); traceln("SIrq.." + cpu.getSoftIrq());
assertTrue(cpu.getSoftIrq() >= 0); assertTrue(cpu.getSoftIrq() >= 0);
traceln("Stl..." + cpu.getSteal()); traceln("Stl..." + cpu.getStolen());
assertTrue(cpu.getSteal() >= 0); assertTrue(cpu.getStolen() >= 0);
traceln("Total.." + cpu.getTotal()); traceln("Total.." + cpu.getTotal());
assertTrue(cpu.getTotal() > 0); assertTrue(cpu.getTotal() > 0);

View File

@ -2,7 +2,7 @@
#!perl -l #!perl -l
use Config; use Config;
my $prg = "$0.out"; my $prg = "$0.out";
my $cmd = "$Config{cc} -Wall -D$^O -o $prg $0; ./$prg; rm $prg"; my $cmd = "gcc -Wall -D$^O -o $prg $0; ./$prg; rm $prg";
print $cmd; system $cmd; print $cmd; system $cmd;
__END__ __END__
*/ */
@ -32,6 +32,7 @@ static sizeof_info_t sizeof_info[] = {
SIZEOF_INFO(vminfo_t), SIZEOF_INFO(vminfo_t),
SIZEOF_INFO(cpu_stat_t), SIZEOF_INFO(cpu_stat_t),
SIZEOF_INFO(cpu_vminfo_t), SIZEOF_INFO(cpu_vminfo_t),
SIZEOF_INFO(cpu_sys_stats_t),
SIZEOF_INFO(kstat_io_t), SIZEOF_INFO(kstat_io_t),
/* procfs */ /* procfs */
SIZEOF_INFO(psinfo_t), SIZEOF_INFO(psinfo_t),

View File

@ -167,7 +167,7 @@ typedef struct {
wait, wait,
irq, irq,
soft_irq, soft_irq,
steal, stolen,
total; total;
} sigar_cpu_t; } sigar_cpu_t;

View File

@ -27,7 +27,7 @@ typedef struct {
double wait; double wait;
double irq; double irq;
double soft_irq; double soft_irq;
double steal; double stolen;
double combined; double combined;
} sigar_cpu_perc_t; } sigar_cpu_perc_t;

View File

@ -719,7 +719,7 @@ int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)
cpu->wait = SIGAR_TICK2MSEC(cpu_data.wait); cpu->wait = SIGAR_TICK2MSEC(cpu_data.wait);
cpu->irq = 0; /*N/A*/ cpu->irq = 0; /*N/A*/
cpu->soft_irq = 0; /*N/A*/ cpu->soft_irq = 0; /*N/A*/
cpu->steal = 0; /*N/A*/ cpu->stolen = 0; /*N/A*/
cpu->total = cpu->user + cpu->sys + cpu->idle + cpu->wait; cpu->total = cpu->user + cpu->sys + cpu->idle + cpu->wait;
return SIGAR_OK; return SIGAR_OK;
} }
@ -741,7 +741,7 @@ int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)
cpu->wait = SIGAR_TICK2MSEC(data.cpu[CPU_WAIT]); cpu->wait = SIGAR_TICK2MSEC(data.cpu[CPU_WAIT]);
cpu->irq = 0; /*N/A*/ cpu->irq = 0; /*N/A*/
cpu->soft_irq = 0; /*N/A*/ cpu->soft_irq = 0; /*N/A*/
cpu->steal = 0; /*N/A*/ cpu->stolen = 0; /*N/A*/
cpu->total = cpu->user + cpu->sys + cpu->idle + cpu->wait; cpu->total = cpu->user + cpu->sys + cpu->idle + cpu->wait;
return SIGAR_OK; return SIGAR_OK;

View File

@ -636,7 +636,7 @@ int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)
cpu->wait = 0; /*N/A*/ cpu->wait = 0; /*N/A*/
cpu->irq = 0; /*N/A*/ cpu->irq = 0; /*N/A*/
cpu->soft_irq = 0; /*N/A*/ cpu->soft_irq = 0; /*N/A*/
cpu->steal = 0; /*N/A*/ cpu->stolen = 0; /*N/A*/
cpu->total = cpu->user + cpu->nice + cpu->sys + cpu->idle; cpu->total = cpu->user + cpu->nice + cpu->sys + cpu->idle;
#elif defined(__FreeBSD__) || (__OpenBSD__) || defined(__NetBSD__) #elif defined(__FreeBSD__) || (__OpenBSD__) || defined(__NetBSD__)
@ -671,7 +671,7 @@ int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)
cpu->wait = 0; /*N/A*/ cpu->wait = 0; /*N/A*/
cpu->irq = SIGAR_TICK2MSEC(cp_time[CP_INTR]); cpu->irq = SIGAR_TICK2MSEC(cp_time[CP_INTR]);
cpu->soft_irq = 0; /*N/A*/ cpu->soft_irq = 0; /*N/A*/
cpu->steal = 0; /*N/A*/ cpu->stolen = 0; /*N/A*/
cpu->total = cpu->user + cpu->nice + cpu->sys + cpu->idle + cpu->irq; cpu->total = cpu->user + cpu->nice + cpu->sys + cpu->idle + cpu->irq;
#endif #endif
@ -712,7 +712,7 @@ int sigar_cpu_list_get(sigar_t *sigar, sigar_cpu_list_t *cpulist)
cpu->wait = 0; /*N/A*/ cpu->wait = 0; /*N/A*/
cpu->irq = 0; /*N/A*/ cpu->irq = 0; /*N/A*/
cpu->soft_irq = 0; /*N/A*/ cpu->soft_irq = 0; /*N/A*/
cpu->steal = 0; /*N/A*/ cpu->stolen = 0; /*N/A*/
cpu->total = cpu->user + cpu->nice + cpu->sys + cpu->idle; cpu->total = cpu->user + cpu->nice + cpu->sys + cpu->idle;
} }

View File

@ -140,7 +140,7 @@ static void get_cpu_metrics(sigar_t *sigar,
cpu->irq = SIGAR_TICK2MSEC(cpu_time[CP_INTR]); cpu->irq = SIGAR_TICK2MSEC(cpu_time[CP_INTR]);
cpu->soft_irq = 0; /*N/A*/ cpu->soft_irq = 0; /*N/A*/
cpu->steal = 0; /*N/A*/ cpu->stolen = 0; /*N/A*/
cpu->total = cpu->total =
cpu->user + cpu->sys + cpu->nice + cpu->idle + cpu->wait + cpu->irq; cpu->user + cpu->sys + cpu->nice + cpu->idle + cpu->wait + cpu->irq;

View File

@ -416,11 +416,11 @@ static void get_cpu_metrics(sigar_t *sigar, sigar_cpu_t *cpu, char *line)
} }
if (*ptr == ' ') { if (*ptr == ' ') {
/* 2.6.11+ kernels only */ /* 2.6.11+ kernels only */
cpu->steal += SIGAR_TICK2MSEC(sigar_strtoull(ptr)); cpu->stolen += SIGAR_TICK2MSEC(sigar_strtoull(ptr));
} }
cpu->total = cpu->total =
cpu->user + cpu->nice + cpu->sys + cpu->idle + cpu->user + cpu->nice + cpu->sys + cpu->idle +
cpu->wait + cpu->irq + cpu->soft_irq + cpu->steal; cpu->wait + cpu->irq + cpu->soft_irq + cpu->stolen;
} }
int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu) int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)

View File

@ -106,7 +106,7 @@ int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)
cpu->wait = 0; /*N/A?*/ cpu->wait = 0; /*N/A?*/
cpu->irq = 0; /*N/A*/ cpu->irq = 0; /*N/A*/
cpu->soft_irq = 0; /*N/A*/ cpu->soft_irq = 0; /*N/A*/
cpu->steal = 0; /*N/A*/ cpu->stolen = 0; /*N/A*/
cpu->total = cpu->user + cpu->nice + cpu->sys + cpu->idle + cpu->wait; cpu->total = cpu->user + cpu->nice + cpu->sys + cpu->idle + cpu->wait;
return SIGAR_OK; return SIGAR_OK;

View File

@ -611,7 +611,7 @@ SIGAR_DECLARE(int) sigar_cpu_perc_calculate(sigar_cpu_t *prev,
sigar_cpu_perc_t *perc) sigar_cpu_perc_t *perc)
{ {
double diff_user, diff_sys, diff_nice, diff_idle; double diff_user, diff_sys, diff_nice, diff_idle;
double diff_wait, diff_irq, diff_soft_irq, diff_steal; double diff_wait, diff_irq, diff_soft_irq, diff_stolen;
double diff_total; double diff_total;
diff_user = (sigar_int64_t)(curr->user - prev->user); diff_user = (sigar_int64_t)(curr->user - prev->user);
@ -621,7 +621,7 @@ SIGAR_DECLARE(int) sigar_cpu_perc_calculate(sigar_cpu_t *prev,
diff_wait = (sigar_int64_t)(curr->wait - prev->wait); diff_wait = (sigar_int64_t)(curr->wait - prev->wait);
diff_irq = (sigar_int64_t)(curr->irq - prev->irq); diff_irq = (sigar_int64_t)(curr->irq - prev->irq);
diff_soft_irq = (sigar_int64_t)(curr->soft_irq - prev->soft_irq); diff_soft_irq = (sigar_int64_t)(curr->soft_irq - prev->soft_irq);
diff_steal = (sigar_int64_t)(curr->steal - prev->steal); diff_stolen = (sigar_int64_t)(curr->stolen - prev->stolen);
diff_user = diff_user < 0 ? 0 : diff_user; diff_user = diff_user < 0 ? 0 : diff_user;
diff_sys = diff_sys < 0 ? 0 : diff_sys; diff_sys = diff_sys < 0 ? 0 : diff_sys;
@ -630,12 +630,12 @@ SIGAR_DECLARE(int) sigar_cpu_perc_calculate(sigar_cpu_t *prev,
diff_wait = diff_wait < 0 ? 0 : diff_wait; diff_wait = diff_wait < 0 ? 0 : diff_wait;
diff_irq = diff_irq < 0 ? 0 : diff_irq; diff_irq = diff_irq < 0 ? 0 : diff_irq;
diff_soft_irq = diff_soft_irq < 0 ? 0 : diff_soft_irq; diff_soft_irq = diff_soft_irq < 0 ? 0 : diff_soft_irq;
diff_steal = diff_steal < 0 ? 0 : diff_steal; diff_stolen = diff_stolen < 0 ? 0 : diff_stolen;
diff_total = diff_total =
diff_user + diff_sys + diff_nice + diff_idle + diff_user + diff_sys + diff_nice + diff_idle +
diff_wait + diff_irq + diff_soft_irq + diff_wait + diff_irq + diff_soft_irq +
diff_steal; diff_stolen;
perc->user = diff_user / diff_total; perc->user = diff_user / diff_total;
perc->sys = diff_sys / diff_total; perc->sys = diff_sys / diff_total;
@ -644,7 +644,7 @@ SIGAR_DECLARE(int) sigar_cpu_perc_calculate(sigar_cpu_t *prev,
perc->wait = diff_wait / diff_total; perc->wait = diff_wait / diff_total;
perc->irq = diff_irq / diff_total; perc->irq = diff_irq / diff_total;
perc->soft_irq = diff_soft_irq / diff_total; perc->soft_irq = diff_soft_irq / diff_total;
perc->steal = diff_steal / diff_total; perc->stolen = diff_stolen / diff_total;
perc->combined = perc->combined =
perc->user + perc->sys + perc->nice + perc->wait; perc->user + perc->sys + perc->nice + perc->wait;