7 #include <linux/sched.h>
9 #include <linux/slab.h>
10 #include <linux/time.h>
11 #include <linux/irqnr.h>
12 #include <asm/cputime.h>
15 #ifndef arch_irq_stat_cpu
16 #define arch_irq_stat_cpu(cpu) 0
19 #define arch_irq_stat() 0
46 static u64 get_idle_time(
int cpu)
51 idle_time = get_cpu_idle_time_us(cpu,
NULL);
53 if (idle_time == -1ULL)
62 static u64 get_iowait_time(
int cpu)
64 u64 iowait, iowait_time = -1ULL;
67 iowait_time = get_cpu_iowait_time_us(cpu,
NULL);
69 if (iowait_time == -1ULL)
80 static int show_stat(
struct seq_file *
p,
void *
v)
85 u64 guest, guest_nice;
91 user = nice = system = idle = iowait =
92 irq = softirq = steal = 0;
93 guest = guest_nice = 0;
95 jif = boottime.tv_sec;
101 idle += get_idle_time(i);
102 iowait += get_iowait_time(i);
108 sum += kstat_cpu_irqs_sum(i);
112 unsigned int softirq_stat = kstat_softirqs_cpu(j, i);
114 per_softirq_sums[
j] += softirq_stat;
115 sum_softirq += softirq_stat;
138 idle = get_idle_time(i);
139 iowait = get_iowait_time(i);
158 seq_printf(p,
"intr %llu", (
unsigned long long)sum);
168 "procs_running %lu\
n"
169 "procs_blocked %lu\
n",
176 seq_printf(p, "softirq %
llu", (
unsigned long long)sum_softirq);
204 m = file->private_data;
219 static int __init proc_stat_init(
void)
221 proc_create(
"stat", 0,
NULL, &proc_stat_operations);