[SIGAR-106] rename cpu steal -> stolen
This commit is contained in:
		
							parent
							
								
									87b194fbb1
								
							
						
					
					
						commit
						51dd062f7e
					
				@ -453,7 +453,7 @@ use vars qw(%classes %cmds);
 | 
			
		||||
         plat => 'L'
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
         name => 'steal', type => 'Long',
 | 
			
		||||
         name => 'stolen', type => 'Long',
 | 
			
		||||
         desc => 'Total system cpu involuntary wait time',
 | 
			
		||||
         plat => 'L'
 | 
			
		||||
      },
 | 
			
		||||
@ -500,7 +500,7 @@ use vars qw(%classes %cmds);
 | 
			
		||||
         plat => 'L'
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
         name => 'steal', type => 'Double',
 | 
			
		||||
         name => 'stolen', type => 'Double',
 | 
			
		||||
         desc => 'Percent system cpu involuntary wait time',
 | 
			
		||||
         plat => 'L'
 | 
			
		||||
      },
 | 
			
		||||
 | 
			
		||||
@ -32,7 +32,7 @@ public class CpuPerc implements java.io.Serializable {
 | 
			
		||||
    private double wait;
 | 
			
		||||
    private double irq;
 | 
			
		||||
    private double softIrq;
 | 
			
		||||
    private double steal;
 | 
			
		||||
    private double stolen;
 | 
			
		||||
    private double combined;
 | 
			
		||||
 | 
			
		||||
    CpuPerc() {}
 | 
			
		||||
@ -85,8 +85,8 @@ public class CpuPerc implements java.io.Serializable {
 | 
			
		||||
        return this.softIrq;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double getSteal() {
 | 
			
		||||
        return this.steal;
 | 
			
		||||
    public double getStolen() {
 | 
			
		||||
        return this.stolen;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 | 
			
		||||
@ -52,7 +52,7 @@ public class CpuInfo extends SigarCommandBase {
 | 
			
		||||
        println("Irq Time......" + CpuPerc.format(cpu.getIrq()));
 | 
			
		||||
        if (SigarLoader.IS_LINUX) {
 | 
			
		||||
            println("SoftIrq Time.." + CpuPerc.format(cpu.getSoftIrq()));
 | 
			
		||||
            println("Steal Time...." + CpuPerc.format(cpu.getSteal()));
 | 
			
		||||
            println("Stolen Time...." + CpuPerc.format(cpu.getStolen()));
 | 
			
		||||
        }
 | 
			
		||||
        println("");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -49,8 +49,8 @@ public class TestCpu extends SigarTestCase {
 | 
			
		||||
        traceln("SIrq.." + cpu.getSoftIrq());
 | 
			
		||||
        assertTrue(cpu.getSoftIrq() >= 0);
 | 
			
		||||
 | 
			
		||||
        traceln("Stl..." + cpu.getSteal());
 | 
			
		||||
        assertTrue(cpu.getSteal() >= 0);
 | 
			
		||||
        traceln("Stl..." + cpu.getStolen());
 | 
			
		||||
        assertTrue(cpu.getStolen() >= 0);
 | 
			
		||||
 | 
			
		||||
        traceln("Total.." + cpu.getTotal());
 | 
			
		||||
        assertTrue(cpu.getTotal() > 0);
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,7 @@
 | 
			
		||||
#!perl -l
 | 
			
		||||
use Config;
 | 
			
		||||
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;
 | 
			
		||||
__END__
 | 
			
		||||
*/
 | 
			
		||||
@ -32,6 +32,7 @@ static sizeof_info_t sizeof_info[] = {
 | 
			
		||||
    SIZEOF_INFO(vminfo_t),
 | 
			
		||||
    SIZEOF_INFO(cpu_stat_t),
 | 
			
		||||
    SIZEOF_INFO(cpu_vminfo_t),
 | 
			
		||||
    SIZEOF_INFO(cpu_sys_stats_t),
 | 
			
		||||
    SIZEOF_INFO(kstat_io_t),
 | 
			
		||||
    /* procfs */
 | 
			
		||||
    SIZEOF_INFO(psinfo_t),
 | 
			
		||||
 | 
			
		||||
@ -167,7 +167,7 @@ typedef struct {
 | 
			
		||||
        wait,
 | 
			
		||||
        irq,
 | 
			
		||||
        soft_irq,
 | 
			
		||||
        steal,
 | 
			
		||||
        stolen,
 | 
			
		||||
        total;
 | 
			
		||||
} sigar_cpu_t;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -27,7 +27,7 @@ typedef struct {
 | 
			
		||||
    double wait;
 | 
			
		||||
    double irq;
 | 
			
		||||
    double soft_irq;
 | 
			
		||||
    double steal;
 | 
			
		||||
    double stolen;
 | 
			
		||||
    double combined;
 | 
			
		||||
} sigar_cpu_perc_t;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -719,7 +719,7 @@ int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)
 | 
			
		||||
            cpu->wait  = SIGAR_TICK2MSEC(cpu_data.wait);
 | 
			
		||||
            cpu->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;
 | 
			
		||||
            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->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;
 | 
			
		||||
 | 
			
		||||
    return SIGAR_OK;
 | 
			
		||||
 | 
			
		||||
@ -636,7 +636,7 @@ int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)
 | 
			
		||||
    cpu->wait = 0; /*N/A*/
 | 
			
		||||
    cpu->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;
 | 
			
		||||
 | 
			
		||||
#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->irq = SIGAR_TICK2MSEC(cp_time[CP_INTR]);
 | 
			
		||||
    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;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -712,7 +712,7 @@ int sigar_cpu_list_get(sigar_t *sigar, sigar_cpu_list_t *cpulist)
 | 
			
		||||
        cpu->wait = 0; /*N/A*/
 | 
			
		||||
        cpu->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;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -140,7 +140,7 @@ static void get_cpu_metrics(sigar_t *sigar,
 | 
			
		||||
    
 | 
			
		||||
    cpu->irq = SIGAR_TICK2MSEC(cpu_time[CP_INTR]);
 | 
			
		||||
    cpu->soft_irq = 0; /*N/A*/
 | 
			
		||||
    cpu->steal = 0; /*N/A*/
 | 
			
		||||
    cpu->stolen = 0; /*N/A*/
 | 
			
		||||
 | 
			
		||||
    cpu->total =
 | 
			
		||||
        cpu->user + cpu->sys + cpu->nice + cpu->idle + cpu->wait + cpu->irq;
 | 
			
		||||
 | 
			
		||||
@ -416,11 +416,11 @@ static void get_cpu_metrics(sigar_t *sigar, sigar_cpu_t *cpu, char *line)
 | 
			
		||||
    }
 | 
			
		||||
    if (*ptr == ' ') {
 | 
			
		||||
        /* 2.6.11+ kernels only */
 | 
			
		||||
        cpu->steal += SIGAR_TICK2MSEC(sigar_strtoull(ptr));
 | 
			
		||||
        cpu->stolen += SIGAR_TICK2MSEC(sigar_strtoull(ptr));
 | 
			
		||||
    }
 | 
			
		||||
    cpu->total =
 | 
			
		||||
        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)
 | 
			
		||||
 | 
			
		||||
@ -106,7 +106,7 @@ int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)
 | 
			
		||||
    cpu->wait = 0; /*N/A?*/
 | 
			
		||||
    cpu->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;
 | 
			
		||||
 | 
			
		||||
    return SIGAR_OK;
 | 
			
		||||
 | 
			
		||||
@ -611,7 +611,7 @@ SIGAR_DECLARE(int) sigar_cpu_perc_calculate(sigar_cpu_t *prev,
 | 
			
		||||
                                            sigar_cpu_perc_t *perc)
 | 
			
		||||
{
 | 
			
		||||
    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;
 | 
			
		||||
 | 
			
		||||
    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_irq = (sigar_int64_t)(curr->irq - prev->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_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_irq = diff_irq < 0 ? 0 : diff_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_user + diff_sys + diff_nice + diff_idle +
 | 
			
		||||
        diff_wait + diff_irq + diff_soft_irq +
 | 
			
		||||
        diff_steal;
 | 
			
		||||
        diff_stolen;
 | 
			
		||||
 | 
			
		||||
    perc->user = diff_user / 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->irq = diff_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->user + perc->sys + perc->nice + perc->wait;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user