summaryrefslogtreecommitdiffstats
path: root/sys-utils/irq-common.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:10:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:10:49 +0000
commitcfe5e3905201349e9cf3f95d52ff4bd100bde37d (patch)
treed0baf160cbee3195249d095f85e52d20c21acf02 /sys-utils/irq-common.h
parentInitial commit. (diff)
downloadutil-linux-cfe5e3905201349e9cf3f95d52ff4bd100bde37d.tar.xz
util-linux-cfe5e3905201349e9cf3f95d52ff4bd100bde37d.zip
Adding upstream version 2.39.3.upstream/2.39.3
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.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/sys-utils/irq-common.h b/sys-utils/irq-common.h
new file mode 100644
index 0000000..04c4320
--- /dev/null
+++ b/sys-utils/irq-common.h
@@ -0,0 +1,77 @@
+#ifndef UTIL_LINUX_H_IRQ_COMMON
+#define UTIL_LINUX_H_IRQ_COMMON
+
+#include "c.h"
+#include "nls.h"
+#include "cpuset.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_cpu {
+ unsigned long total;
+ unsigned long delta;
+};
+
+struct irq_stat {
+ unsigned long nr_irq; /* number of irq vector */
+ unsigned long nr_irq_info; /* number of irq info */
+ struct irq_info *irq_info; /* array of irq_info */
+ struct irq_cpu *cpus; /* array of irq_cpu */
+ size_t 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,
+ int softirq,
+ size_t setsize,
+ cpu_set_t *cpuset);
+
+struct libscols_table *get_scols_cpus_table(struct irq_output *out,
+ struct irq_stat *prev,
+ struct irq_stat *curr,
+ size_t setsize,
+ cpu_set_t *cpuset);
+
+#endif /* UTIL_LINUX_H_IRQ_COMMON */