diff options
Diffstat (limited to 'fs/proc/stat.c')
-rw-r--r-- | fs/proc/stat.c | 63 |
1 files changed, 29 insertions, 34 deletions
diff --git a/fs/proc/stat.c b/fs/proc/stat.c index 42b274da92c3..8a6ab666e9f8 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c | |||
@@ -22,29 +22,27 @@ | |||
22 | #define arch_idle_time(cpu) 0 | 22 | #define arch_idle_time(cpu) 0 |
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | static cputime64_t get_idle_time(int cpu) | 25 | static u64 get_idle_time(int cpu) |
26 | { | 26 | { |
27 | u64 idle_time = get_cpu_idle_time_us(cpu, NULL); | 27 | u64 idle, idle_time = get_cpu_idle_time_us(cpu, NULL); |
28 | cputime64_t idle; | ||
29 | 28 | ||
30 | if (idle_time == -1ULL) { | 29 | if (idle_time == -1ULL) { |
31 | /* !NO_HZ so we can rely on cpustat.idle */ | 30 | /* !NO_HZ so we can rely on cpustat.idle */ |
32 | idle = kstat_cpu(cpu).cpustat.idle; | 31 | idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE]; |
33 | idle = cputime64_add(idle, arch_idle_time(cpu)); | 32 | idle += arch_idle_time(cpu); |
34 | } else | 33 | } else |
35 | idle = usecs_to_cputime(idle_time); | 34 | idle = usecs_to_cputime(idle_time); |
36 | 35 | ||
37 | return idle; | 36 | return idle; |
38 | } | 37 | } |
39 | 38 | ||
40 | static cputime64_t get_iowait_time(int cpu) | 39 | static u64 get_iowait_time(int cpu) |
41 | { | 40 | { |
42 | u64 iowait_time = get_cpu_iowait_time_us(cpu, NULL); | 41 | u64 iowait, iowait_time = get_cpu_iowait_time_us(cpu, NULL); |
43 | cputime64_t iowait; | ||
44 | 42 | ||
45 | if (iowait_time == -1ULL) | 43 | if (iowait_time == -1ULL) |
46 | /* !NO_HZ so we can rely on cpustat.iowait */ | 44 | /* !NO_HZ so we can rely on cpustat.iowait */ |
47 | iowait = kstat_cpu(cpu).cpustat.iowait; | 45 | iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT]; |
48 | else | 46 | else |
49 | iowait = usecs_to_cputime(iowait_time); | 47 | iowait = usecs_to_cputime(iowait_time); |
50 | 48 | ||
@@ -55,33 +53,30 @@ static int show_stat(struct seq_file *p, void *v) | |||
55 | { | 53 | { |
56 | int i, j; | 54 | int i, j; |
57 | unsigned long jif; | 55 | unsigned long jif; |
58 | cputime64_t user, nice, system, idle, iowait, irq, softirq, steal; | 56 | u64 user, nice, system, idle, iowait, irq, softirq, steal; |
59 | cputime64_t guest, guest_nice; | 57 | u64 guest, guest_nice; |
60 | u64 sum = 0; | 58 | u64 sum = 0; |
61 | u64 sum_softirq = 0; | 59 | u64 sum_softirq = 0; |
62 | unsigned int per_softirq_sums[NR_SOFTIRQS] = {0}; | 60 | unsigned int per_softirq_sums[NR_SOFTIRQS] = {0}; |
63 | struct timespec boottime; | 61 | struct timespec boottime; |
64 | 62 | ||
65 | user = nice = system = idle = iowait = | 63 | user = nice = system = idle = iowait = |
66 | irq = softirq = steal = cputime64_zero; | 64 | irq = softirq = steal = 0; |
67 | guest = guest_nice = cputime64_zero; | 65 | guest = guest_nice = 0; |
68 | getboottime(&boottime); | 66 | getboottime(&boottime); |
69 | jif = boottime.tv_sec; | 67 | jif = boottime.tv_sec; |
70 | 68 | ||
71 | for_each_possible_cpu(i) { | 69 | for_each_possible_cpu(i) { |
72 | user = cputime64_add(user, kstat_cpu(i).cpustat.user); | 70 | user += kcpustat_cpu(i).cpustat[CPUTIME_USER]; |
73 | nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice); | 71 | nice += kcpustat_cpu(i).cpustat[CPUTIME_NICE]; |
74 | system = cputime64_add(system, kstat_cpu(i).cpustat.system); | 72 | system += kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM]; |
75 | idle = cputime64_add(idle, get_idle_time(i)); | 73 | idle += get_idle_time(i); |
76 | iowait = cputime64_add(iowait, get_iowait_time(i)); | 74 | iowait += get_iowait_time(i); |
77 | irq = cputime64_add(irq, kstat_cpu(i).cpustat.irq); | 75 | irq += kcpustat_cpu(i).cpustat[CPUTIME_IRQ]; |
78 | softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq); | 76 | softirq += kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]; |
79 | steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal); | 77 | steal += kcpustat_cpu(i).cpustat[CPUTIME_STEAL]; |
80 | guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest); | 78 | guest += kcpustat_cpu(i).cpustat[CPUTIME_GUEST]; |
81 | guest_nice = cputime64_add(guest_nice, | 79 | guest_nice += kcpustat_cpu(i).cpustat[CPUTIME_GUEST_NICE]; |
82 | kstat_cpu(i).cpustat.guest_nice); | ||
83 | sum += kstat_cpu_irqs_sum(i); | ||
84 | sum += arch_irq_stat_cpu(i); | ||
85 | 80 | ||
86 | for (j = 0; j < NR_SOFTIRQS; j++) { | 81 | for (j = 0; j < NR_SOFTIRQS; j++) { |
87 | unsigned int softirq_stat = kstat_softirqs_cpu(j, i); | 82 | unsigned int softirq_stat = kstat_softirqs_cpu(j, i); |
@@ -106,16 +101,16 @@ static int show_stat(struct seq_file *p, void *v) | |||
106 | (unsigned long long)cputime64_to_clock_t(guest_nice)); | 101 | (unsigned long long)cputime64_to_clock_t(guest_nice)); |
107 | for_each_online_cpu(i) { | 102 | for_each_online_cpu(i) { |
108 | /* Copy values here to work around gcc-2.95.3, gcc-2.96 */ | 103 | /* Copy values here to work around gcc-2.95.3, gcc-2.96 */ |
109 | user = kstat_cpu(i).cpustat.user; | 104 | user = kcpustat_cpu(i).cpustat[CPUTIME_USER]; |
110 | nice = kstat_cpu(i).cpustat.nice; | 105 | nice = kcpustat_cpu(i).cpustat[CPUTIME_NICE]; |
111 | system = kstat_cpu(i).cpustat.system; | 106 | system = kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM]; |
112 | idle = get_idle_time(i); | 107 | idle = get_idle_time(i); |
113 | iowait = get_iowait_time(i); | 108 | iowait = get_iowait_time(i); |
114 | irq = kstat_cpu(i).cpustat.irq; | 109 | irq = kcpustat_cpu(i).cpustat[CPUTIME_IRQ]; |
115 | softirq = kstat_cpu(i).cpustat.softirq; | 110 | softirq = kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]; |
116 | steal = kstat_cpu(i).cpustat.steal; | 111 | steal = kcpustat_cpu(i).cpustat[CPUTIME_STEAL]; |
117 | guest = kstat_cpu(i).cpustat.guest; | 112 | guest = kcpustat_cpu(i).cpustat[CPUTIME_GUEST]; |
118 | guest_nice = kstat_cpu(i).cpustat.guest_nice; | 113 | guest_nice = kcpustat_cpu(i).cpustat[CPUTIME_GUEST_NICE]; |
119 | seq_printf(p, | 114 | seq_printf(p, |
120 | "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu " | 115 | "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu " |
121 | "%llu\n", | 116 | "%llu\n", |