Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 #include <linux/init.h>
0003 #include <linux/kernel_stat.h>
0004 #include <linux/proc_fs.h>
0005 #include <linux/seq_file.h>
0006 
0007 /*
0008  * /proc/softirqs  ... display the number of softirqs
0009  */
0010 static int show_softirqs(struct seq_file *p, void *v)
0011 {
0012     int i, j;
0013 
0014     seq_puts(p, "                    ");
0015     for_each_possible_cpu(i)
0016         seq_printf(p, "CPU%-8d", i);
0017     seq_putc(p, '\n');
0018 
0019     for (i = 0; i < NR_SOFTIRQS; i++) {
0020         seq_printf(p, "%12s:", softirq_to_name[i]);
0021         for_each_possible_cpu(j)
0022             seq_printf(p, " %10u", kstat_softirqs_cpu(i, j));
0023         seq_putc(p, '\n');
0024     }
0025     return 0;
0026 }
0027 
0028 static int __init proc_softirqs_init(void)
0029 {
0030     proc_create_single("softirqs", 0, NULL, show_softirqs);
0031     return 0;
0032 }
0033 fs_initcall(proc_softirqs_init);