Blame view
include/linux/kernel_stat.h
3.08 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 |
#ifndef _LINUX_KERNEL_STAT_H #define _LINUX_KERNEL_STAT_H |
1da177e4c Linux-2.6.12-rc2 |
3 4 5 |
#include <linux/smp.h> #include <linux/threads.h> #include <linux/percpu.h> |
28ef35845 [PATCH] small ker... |
6 |
#include <linux/cpumask.h> |
aa0ce5bbc softirq: introduc... |
7 |
#include <linux/interrupt.h> |
3292beb34 sched/accounting:... |
8 |
#include <linux/sched.h> |
6859a8402 x86: resize NR_IR... |
9 |
#include <asm/irq.h> |
1da177e4c Linux-2.6.12-rc2 |
10 11 12 13 14 15 16 |
#include <asm/cputime.h> /* * 'kernel_stat.h' contains the definitions needed for doing * some kernel statistics (CPU usage, context switches ...), * used by rstatd/perfmeter */ |
3292beb34 sched/accounting:... |
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
enum cpu_usage_stat { CPUTIME_USER, CPUTIME_NICE, CPUTIME_SYSTEM, CPUTIME_SOFTIRQ, CPUTIME_IRQ, CPUTIME_IDLE, CPUTIME_IOWAIT, CPUTIME_STEAL, CPUTIME_GUEST, CPUTIME_GUEST_NICE, NR_STATS, }; struct kernel_cpustat { u64 cpustat[NR_STATS]; |
1da177e4c Linux-2.6.12-rc2 |
33 34 35 |
}; struct kernel_stat { |
d7e51e668 sparseirq: make s... |
36 |
#ifndef CONFIG_GENERIC_HARDIRQS |
0b8f1efad sparse irq_desc[]... |
37 38 |
unsigned int irqs[NR_IRQS]; #endif |
f2c66cd8e /proc/stat: scala... |
39 |
unsigned long irqs_sum; |
aa0ce5bbc softirq: introduc... |
40 |
unsigned int softirqs[NR_SOFTIRQS]; |
1da177e4c Linux-2.6.12-rc2 |
41 42 43 |
}; DECLARE_PER_CPU(struct kernel_stat, kstat); |
3292beb34 sched/accounting:... |
44 |
DECLARE_PER_CPU(struct kernel_cpustat, kernel_cpustat); |
1da177e4c Linux-2.6.12-rc2 |
45 |
|
1da177e4c Linux-2.6.12-rc2 |
46 |
/* Must have preemption disabled for this to be meaningful. */ |
3292beb34 sched/accounting:... |
47 48 49 50 |
#define kstat_this_cpu (&__get_cpu_var(kstat)) #define kcpustat_this_cpu (&__get_cpu_var(kernel_cpustat)) #define kstat_cpu(cpu) per_cpu(kstat, cpu) #define kcpustat_cpu(cpu) per_cpu(kernel_cpustat, cpu) |
1da177e4c Linux-2.6.12-rc2 |
51 52 |
extern unsigned long long nr_context_switches(void); |
d7e51e668 sparseirq: make s... |
53 |
#ifndef CONFIG_GENERIC_HARDIRQS |
0b8f1efad sparse irq_desc[]... |
54 |
|
d6c88a507 genirq: revert dy... |
55 |
struct irq_desc; |
8c464a4b2 sparseirq: move k... |
56 |
|
d6c88a507 genirq: revert dy... |
57 58 59 |
static inline void kstat_incr_irqs_this_cpu(unsigned int irq, struct irq_desc *desc) { |
6c9ae009b irq: use per_cpu ... |
60 61 |
__this_cpu_inc(kstat.irqs[irq]); __this_cpu_inc(kstat.irqs_sum); |
d6c88a507 genirq: revert dy... |
62 |
} |
8c464a4b2 sparseirq: move k... |
63 |
|
7f95ec9e4 x86: move kstat_i... |
64 65 66 67 |
static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) { return kstat_cpu(cpu).irqs[irq]; } |
0b8f1efad sparse irq_desc[]... |
68 |
#else |
d52a61c04 irq: clean up irq... |
69 |
#include <linux/irq.h> |
0b8f1efad sparse irq_desc[]... |
70 |
extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu); |
6c9ae009b irq: use per_cpu ... |
71 72 73 74 75 76 |
#define kstat_incr_irqs_this_cpu(irqno, DESC) \ do { \ __this_cpu_inc(*(DESC)->kstat_irqs); \ __this_cpu_inc(kstat.irqs_sum); \ } while (0) |
d52a61c04 irq: clean up irq... |
77 |
|
0b8f1efad sparse irq_desc[]... |
78 |
#endif |
7f95ec9e4 x86: move kstat_i... |
79 |
|
aa0ce5bbc softirq: introduc... |
80 81 |
static inline void kstat_incr_softirqs_this_cpu(unsigned int irq) { |
6c9ae009b irq: use per_cpu ... |
82 |
__this_cpu_inc(kstat.softirqs[irq]); |
aa0ce5bbc softirq: introduc... |
83 84 85 86 87 88 |
} static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu) { return kstat_cpu(cpu).softirqs[irq]; } |
1da177e4c Linux-2.6.12-rc2 |
89 90 91 |
/* * Number of interrupts per specific IRQ source, since bootup */ |
478735e38 /proc/stat: fix s... |
92 |
#ifndef CONFIG_GENERIC_HARDIRQS |
7f95ec9e4 x86: move kstat_i... |
93 |
static inline unsigned int kstat_irqs(unsigned int irq) |
1da177e4c Linux-2.6.12-rc2 |
94 |
{ |
7f95ec9e4 x86: move kstat_i... |
95 96 |
unsigned int sum = 0; int cpu; |
1da177e4c Linux-2.6.12-rc2 |
97 |
|
0a9450227 [PATCH] for_each_... |
98 |
for_each_possible_cpu(cpu) |
7f95ec9e4 x86: move kstat_i... |
99 |
sum += kstat_irqs_cpu(irq, cpu); |
1da177e4c Linux-2.6.12-rc2 |
100 101 102 |
return sum; } |
478735e38 /proc/stat: fix s... |
103 104 105 |
#else extern unsigned int kstat_irqs(unsigned int irq); #endif |
1da177e4c Linux-2.6.12-rc2 |
106 |
|
f2c66cd8e /proc/stat: scala... |
107 108 109 110 111 112 113 |
/* * Number of interrupts per cpu, since bootup */ static inline unsigned int kstat_cpu_irqs_sum(unsigned int cpu) { return kstat_cpu(cpu).irqs_sum; } |
aa9c4c0f9 perfcounters: fix... |
114 115 116 117 |
/* * Lock/unlock the current runqueue - to extract task statistics: */ |
bb34d92f6 timers: fix itime... |
118 |
extern unsigned long long task_delta_exec(struct task_struct *); |
aa9c4c0f9 perfcounters: fix... |
119 |
|
457533a7d [PATCH] fix scale... |
120 121 |
extern void account_user_time(struct task_struct *, cputime_t, cputime_t); extern void account_system_time(struct task_struct *, int, cputime_t, cputime_t); |
79741dd35 [PATCH] idle cput... |
122 123 124 125 126 127 |
extern void account_steal_time(cputime_t); extern void account_idle_time(cputime_t); extern void account_process_tick(struct task_struct *, int user); extern void account_steal_ticks(unsigned long ticks); extern void account_idle_ticks(unsigned long ticks); |
1da177e4c Linux-2.6.12-rc2 |
128 129 |
#endif /* _LINUX_KERNEL_STAT_H */ |