2020-03-06 14:11:30 +01:00
|
|
|
#ifndef UTIL_LINUX_H_IRQ_COMMON
|
|
|
|
#define UTIL_LINUX_H_IRQ_COMMON
|
2020-03-06 14:04:33 +01:00
|
|
|
|
2020-03-06 14:11:30 +01:00
|
|
|
#include "c.h"
|
|
|
|
#include "nls.h"
|
2022-03-29 16:59:51 +08:00
|
|
|
#include "cpuset.h"
|
2020-03-06 14:11:30 +01:00
|
|
|
|
|
|
|
/* supported columns */
|
2020-03-06 14:04:33 +01:00
|
|
|
enum {
|
2020-03-06 14:11:30 +01:00
|
|
|
COL_IRQ = 0,
|
2020-03-06 14:04:33 +01:00
|
|
|
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 */
|
|
|
|
};
|
|
|
|
|
2021-02-24 20:10:56 +01:00
|
|
|
struct irq_cpu {
|
|
|
|
unsigned long total;
|
|
|
|
unsigned long delta;
|
|
|
|
};
|
2020-03-06 14:49:53 +01:00
|
|
|
|
2020-03-06 14:04:33 +01:00
|
|
|
struct irq_stat {
|
2021-02-25 09:57:49 +01:00
|
|
|
unsigned long nr_irq; /* number of irq vector */
|
|
|
|
unsigned long nr_irq_info; /* number of irq info */
|
2020-03-06 14:04:33 +01:00
|
|
|
struct irq_info *irq_info; /* array of irq_info */
|
2021-02-24 20:10:56 +01:00
|
|
|
struct irq_cpu *cpus; /* array of irq_cpu */
|
|
|
|
size_t nr_active_cpu; /* number of active cpu */
|
2020-03-06 14:04:33 +01:00
|
|
|
unsigned long total_irq; /* total irqs */
|
|
|
|
unsigned long delta_irq; /* delta irqs */
|
|
|
|
};
|
|
|
|
|
2021-02-24 20:10:56 +01:00
|
|
|
|
2020-03-06 15:28:57 +01:00
|
|
|
typedef int (irq_cmp_t)(const struct irq_info *, const struct irq_info *);
|
2020-03-06 14:04:33 +01:00
|
|
|
|
2020-03-06 14:11:30 +01:00
|
|
|
/* output definition */
|
2020-03-06 14:04:33 +01:00
|
|
|
struct irq_output {
|
|
|
|
int columns[__COL_COUNT * 2];
|
|
|
|
size_t ncolumns;
|
|
|
|
|
2020-03-06 15:28:57 +01:00
|
|
|
irq_cmp_t *sort_cmp_func;
|
2020-03-06 14:04:33 +01:00
|
|
|
|
|
|
|
unsigned int
|
2020-03-06 16:34:51 +01:00
|
|
|
json:1, /* JSON output */
|
|
|
|
pairs:1, /* export, NAME="value" aoutput */
|
|
|
|
no_headings:1; /* don't print header */
|
2020-03-06 14:04:33 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
int irq_column_name_to_id(char const *const name, size_t const namesz);
|
2020-03-06 14:49:53 +01:00
|
|
|
void free_irqstat(struct irq_stat *stat);
|
2020-03-06 14:04:33 +01:00
|
|
|
|
2020-03-06 16:21:10 +01:00
|
|
|
void irq_print_columns(FILE *f, int nodelta);
|
2020-03-06 14:04:33 +01:00
|
|
|
|
2020-03-06 15:28:57 +01:00
|
|
|
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);
|
2020-03-06 14:04:33 +01:00
|
|
|
|
|
|
|
struct libscols_table *get_scols_table(struct irq_output *out,
|
|
|
|
struct irq_stat *prev,
|
2020-06-29 14:19:21 +08:00
|
|
|
struct irq_stat **xstat,
|
2022-03-29 16:59:51 +08:00
|
|
|
int softirq,
|
|
|
|
size_t setsize,
|
|
|
|
cpu_set_t *cpuset);
|
2020-03-06 14:11:30 +01:00
|
|
|
|
2021-02-24 20:10:56 +01:00
|
|
|
struct libscols_table *get_scols_cpus_table(struct irq_output *out,
|
|
|
|
struct irq_stat *prev,
|
2022-03-29 16:59:51 +08:00
|
|
|
struct irq_stat *curr,
|
|
|
|
size_t setsize,
|
|
|
|
cpu_set_t *cpuset);
|
2021-02-24 20:10:56 +01:00
|
|
|
|
2020-03-06 14:11:30 +01:00
|
|
|
#endif /* UTIL_LINUX_H_IRQ_COMMON */
|