include/linux/kernel_stat.h
15018 #ifndef _LINUX_KERNEL_STAT_H
15019 #define _LINUX_KERNEL_STAT_H
15020
15021 #include <asm/irq.h>
15022 #include <linux/smp.h>
15023 #include <linux/tasks.h>
15024
15025 /* 'kernel_stat.h' contains the definitions needed for
15026 * doing some kernel statistics (CPU usage, context
15027 * switches ...), used by rstatd/perfmeter */
15028
15029 #define DK_NDRIVE 4
15030
15031 struct kernel_stat {
15032 unsigned int cpu_user, cpu_nice, cpu_system;
15033 unsigned int per_cpu_user[NR_CPUS],
15034 per_cpu_nice[NR_CPUS],
15035 per_cpu_system[NR_CPUS];
15036 unsigned int dk_drive[DK_NDRIVE];
15037 unsigned int dk_drive_rio[DK_NDRIVE];
15038 unsigned int dk_drive_wio[DK_NDRIVE];
15039 unsigned int dk_drive_rblk[DK_NDRIVE];
15040 unsigned int dk_drive_wblk[DK_NDRIVE];
15041 unsigned int pgpgin, pgpgout;
15042 unsigned int pswpin, pswpout;
15043 unsigned int irqs[NR_CPUS][NR_IRQS];
15044 unsigned int ipackets, opackets;
15045 unsigned int ierrors, oerrors;
15046 unsigned int collisions;
15047 unsigned int context_swtch;
15048 };
15049
15050 extern struct kernel_stat kstat;
15051
15052 /* # of interrupts per specific IRQ src, since bootup */
15053 extern inline int kstat_irqs (int irq)
15054 {
15055 int i, sum=0;
15056
15057 for (i = 0 ; i < smp_num_cpus ; i++)
15058 sum += kstat.irqs[cpu_logical_map(i)][irq];
15059
15060 return sum;
15061 }
15062
15063 #endif /* _LINUX_KERNEL_STAT_H */
Сайт управляется системой
uCoz