How /proc/interrupts gets updated?

来源:互联网 发布:淘宝主图 500k 编辑:程序博客网 时间:2024/05/22 00:30

As you can see in the source of the kernel, it displays all possible irqs of the system. In source/fs/proc/interrupts.c we can see that /proc/interrupts has as many lines as interrupts exist in the system. In source/kernel/irq/proc.c we can see that the counters of every interrupt gets extracted from global counters via kstat_irqs_cpu(irq, cpu). So the information gets updated in different counters, one for each cpu and the get summed upon reading the proc file. More info about per-cpu variables you can read here. More about interrupts in linux you can get here.(get from http://stackoverflow.com/questions/15217793/how-proc-interrupts-gets-updated)


通过该函数得到,特定CPU上irq中断触发的中断数(*kstat_irqs)


kstat_irqs是中断irq描述符中定义的percpu的指针变量,表示中断特定irq触发的次数

当在控制台中执行"cat /proc/interrupts"时,将执行lfs_linux\kernel\irq\proc.c:show_interrupts函数


root@lrc:~# cat /proc/interrupts 

           CPU0       CPU1       CPU2       CPU3       
 29:          0          0               0             0          GIC  arch_timer
 30:       7294       6561       6554          6547      GIC  arch_timer
 56:          0           0             0              0          GIC  a15-l1l2-ecc-err-irq
 80:       7219         0             0              0          GIC  hwqueue-8704
 86:         48          0             0              0          GIC  hwqueue-8710

0 0