1 #ifndef UTIL_LINUX_H_IRQ_COMMON 2 #define UTIL_LINUX_H_IRQ_COMMON 3 4 #include "c.h" 5 #include "nls.h" 6 7 /* supported columns */ 8 enum { 9 COL_IRQ = 0, 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 24 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 34 typedef int (irq_cmp_t)(const struct irq_info *, const struct irq_info *); 35 36 /* output definition */ 37 struct irq_output { 38 int columns[__COL_COUNT * 2]; 39 size_t ncolumns; 40 41 irq_cmp_t *sort_cmp_func; 42 43 unsigned int 44 json:1, /* JSON output */ 45 pairs:1, /* export, NAME="value" aoutput */ 46 no_headings:1; /* don't print header */ 47 }; 48 49 int irq_column_name_to_id(char const *const name, size_t const namesz); 50 void free_irqstat(struct irq_stat *stat); 51 52 void irq_print_columns(FILE *f, int nodelta); 53 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); 56 57 struct libscols_table *get_scols_table(struct irq_output *out, 58 struct irq_stat *prev, 59 struct irq_stat **xstat); 60 61 #endif /* UTIL_LINUX_H_IRQ_COMMON */ 62