Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Keika Kobayashi | d3d64df | 2009-06-17 16:25:55 -0700 | [diff] [blame] | 2 | #include <linux/init.h> |
| 3 | #include <linux/kernel_stat.h> |
| 4 | #include <linux/proc_fs.h> |
| 5 | #include <linux/seq_file.h> |
| 6 | |
| 7 | /* |
| 8 | * /proc/softirqs ... display the number of softirqs |
| 9 | */ |
| 10 | static int show_softirqs(struct seq_file *p, void *v) |
| 11 | { |
| 12 | int i, j; |
| 13 | |
Alexey Dobriyan | 9d6de12 | 2011-01-12 17:00:32 -0800 | [diff] [blame] | 14 | seq_puts(p, " "); |
Keika Kobayashi | d3d64df | 2009-06-17 16:25:55 -0700 | [diff] [blame] | 15 | for_each_possible_cpu(i) |
| 16 | seq_printf(p, "CPU%-8d", i); |
Alexey Dobriyan | 9d6de12 | 2011-01-12 17:00:32 -0800 | [diff] [blame] | 17 | seq_putc(p, '\n'); |
Keika Kobayashi | d3d64df | 2009-06-17 16:25:55 -0700 | [diff] [blame] | 18 | |
| 19 | for (i = 0; i < NR_SOFTIRQS; i++) { |
Davidlohr Bueso | 19cd56c | 2010-10-27 15:34:12 -0700 | [diff] [blame] | 20 | seq_printf(p, "%12s:", softirq_to_name[i]); |
Keika Kobayashi | d3d64df | 2009-06-17 16:25:55 -0700 | [diff] [blame] | 21 | for_each_possible_cpu(j) |
| 22 | seq_printf(p, " %10u", kstat_softirqs_cpu(i, j)); |
Alexey Dobriyan | 9d6de12 | 2011-01-12 17:00:32 -0800 | [diff] [blame] | 23 | seq_putc(p, '\n'); |
Keika Kobayashi | d3d64df | 2009-06-17 16:25:55 -0700 | [diff] [blame] | 24 | } |
| 25 | return 0; |
| 26 | } |
| 27 | |
Keika Kobayashi | d3d64df | 2009-06-17 16:25:55 -0700 | [diff] [blame] | 28 | static int __init proc_softirqs_init(void) |
| 29 | { |
Christoph Hellwig | 3f3942a | 2018-05-15 15:57:23 +0200 | [diff] [blame] | 30 | proc_create_single("softirqs", 0, NULL, show_softirqs); |
Keika Kobayashi | d3d64df | 2009-06-17 16:25:55 -0700 | [diff] [blame] | 31 | return 0; |
| 32 | } |
Paul Gortmaker | abaf378 | 2014-01-23 15:55:45 -0800 | [diff] [blame] | 33 | fs_initcall(proc_softirqs_init); |