|
@@ -21,23 +21,23 @@
|
|
|
|
|
|
#ifdef arch_idle_time
|
|
#ifdef arch_idle_time
|
|
|
|
|
|
-static cputime64_t get_idle_time(int cpu)
|
|
|
|
|
|
+static u64 get_idle_time(int cpu)
|
|
{
|
|
{
|
|
- cputime64_t idle;
|
|
|
|
|
|
+ u64 idle;
|
|
|
|
|
|
idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE];
|
|
idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE];
|
|
if (cpu_online(cpu) && !nr_iowait_cpu(cpu))
|
|
if (cpu_online(cpu) && !nr_iowait_cpu(cpu))
|
|
- idle += arch_idle_time(cpu);
|
|
|
|
|
|
+ idle += cputime_to_nsecs(arch_idle_time(cpu));
|
|
return idle;
|
|
return idle;
|
|
}
|
|
}
|
|
|
|
|
|
-static cputime64_t get_iowait_time(int cpu)
|
|
|
|
|
|
+static u64 get_iowait_time(int cpu)
|
|
{
|
|
{
|
|
- cputime64_t iowait;
|
|
|
|
|
|
+ u64 iowait;
|
|
|
|
|
|
iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT];
|
|
iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT];
|
|
if (cpu_online(cpu) && nr_iowait_cpu(cpu))
|
|
if (cpu_online(cpu) && nr_iowait_cpu(cpu))
|
|
- iowait += arch_idle_time(cpu);
|
|
|
|
|
|
+ iowait += cputime_to_nsecs(arch_idle_time(cpu));
|
|
return iowait;
|
|
return iowait;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -45,32 +45,32 @@ static cputime64_t get_iowait_time(int cpu)
|
|
|
|
|
|
static u64 get_idle_time(int cpu)
|
|
static u64 get_idle_time(int cpu)
|
|
{
|
|
{
|
|
- u64 idle, idle_time = -1ULL;
|
|
|
|
|
|
+ u64 idle, idle_usecs = -1ULL;
|
|
|
|
|
|
if (cpu_online(cpu))
|
|
if (cpu_online(cpu))
|
|
- idle_time = get_cpu_idle_time_us(cpu, NULL);
|
|
|
|
|
|
+ idle_usecs = get_cpu_idle_time_us(cpu, NULL);
|
|
|
|
|
|
- if (idle_time == -1ULL)
|
|
|
|
|
|
+ if (idle_usecs == -1ULL)
|
|
/* !NO_HZ or cpu offline so we can rely on cpustat.idle */
|
|
/* !NO_HZ or cpu offline so we can rely on cpustat.idle */
|
|
idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE];
|
|
idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE];
|
|
else
|
|
else
|
|
- idle = usecs_to_cputime64(idle_time);
|
|
|
|
|
|
+ idle = idle_usecs * NSEC_PER_USEC;
|
|
|
|
|
|
return idle;
|
|
return idle;
|
|
}
|
|
}
|
|
|
|
|
|
static u64 get_iowait_time(int cpu)
|
|
static u64 get_iowait_time(int cpu)
|
|
{
|
|
{
|
|
- u64 iowait, iowait_time = -1ULL;
|
|
|
|
|
|
+ u64 iowait, iowait_usecs = -1ULL;
|
|
|
|
|
|
if (cpu_online(cpu))
|
|
if (cpu_online(cpu))
|
|
- iowait_time = get_cpu_iowait_time_us(cpu, NULL);
|
|
|
|
|
|
+ iowait_usecs = get_cpu_iowait_time_us(cpu, NULL);
|
|
|
|
|
|
- if (iowait_time == -1ULL)
|
|
|
|
|
|
+ if (iowait_usecs == -1ULL)
|
|
/* !NO_HZ or cpu offline so we can rely on cpustat.iowait */
|
|
/* !NO_HZ or cpu offline so we can rely on cpustat.iowait */
|
|
iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT];
|
|
iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT];
|
|
else
|
|
else
|
|
- iowait = usecs_to_cputime64(iowait_time);
|
|
|
|
|
|
+ iowait = iowait_usecs * NSEC_PER_USEC;
|
|
|
|
|
|
return iowait;
|
|
return iowait;
|
|
}
|
|
}
|
|
@@ -115,16 +115,16 @@ static int show_stat(struct seq_file *p, void *v)
|
|
}
|
|
}
|
|
sum += arch_irq_stat();
|
|
sum += arch_irq_stat();
|
|
|
|
|
|
- seq_put_decimal_ull(p, "cpu ", cputime64_to_clock_t(user));
|
|
|
|
- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(nice));
|
|
|
|
- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(system));
|
|
|
|
- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(idle));
|
|
|
|
- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(iowait));
|
|
|
|
- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(irq));
|
|
|
|
- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(softirq));
|
|
|
|
- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(steal));
|
|
|
|
- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(guest));
|
|
|
|
- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(guest_nice));
|
|
|
|
|
|
+ seq_put_decimal_ull(p, "cpu ", nsec_to_clock_t(user));
|
|
|
|
+ seq_put_decimal_ull(p, " ", nsec_to_clock_t(nice));
|
|
|
|
+ seq_put_decimal_ull(p, " ", nsec_to_clock_t(system));
|
|
|
|
+ seq_put_decimal_ull(p, " ", nsec_to_clock_t(idle));
|
|
|
|
+ seq_put_decimal_ull(p, " ", nsec_to_clock_t(iowait));
|
|
|
|
+ seq_put_decimal_ull(p, " ", nsec_to_clock_t(irq));
|
|
|
|
+ seq_put_decimal_ull(p, " ", nsec_to_clock_t(softirq));
|
|
|
|
+ seq_put_decimal_ull(p, " ", nsec_to_clock_t(steal));
|
|
|
|
+ seq_put_decimal_ull(p, " ", nsec_to_clock_t(guest));
|
|
|
|
+ seq_put_decimal_ull(p, " ", nsec_to_clock_t(guest_nice));
|
|
seq_putc(p, '\n');
|
|
seq_putc(p, '\n');
|
|
|
|
|
|
for_each_online_cpu(i) {
|
|
for_each_online_cpu(i) {
|
|
@@ -140,16 +140,16 @@ static int show_stat(struct seq_file *p, void *v)
|
|
guest = kcpustat_cpu(i).cpustat[CPUTIME_GUEST];
|
|
guest = kcpustat_cpu(i).cpustat[CPUTIME_GUEST];
|
|
guest_nice = kcpustat_cpu(i).cpustat[CPUTIME_GUEST_NICE];
|
|
guest_nice = kcpustat_cpu(i).cpustat[CPUTIME_GUEST_NICE];
|
|
seq_printf(p, "cpu%d", i);
|
|
seq_printf(p, "cpu%d", i);
|
|
- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(user));
|
|
|
|
- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(nice));
|
|
|
|
- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(system));
|
|
|
|
- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(idle));
|
|
|
|
- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(iowait));
|
|
|
|
- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(irq));
|
|
|
|
- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(softirq));
|
|
|
|
- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(steal));
|
|
|
|
- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(guest));
|
|
|
|
- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(guest_nice));
|
|
|
|
|
|
+ seq_put_decimal_ull(p, " ", nsec_to_clock_t(user));
|
|
|
|
+ seq_put_decimal_ull(p, " ", nsec_to_clock_t(nice));
|
|
|
|
+ seq_put_decimal_ull(p, " ", nsec_to_clock_t(system));
|
|
|
|
+ seq_put_decimal_ull(p, " ", nsec_to_clock_t(idle));
|
|
|
|
+ seq_put_decimal_ull(p, " ", nsec_to_clock_t(iowait));
|
|
|
|
+ seq_put_decimal_ull(p, " ", nsec_to_clock_t(irq));
|
|
|
|
+ seq_put_decimal_ull(p, " ", nsec_to_clock_t(softirq));
|
|
|
|
+ seq_put_decimal_ull(p, " ", nsec_to_clock_t(steal));
|
|
|
|
+ seq_put_decimal_ull(p, " ", nsec_to_clock_t(guest));
|
|
|
|
+ seq_put_decimal_ull(p, " ", nsec_to_clock_t(guest_nice));
|
|
seq_putc(p, '\n');
|
|
seq_putc(p, '\n');
|
|
}
|
|
}
|
|
seq_put_decimal_ull(p, "intr ", (unsigned long long)sum);
|
|
seq_put_decimal_ull(p, "intr ", (unsigned long long)sum);
|