add cpu.irq for windows
This commit is contained in:
parent
f03b59703e
commit
c0bd0b1830
|
@ -445,7 +445,7 @@ use vars qw(%classes %cmds);
|
||||||
{
|
{
|
||||||
name => 'irq', type => 'Long',
|
name => 'irq', type => 'Long',
|
||||||
desc => 'Total system cpu time servicing interrupts',
|
desc => 'Total system cpu time servicing interrupts',
|
||||||
plat => 'FLH'
|
plat => 'FLHW'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name => 'soft_irq', type => 'Long',
|
name => 'soft_irq', type => 'Long',
|
||||||
|
@ -492,7 +492,7 @@ use vars qw(%classes %cmds);
|
||||||
{
|
{
|
||||||
name => 'irq', type => 'Double',
|
name => 'irq', type => 'Double',
|
||||||
desc => 'Percent system cpu time servicing interrupts',
|
desc => 'Percent system cpu time servicing interrupts',
|
||||||
plat => 'FLH'
|
plat => 'FLHW'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name => 'soft_irq', type => 'Double',
|
name => 'soft_irq', type => 'Double',
|
||||||
|
|
|
@ -49,8 +49,8 @@ public class CpuInfo extends SigarCommandBase {
|
||||||
println("Wait Time....." + CpuPerc.format(cpu.getWait()));
|
println("Wait Time....." + CpuPerc.format(cpu.getWait()));
|
||||||
println("Nice Time....." + CpuPerc.format(cpu.getNice()));
|
println("Nice Time....." + CpuPerc.format(cpu.getNice()));
|
||||||
println("Combined......" + CpuPerc.format(cpu.getCombined()));
|
println("Combined......" + CpuPerc.format(cpu.getCombined()));
|
||||||
if (SigarLoader.IS_LINUX) {
|
|
||||||
println("Irq Time......" + CpuPerc.format(cpu.getIrq()));
|
println("Irq Time......" + CpuPerc.format(cpu.getIrq()));
|
||||||
|
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("Steal Time...." + CpuPerc.format(cpu.getSteal()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,8 +221,9 @@ typedef struct {
|
||||||
LARGE_INTEGER IdleTime;
|
LARGE_INTEGER IdleTime;
|
||||||
LARGE_INTEGER KernelTime;
|
LARGE_INTEGER KernelTime;
|
||||||
LARGE_INTEGER UserTime;
|
LARGE_INTEGER UserTime;
|
||||||
LARGE_INTEGER Reserved1[2];
|
LARGE_INTEGER DpcTime;
|
||||||
ULONG Reserved2;
|
LARGE_INTEGER InterruptTime;
|
||||||
|
ULONG InterruptCount;
|
||||||
} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
|
} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
|
||||||
|
|
||||||
#define SystemProcessorPerformanceInformation 8
|
#define SystemProcessorPerformanceInformation 8
|
||||||
|
|
|
@ -37,11 +37,13 @@
|
||||||
#define PERF_TITLE_CPU_USER 142
|
#define PERF_TITLE_CPU_USER 142
|
||||||
#define PERF_TITLE_CPU_IDLE 1746
|
#define PERF_TITLE_CPU_IDLE 1746
|
||||||
#define PERF_TITLE_CPU_SYS 144
|
#define PERF_TITLE_CPU_SYS 144
|
||||||
|
#define PERF_TITLE_CPU_IRQ 698
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PERF_IX_CPU_USER,
|
PERF_IX_CPU_USER,
|
||||||
PERF_IX_CPU_IDLE,
|
PERF_IX_CPU_IDLE,
|
||||||
PERF_IX_CPU_SYS,
|
PERF_IX_CPU_SYS,
|
||||||
|
PERF_IX_CPU_IRQ,
|
||||||
PERF_IX_CPU_MAX
|
PERF_IX_CPU_MAX
|
||||||
} perf_cpu_offsets_t;
|
} perf_cpu_offsets_t;
|
||||||
|
|
||||||
|
@ -698,6 +700,9 @@ static PERF_INSTANCE_DEFINITION *get_cpu_instance(sigar_t *sigar,
|
||||||
case PERF_TITLE_CPU_IDLE:
|
case PERF_TITLE_CPU_IDLE:
|
||||||
perf_offsets[PERF_IX_CPU_IDLE] = offset;
|
perf_offsets[PERF_IX_CPU_IDLE] = offset;
|
||||||
break;
|
break;
|
||||||
|
case PERF_TITLE_CPU_IRQ:
|
||||||
|
perf_offsets[PERF_IX_CPU_IRQ] = offset;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -780,9 +785,10 @@ static int sigar_cpu_perflib_get(sigar_t *sigar, sigar_cpu_t *cpu)
|
||||||
cpu->sys = PERF_VAL_CPU(PERF_IX_CPU_SYS);
|
cpu->sys = PERF_VAL_CPU(PERF_IX_CPU_SYS);
|
||||||
cpu->user = PERF_VAL_CPU(PERF_IX_CPU_USER);
|
cpu->user = PERF_VAL_CPU(PERF_IX_CPU_USER);
|
||||||
status = get_idle_cpu(sigar, cpu, -1, counter_block, perf_offsets);
|
status = get_idle_cpu(sigar, cpu, -1, counter_block, perf_offsets);
|
||||||
|
cpu->irq = PERF_VAL_CPU(PERF_IX_CPU_IRQ);
|
||||||
cpu->nice = 0; /* no nice here */
|
cpu->nice = 0; /* no nice here */
|
||||||
cpu->wait = 0; /*N/A?*/
|
cpu->wait = 0; /*N/A?*/
|
||||||
cpu->total = cpu->sys + cpu->user + cpu->idle + cpu->wait;
|
cpu->total = cpu->sys + cpu->user + cpu->idle + cpu->wait + cpu->irq;
|
||||||
|
|
||||||
if (status != SIGAR_OK) {
|
if (status != SIGAR_OK) {
|
||||||
sigar_log_printf(sigar, SIGAR_LOG_WARN,
|
sigar_log_printf(sigar, SIGAR_LOG_WARN,
|
||||||
|
@ -814,6 +820,7 @@ static int sigar_cpu_ntsys_get(sigar_t *sigar, sigar_cpu_t *cpu)
|
||||||
cpu->user += NS100_2MSEC(info[i].UserTime.QuadPart);
|
cpu->user += NS100_2MSEC(info[i].UserTime.QuadPart);
|
||||||
cpu->sys += NS100_2MSEC(info[i].KernelTime.QuadPart -
|
cpu->sys += NS100_2MSEC(info[i].KernelTime.QuadPart -
|
||||||
info[i].IdleTime.QuadPart);
|
info[i].IdleTime.QuadPart);
|
||||||
|
cpu->irq += NS100_2MSEC(info[i].InterruptTime.QuadPart);
|
||||||
cpu->total += cpu->idle + cpu->user + cpu->sys;
|
cpu->total += cpu->idle + cpu->user + cpu->sys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -879,11 +886,12 @@ static int sigar_cpu_list_perflib_get(sigar_t *sigar,
|
||||||
|
|
||||||
cpu->sys += PERF_VAL_CPU(PERF_IX_CPU_SYS);
|
cpu->sys += PERF_VAL_CPU(PERF_IX_CPU_SYS);
|
||||||
cpu->user += PERF_VAL_CPU(PERF_IX_CPU_USER);
|
cpu->user += PERF_VAL_CPU(PERF_IX_CPU_USER);
|
||||||
|
cpu->irq += PERF_VAL_CPU(PERF_IX_CPU_IRQ);
|
||||||
get_idle_cpu(sigar, cpu, i, counter_block, perf_offsets);
|
get_idle_cpu(sigar, cpu, i, counter_block, perf_offsets);
|
||||||
cpu->nice = cpu->wait = 0; /*N/A*/
|
cpu->nice = cpu->wait = 0; /*N/A*/
|
||||||
|
|
||||||
/*XXX adding up too much here if xeon, but not using this atm*/
|
/*XXX adding up too much here if xeon, but not using this atm*/
|
||||||
cpu->total += cpu->sys + cpu->user + cpu->idle;
|
cpu->total += cpu->sys + cpu->user + cpu->idle + cpu->irq;
|
||||||
|
|
||||||
inst = PdhNextInstance(inst);
|
inst = PdhNextInstance(inst);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue