stat.c (59a32e2ce5eb809967cac4e718bc527beca83c59) | stat.c (1ac101a5d675aca2426c5cd460c73fb95acb8391) |
---|---|
1#include <linux/cpumask.h> 2#include <linux/fs.h> 3#include <linux/init.h> 4#include <linux/interrupt.h> 5#include <linux/kernel_stat.h> 6#include <linux/proc_fs.h> 7#include <linux/sched.h> 8#include <linux/seq_file.h> --- 75 unchanged lines hidden (view full) --- 84 unsigned int softirq_stat = kstat_softirqs_cpu(j, i); 85 86 per_softirq_sums[j] += softirq_stat; 87 sum_softirq += softirq_stat; 88 } 89 } 90 sum += arch_irq_stat(); 91 | 1#include <linux/cpumask.h> 2#include <linux/fs.h> 3#include <linux/init.h> 4#include <linux/interrupt.h> 5#include <linux/kernel_stat.h> 6#include <linux/proc_fs.h> 7#include <linux/sched.h> 8#include <linux/seq_file.h> --- 75 unchanged lines hidden (view full) --- 84 unsigned int softirq_stat = kstat_softirqs_cpu(j, i); 85 86 per_softirq_sums[j] += softirq_stat; 87 sum_softirq += softirq_stat; 88 } 89 } 90 sum += arch_irq_stat(); 91 |
92 seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu " 93 "%llu\n", 94 (unsigned long long)cputime64_to_clock_t(user), 95 (unsigned long long)cputime64_to_clock_t(nice), 96 (unsigned long long)cputime64_to_clock_t(system), 97 (unsigned long long)cputime64_to_clock_t(idle), 98 (unsigned long long)cputime64_to_clock_t(iowait), 99 (unsigned long long)cputime64_to_clock_t(irq), 100 (unsigned long long)cputime64_to_clock_t(softirq), 101 (unsigned long long)cputime64_to_clock_t(steal), 102 (unsigned long long)cputime64_to_clock_t(guest), 103 (unsigned long long)cputime64_to_clock_t(guest_nice)); | 92 seq_puts(p, "cpu "); 93 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(user)); 94 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(nice)); 95 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(system)); 96 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(idle)); 97 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(iowait)); 98 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(irq)); 99 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(softirq)); 100 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(steal)); 101 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(guest)); 102 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(guest_nice)); 103 seq_putc(p, '\n'); 104 |
104 for_each_online_cpu(i) { 105 /* Copy values here to work around gcc-2.95.3, gcc-2.96 */ 106 user = kcpustat_cpu(i).cpustat[CPUTIME_USER]; 107 nice = kcpustat_cpu(i).cpustat[CPUTIME_NICE]; 108 system = kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM]; 109 idle = get_idle_time(i); 110 iowait = get_iowait_time(i); 111 irq = kcpustat_cpu(i).cpustat[CPUTIME_IRQ]; 112 softirq = kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]; 113 steal = kcpustat_cpu(i).cpustat[CPUTIME_STEAL]; 114 guest = kcpustat_cpu(i).cpustat[CPUTIME_GUEST]; 115 guest_nice = kcpustat_cpu(i).cpustat[CPUTIME_GUEST_NICE]; | 105 for_each_online_cpu(i) { 106 /* Copy values here to work around gcc-2.95.3, gcc-2.96 */ 107 user = kcpustat_cpu(i).cpustat[CPUTIME_USER]; 108 nice = kcpustat_cpu(i).cpustat[CPUTIME_NICE]; 109 system = kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM]; 110 idle = get_idle_time(i); 111 iowait = get_iowait_time(i); 112 irq = kcpustat_cpu(i).cpustat[CPUTIME_IRQ]; 113 softirq = kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]; 114 steal = kcpustat_cpu(i).cpustat[CPUTIME_STEAL]; 115 guest = kcpustat_cpu(i).cpustat[CPUTIME_GUEST]; 116 guest_nice = kcpustat_cpu(i).cpustat[CPUTIME_GUEST_NICE]; |
116 seq_printf(p, 117 "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu " 118 "%llu\n", 119 i, 120 (unsigned long long)cputime64_to_clock_t(user), 121 (unsigned long long)cputime64_to_clock_t(nice), 122 (unsigned long long)cputime64_to_clock_t(system), 123 (unsigned long long)cputime64_to_clock_t(idle), 124 (unsigned long long)cputime64_to_clock_t(iowait), 125 (unsigned long long)cputime64_to_clock_t(irq), 126 (unsigned long long)cputime64_to_clock_t(softirq), 127 (unsigned long long)cputime64_to_clock_t(steal), 128 (unsigned long long)cputime64_to_clock_t(guest), 129 (unsigned long long)cputime64_to_clock_t(guest_nice)); | 117 seq_printf(p, "cpu%d", i); 118 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(user)); 119 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(nice)); 120 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(system)); 121 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(idle)); 122 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(iowait)); 123 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(irq)); 124 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(softirq)); 125 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(steal)); 126 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(guest)); 127 seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(guest_nice)); 128 seq_putc(p, '\n'); |
130 } 131 seq_printf(p, "intr %llu", (unsigned long long)sum); 132 133 /* sum again ? it could be updated? */ 134 for_each_irq_nr(j) | 129 } 130 seq_printf(p, "intr %llu", (unsigned long long)sum); 131 132 /* sum again ? it could be updated? */ 133 for_each_irq_nr(j) |
135 seq_printf(p, " %u", kstat_irqs(j)); | 134 seq_put_decimal_ull(p, ' ', kstat_irqs(j)); |
136 137 seq_printf(p, 138 "\nctxt %llu\n" 139 "btime %lu\n" 140 "processes %lu\n" 141 "procs_running %lu\n" 142 "procs_blocked %lu\n", 143 nr_context_switches(), 144 (unsigned long)jif, 145 total_forks, 146 nr_running(), 147 nr_iowait()); 148 149 seq_printf(p, "softirq %llu", (unsigned long long)sum_softirq); 150 151 for (i = 0; i < NR_SOFTIRQS; i++) | 135 136 seq_printf(p, 137 "\nctxt %llu\n" 138 "btime %lu\n" 139 "processes %lu\n" 140 "procs_running %lu\n" 141 "procs_blocked %lu\n", 142 nr_context_switches(), 143 (unsigned long)jif, 144 total_forks, 145 nr_running(), 146 nr_iowait()); 147 148 seq_printf(p, "softirq %llu", (unsigned long long)sum_softirq); 149 150 for (i = 0; i < NR_SOFTIRQS; i++) |
152 seq_printf(p, " %u", per_softirq_sums[i]); | 151 seq_put_decimal_ull(p, ' ', per_softirq_sums[i]); |
153 seq_putc(p, '\n'); 154 155 return 0; 156} 157 158static int stat_open(struct inode *inode, struct file *file) 159{ 160 unsigned size = 1024 + 128 * num_possible_cpus(); --- 37 unchanged lines hidden --- | 152 seq_putc(p, '\n'); 153 154 return 0; 155} 156 157static int stat_open(struct inode *inode, struct file *file) 158{ 159 unsigned size = 1024 + 128 * num_possible_cpus(); --- 37 unchanged lines hidden --- |