]>
Commit | Line | Data |
---|---|---|
02f2919e KZ |
1 | #ifndef UTIL_LINUX_H_IRQ_COMMON |
2 | #define UTIL_LINUX_H_IRQ_COMMON | |
94e7e258 | 3 | |
02f2919e KZ |
4 | #include "c.h" |
5 | #include "nls.h" | |
6 | ||
7 | /* supported columns */ | |
94e7e258 | 8 | enum { |
02f2919e | 9 | COL_IRQ = 0, |
94e7e258 KZ |
10 | COL_TOTAL, |
11 | COL_DELTA, | |
12 | COL_NAME, | |
13 | ||
14 | __COL_COUNT | |
15 | }; | |
16 | ||
17 | struct irq_info { | |
18 | char *irq; /* short name of this irq */ | |
19 | char *name; /* descriptive name of this irq */ | |
20 | unsigned long total; /* total count since system start up */ | |
21 | unsigned long delta; /* delta count since previous update */ | |
22 | }; | |
23 | ||
77f57b90 | 24 | |
94e7e258 KZ |
25 | struct irq_stat { |
26 | unsigned int nr_irq; /* number of irq vector */ | |
27 | unsigned int nr_irq_info; /* number of irq info */ | |
28 | struct irq_info *irq_info; /* array of irq_info */ | |
29 | long nr_active_cpu; /* number of active cpu */ | |
30 | unsigned long total_irq; /* total irqs */ | |
31 | unsigned long delta_irq; /* delta irqs */ | |
32 | }; | |
33 | ||
44e39c99 | 34 | typedef int (irq_cmp_t)(const struct irq_info *, const struct irq_info *); |
94e7e258 | 35 | |
02f2919e | 36 | /* output definition */ |
94e7e258 KZ |
37 | struct irq_output { |
38 | int columns[__COL_COUNT * 2]; | |
39 | size_t ncolumns; | |
40 | ||
44e39c99 | 41 | irq_cmp_t *sort_cmp_func; |
94e7e258 KZ |
42 | |
43 | unsigned int | |
5a20c0de KZ |
44 | json:1, /* JSON output */ |
45 | pairs:1, /* export, NAME="value" aoutput */ | |
46 | no_headings:1; /* don't print header */ | |
94e7e258 KZ |
47 | }; |
48 | ||
49 | int irq_column_name_to_id(char const *const name, size_t const namesz); | |
77f57b90 | 50 | void free_irqstat(struct irq_stat *stat); |
94e7e258 | 51 | |
a0f62b0b | 52 | void irq_print_columns(FILE *f, int nodelta); |
94e7e258 | 53 | |
44e39c99 KZ |
54 | void set_sort_func_by_name(struct irq_output *out, const char *name); |
55 | void set_sort_func_by_key(struct irq_output *out, const char c); | |
94e7e258 KZ |
56 | |
57 | struct libscols_table *get_scols_table(struct irq_output *out, | |
58 | struct irq_stat *prev, | |
59 | struct irq_stat **xstat); | |
02f2919e KZ |
60 | |
61 | #endif /* UTIL_LINUX_H_IRQ_COMMON */ |