source: svn/trunk/newcon3bcm2_21bu/toolchain/mips-linux-uclibc/include/linux/kernel_stat.h

Last change on this file was 2, checked in by jglee, 11 years ago

first commit

  • Property svn:executable set to *
File size: 1014 bytes
Line 
1#ifndef _LINUX_KERNEL_STAT_H
2#define _LINUX_KERNEL_STAT_H
3
4#include <asm/irq.h>
5#include <linux/smp.h>
6#include <linux/threads.h>
7
8/*
9 * 'kernel_stat.h' contains the definitions needed for doing
10 * some kernel statistics (CPU usage, context switches ...),
11 * used by rstatd/perfmeter
12 */
13
14struct cpu_usage_stat {
15        __u64 user;
16        __u64 nice;
17        __u64 system;
18        __u64 softirq;
19        __u64 irq;
20        __u64 idle;
21        __u64 iowait;
22};
23
24struct kernel_stat {
25        struct cpu_usage_stat   cpustat;
26        unsigned int irqs[NR_IRQS];
27};
28
29DECLARE_PER_CPU(struct kernel_stat, kstat);
30
31#define kstat_cpu(cpu)  per_cpu(kstat, cpu)
32/* Must have preemption disabled for this to be meaningful. */
33#define kstat_this_cpu  __get_cpu_var(kstat)
34
35extern unsigned long long nr_context_switches(void);
36
37/*
38 * Number of interrupts per specific IRQ source, since bootup
39 */
40static inline int kstat_irqs(int irq)
41{
42        int i, sum=0;
43
44        for (i = 0; i < NR_CPUS; i++)
45                if (cpu_possible(i))
46                        sum += kstat_cpu(i).irqs[irq];
47
48        return sum;
49}
50
51#endif /* _LINUX_KERNEL_STAT_H */
Note: See TracBrowser for help on using the repository browser.