irqtop: minor cleanup

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2020-03-06 14:11:30 +01:00
parent 94e7e258a3
commit 02f2919e95
2 changed files with 12 additions and 6 deletions

View File

@ -1,6 +1,12 @@
#ifndef UTIL_LINUX_H_IRQ_COMMON
#define UTIL_LINUX_H_IRQ_COMMON
#include "c.h"
#include "nls.h"
/* supported columns */
enum {
COL_IRQ = 1,
COL_IRQ = 0,
COL_TOTAL,
COL_DELTA,
COL_NAME,
@ -28,6 +34,7 @@ typedef int (sort_fp)(const struct irq_info *, const struct irq_info *);
#define DEF_SORT_FUNC ((sort_fp *)sort_total)
/* output definition */
struct irq_output {
int columns[__COL_COUNT * 2];
size_t ncolumns;
@ -73,3 +80,5 @@ sort_fp *set_sort_func(char key);
struct libscols_table *get_scols_table(struct irq_output *out,
struct irq_stat *prev,
struct irq_stat **xstat);
#endif /* UTIL_LINUX_H_IRQ_COMMON */

View File

@ -56,10 +56,8 @@
#include <libsmartcols.h>
#include "c.h"
#include "closestream.h"
#include "monotonic.h"
#include "nls.h"
#include "pathnames.h"
#include "strutils.h"
#include "timeutils.h"
@ -70,6 +68,7 @@
#define MAX_EVENTS 3
/* top control struct */
struct irqtop_ctl {
int cols;
int rows;
@ -78,9 +77,9 @@ struct irqtop_ctl {
char *hostname;
unsigned int request_exit:1;
};
/* user's input parser */
static void parse_input(struct irqtop_ctl *ctl, struct irq_output *out, char c)
{
switch (c) {
@ -227,8 +226,6 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(USAGE_OPTIONS, stdout);
fputs(_(" -d, --delay <secs> delay updates\n"), stdout);
fputs(_(" --once only display interrupts once, then exit\n"), stdout);
fputs(_(" -J --json output json, implies displaying once\n"), stdout);
fputs(_(" -o --output <list> define which output columns to use (see below)\n"), stdout);
fputs(_(" -s, --sort <char> specify sort criteria by character (see below)\n"), stdout);
fputs(USAGE_SEPARATOR, stdout);