diff options
Diffstat (limited to 'include/linux/kernel_stat.h')
| -rw-r--r-- | include/linux/kernel_stat.h | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index 0cce2db580c3..2fbd9053c2df 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include <linux/percpu.h> | 6 | #include <linux/percpu.h> |
| 7 | #include <linux/cpumask.h> | 7 | #include <linux/cpumask.h> |
| 8 | #include <linux/interrupt.h> | 8 | #include <linux/interrupt.h> |
| 9 | #include <linux/sched.h> | ||
| 9 | #include <asm/irq.h> | 10 | #include <asm/irq.h> |
| 10 | #include <asm/cputime.h> | 11 | #include <asm/cputime.h> |
| 11 | 12 | ||
| @@ -15,21 +16,25 @@ | |||
| 15 | * used by rstatd/perfmeter | 16 | * used by rstatd/perfmeter |
| 16 | */ | 17 | */ |
| 17 | 18 | ||
| 18 | struct cpu_usage_stat { | 19 | enum cpu_usage_stat { |
| 19 | cputime64_t user; | 20 | CPUTIME_USER, |
| 20 | cputime64_t nice; | 21 | CPUTIME_NICE, |
| 21 | cputime64_t system; | 22 | CPUTIME_SYSTEM, |
| 22 | cputime64_t softirq; | 23 | CPUTIME_SOFTIRQ, |
| 23 | cputime64_t irq; | 24 | CPUTIME_IRQ, |
| 24 | cputime64_t idle; | 25 | CPUTIME_IDLE, |
| 25 | cputime64_t iowait; | 26 | CPUTIME_IOWAIT, |
| 26 | cputime64_t steal; | 27 | CPUTIME_STEAL, |
| 27 | cputime64_t guest; | 28 | CPUTIME_GUEST, |
| 28 | cputime64_t guest_nice; | 29 | CPUTIME_GUEST_NICE, |
| 30 | NR_STATS, | ||
| 31 | }; | ||
| 32 | |||
| 33 | struct kernel_cpustat { | ||
| 34 | u64 cpustat[NR_STATS]; | ||
| 29 | }; | 35 | }; |
| 30 | 36 | ||
| 31 | struct kernel_stat { | 37 | struct kernel_stat { |
| 32 | struct cpu_usage_stat cpustat; | ||
| 33 | #ifndef CONFIG_GENERIC_HARDIRQS | 38 | #ifndef CONFIG_GENERIC_HARDIRQS |
| 34 | unsigned int irqs[NR_IRQS]; | 39 | unsigned int irqs[NR_IRQS]; |
| 35 | #endif | 40 | #endif |
| @@ -38,10 +43,13 @@ struct kernel_stat { | |||
| 38 | }; | 43 | }; |
| 39 | 44 | ||
| 40 | DECLARE_PER_CPU(struct kernel_stat, kstat); | 45 | DECLARE_PER_CPU(struct kernel_stat, kstat); |
| 46 | DECLARE_PER_CPU(struct kernel_cpustat, kernel_cpustat); | ||
| 41 | 47 | ||
| 42 | #define kstat_cpu(cpu) per_cpu(kstat, cpu) | ||
| 43 | /* Must have preemption disabled for this to be meaningful. */ | 48 | /* Must have preemption disabled for this to be meaningful. */ |
| 44 | #define kstat_this_cpu __get_cpu_var(kstat) | 49 | #define kstat_this_cpu (&__get_cpu_var(kstat)) |
| 50 | #define kcpustat_this_cpu (&__get_cpu_var(kernel_cpustat)) | ||
| 51 | #define kstat_cpu(cpu) per_cpu(kstat, cpu) | ||
| 52 | #define kcpustat_cpu(cpu) per_cpu(kernel_cpustat, cpu) | ||
| 45 | 53 | ||
| 46 | extern unsigned long long nr_context_switches(void); | 54 | extern unsigned long long nr_context_switches(void); |
| 47 | 55 | ||
