softirqs.c 741 Bytes
Newer Older
1
// SPDX-License-Identifier: GPL-2.0
2 3 4 5 6 7 8 9 10 11 12 13
#include <linux/init.h>
#include <linux/kernel_stat.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>

/*
 * /proc/softirqs  ... display the number of softirqs
 */
static int show_softirqs(struct seq_file *p, void *v)
{
	int i, j;

14
	seq_puts(p, "                    ");
15 16
	for_each_possible_cpu(i)
		seq_printf(p, "CPU%-8d", i);
17
	seq_putc(p, '\n');
18 19

	for (i = 0; i < NR_SOFTIRQS; i++) {
20
		seq_printf(p, "%12s:", softirq_to_name[i]);
21 22
		for_each_possible_cpu(j)
			seq_printf(p, " %10u", kstat_softirqs_cpu(i, j));
23
		seq_putc(p, '\n');
24 25 26 27 28 29
	}
	return 0;
}

static int __init proc_softirqs_init(void)
{
30
	proc_create_single("softirqs", 0, NULL, show_softirqs);
31 32
	return 0;
}
33
fs_initcall(proc_softirqs_init);