diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 13:14:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 13:14:44 +0000 |
commit | 30ff6afe596eddafacf22b1a5b2d1a3d6254ea15 (patch) | |
tree | 9b788335f92174baf7ee18f03ca8330b8c19ce2b /sys-utils/irq-common.h | |
parent | Initial commit. (diff) | |
download | util-linux-30ff6afe596eddafacf22b1a5b2d1a3d6254ea15.tar.xz util-linux-30ff6afe596eddafacf22b1a5b2d1a3d6254ea15.zip |
Adding upstream version 2.36.1.upstream/2.36.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sys-utils/irq-common.h')
-rw-r--r-- | sys-utils/irq-common.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/sys-utils/irq-common.h b/sys-utils/irq-common.h new file mode 100644 index 0000000..9515daf --- /dev/null +++ b/sys-utils/irq-common.h @@ -0,0 +1,61 @@ +#ifndef UTIL_LINUX_H_IRQ_COMMON +#define UTIL_LINUX_H_IRQ_COMMON + +#include "c.h" +#include "nls.h" + +/* supported columns */ +enum { + COL_IRQ = 0, + COL_TOTAL, + COL_DELTA, + COL_NAME, + + __COL_COUNT +}; + +struct irq_info { + char *irq; /* short name of this irq */ + char *name; /* descriptive name of this irq */ + unsigned long total; /* total count since system start up */ + unsigned long delta; /* delta count since previous update */ +}; + + +struct irq_stat { + unsigned int nr_irq; /* number of irq vector */ + unsigned int nr_irq_info; /* number of irq info */ + struct irq_info *irq_info; /* array of irq_info */ + long nr_active_cpu; /* number of active cpu */ + unsigned long total_irq; /* total irqs */ + unsigned long delta_irq; /* delta irqs */ +}; + +typedef int (irq_cmp_t)(const struct irq_info *, const struct irq_info *); + +/* output definition */ +struct irq_output { + int columns[__COL_COUNT * 2]; + size_t ncolumns; + + irq_cmp_t *sort_cmp_func; + + unsigned int + json:1, /* JSON output */ + pairs:1, /* export, NAME="value" aoutput */ + no_headings:1; /* don't print header */ +}; + +int irq_column_name_to_id(char const *const name, size_t const namesz); +void free_irqstat(struct irq_stat *stat); + +void irq_print_columns(FILE *f, int nodelta); + +void set_sort_func_by_name(struct irq_output *out, const char *name); +void set_sort_func_by_key(struct irq_output *out, const char c); + +struct libscols_table *get_scols_table(struct irq_output *out, + struct irq_stat *prev, + struct irq_stat **xstat); + +#endif /* UTIL_LINUX_H_IRQ_COMMON */ |