Hello Karel, On Wed, 10 Nov 2021 10:58:43 +0100, Karel Zak <kzak@xxxxxxxxxx> wrote: > On Wed, Nov 10, 2021 at 11:16:42AM +0800, zhenwei pi wrote: > > Since a23aecc1bf("irqtop: add per-cpu stats"), irqtop always shows > > per-cpu stats. Test on a modern AMD server with 2 socket(256 CPU), > > irqtop shows like following: > > Thanks! This was on my TODO list too. > > > + /* print cpus table or not by -c option */ > > + do { > > + int x, y; > > + > > + if (ctl->cpus == irqtop_cpus_table_disable) > > + break; > > + > > + scols_print_table_to_string(cpus, &data); > > + if (ctl->cpus == irqtop_cpus_table_auto) { > > + /* detect window size */ > > + getmaxyx(ctl->win, y, x); > > + y = y; /* avoid build warning*/ > > + p = strchr(data, '\n'); > > + if (p) { > > + /* line is too long */ > > + if ((p - data) > x) { > > + free(data); > > + break; > > + } > > + } > > + } > > libsmartcols provides scols_table_enable_nowrap(), this function > forces the library trim the output. It seems more elegant. > > I have applied your patch with some changes > https://github.com/util-linux/util-linux/commit/17f7caa45105f0cbf8bf9b562468fba2c5d4a549 > > (and https://github.com/util-linux/util-linux/commit/d1732bba383a95786b5ec7bc1f4a173b644fe871 > as I forgot update bash-completion in the first commit) @@ -275,6 +289,7 @@ static void parse_args( struct irqtop_ctl *ctl, { const char *outarg = NULL; static const struct option longopts[] = { + {"cpus", required_argument, NULL, 'c'}, {"delay", required_argument, NULL, 'd'}, {"sort", required_argument, NULL, 's'}, {"output", required_argument, NULL, 'o'}, s/cpus/cpu-stat/ ? Regards, Peter > > Thanks again! > > Karel >