'-C'|'--cpu-list')
return 0
;;
+ '-t'|'--threshold')
+ return 0
+ ;;
'-d'|'--delay')
COMPREPLY=( $(compgen -W "secs" -- $cur) )
return 0
--sort
--output
--softirq
+ --threshold
--help
--version"
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
COMPREPLY=( $(compgen -W "irq total name" -- $cur) )
return 0
;;
+ '-t'|'--threshold')
+ return 0
+ ;;
'-h'|'--help'|'-V'|'--version')
return 0
;;
--output
--softirq
--sort
+ --threshold
--help
--version"
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
struct irq_stat *prev,
struct irq_stat **xstat,
int softirq,
+ unsigned long threshold,
size_t setsize,
cpu_set_t *cpuset)
{
}
for (i = 0; i < stat->nr_irq; i++)
- add_scols_line(out, &result[i], table);
+ if (result[i].total >= threshold)
+ add_scols_line(out, &result[i], table);
free(result);
struct irq_stat *prev,
struct irq_stat **xstat,
int softirq,
+ unsigned long threshold,
size_t setsize,
cpu_set_t *cpuset);
*-S*, *--softirq*::
Show softirqs information.
+*-t*, *--threshold* _min_::
+Only show IRQs with counters above the specified threshold. Human readable values are supported (e.g. 1.2K).
+
include::man-common/help-version.adoc[]
== INTERACTIVE MODE KEY COMMANDS
mailto:pizhenwei@bytedance.com[Zhenwei Pi],
mailto:kerolasa@iki.fi[Sami Kerola],
mailto:kzak@redhat.com[Karel Zak]
+mailto:robin@jarry.cc[Robin Jarry]
include::man-common/bugreports.adoc[]
*
* Copyright (C) 2019 zhenwei pi <pizhenwei@bytedance.com>
* Copyright (C) 2020 Karel Zak <kzak@redhat.com>
+ * Copyright (C) 2024 Robin Jarry <robin@jarry.cc>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
struct itimerspec timer;
struct irq_stat *prev_stat;
+ uintmax_t threshold;
size_t setsize;
cpu_set_t *cpuset;
char timestr[64], *data, *data0, *p;
/* make irqs table */
- table = get_scols_table(out, ctl->prev_stat, &stat, ctl->softirq, ctl->setsize,
- ctl->cpuset);
+ table = get_scols_table(out, ctl->prev_stat, &stat, ctl->softirq,
+ ctl->threshold, ctl->setsize, ctl->cpuset);
if (!table) {
ctl->request_exit = 1;
return 1;
fputs(_(" -o, --output <list> define which output columns to use\n"), stdout);
fputs(_(" -s, --sort <column> specify sort column\n"), stdout);
fputs(_(" -S, --softirq show softirqs instead of interrupts\n"), stdout);
+ fputs(_(" -t, --threshold <N> only IRQs with counters above <N>\n"), stdout);
fputs(USAGE_SEPARATOR, stdout);
fprintf(stdout, USAGE_HELP_OPTIONS(22));
{"sort", required_argument, NULL, 's'},
{"output", required_argument, NULL, 'o'},
{"softirq", no_argument, NULL, 'S'},
+ {"threshold", required_argument, NULL, 't'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0}
};
int o;
- while ((o = getopt_long(argc, argv, "c:C:d:o:s:ShV", longopts, NULL)) != -1) {
+ while ((o = getopt_long(argc, argv, "c:C:d:o:s:St:hV", longopts, NULL)) != -1) {
switch (o) {
case 'c':
if (!strcmp(optarg, "auto"))
case 'S':
ctl->softirq = 1;
break;
+ case 't':
+ ctl->threshold = strtosize_or_err(optarg, _("error: --threshold"));
+ break;
case 'V':
print_version(EXIT_SUCCESS);
case 'h':
*-S*, *--softirq*::
Show softirqs information.
+*-t*, *--threshold* _min_::
+Only show IRQs with counters above the specified threshold. Human readable values are supported (e.g. 1.2K).
+
include::man-common/help-version.adoc[]
== AUTHORS
mailto:pizhenwei@bytedance.com[Zhenwei Pi],
mailto:kerolasa@iki.fi[Sami Kerola],
mailto:kzak@redhat.com[Karel Zak]
+mailto:robin@jarry.cc[Robin Jarry]
include::man-common/bugreports.adoc[]
*
* Copyright (C) 2019 zhenwei pi <pizhenwei@bytedance.com>
* Copyright (C) 2020 Karel Zak <kzak@redhat.com>
+ * Copyright (C) 2024 Robin Jarry <robin@jarry.cc>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
#include "irq-common.h"
-static int print_irq_data(struct irq_output *out, int softirq)
+static int print_irq_data(struct irq_output *out,
+ int softirq, unsigned long threshold)
{
struct libscols_table *table;
- table = get_scols_table(out, NULL, NULL, softirq, 0, NULL);
+ table = get_scols_table(out, NULL, NULL, softirq, threshold, 0, NULL);
if (!table)
return -1;
fputs(_(" -o, --output <list> define which output columns to use\n"), stdout);
fputs(_(" -s, --sort <column> specify sort column\n"), stdout);
fputs(_(" -S, --softirq show softirqs instead of interrupts\n"), stdout);
+ fputs(_(" -t, --threshold <N> only IRQs with counters above <N>\n"), stdout);
fputs(USAGE_SEPARATOR, stdout);
fprintf(stdout, USAGE_HELP_OPTIONS(22));
{"sort", required_argument, NULL, 's'},
{"noheadings", no_argument, NULL, 'n'},
{"output", required_argument, NULL, 'o'},
+ {"threshold", required_argument, NULL, 't'},
{"softirq", no_argument, NULL, 'S'},
{"json", no_argument, NULL, 'J'},
{"pairs", no_argument, NULL, 'P'},
{0}
};
int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT;
+ uintmax_t threshold = 0;
int softirq = 0;
setlocale(LC_ALL, "");
- while ((c = getopt_long(argc, argv, "no:s:ShJPV", longopts, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "no:s:t:ShJPV", longopts, NULL)) != -1) {
err_exclusive_options(c, longopts, excl, excl_st);
switch (c) {
case 'S':
softirq = 1;
break;
+ case 't':
+ threshold = strtosize_or_err(optarg, _("error: --threshold"));
+ break;
case 'V':
print_version(EXIT_SUCCESS);
case 'h':
irq_column_name_to_id) < 0)
exit(EXIT_FAILURE);
- return print_irq_data(&out, softirq) == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+ if (print_irq_data(&out, softirq, threshold) < 0)
+ return EXIT_FAILURE;
+
+ return EXIT_SUCCESS;
}