From: zhenwei pi <pizhenwei@bytedance.com>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux@vger.kernel.org
Subject: Re: Re: [PATCH] irqtop: add -c/--cpus option
Date: Wed, 10 Nov 2021 18:24:38 +0800 [thread overview]
Message-ID: <0418c94c-74f3-2503-71a0-ebf457946354@bytedance.com> (raw)
In-Reply-To: <20211110095843.lfg6c7zxhrst42xb@ws.net.home>
On 11/10/21 5:58 PM, Karel Zak 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)
>
> Thanks again!
>
> Karel
>
Tested the latest code on a server with 256 CPUs, it works fine! Thanks!
--
zhenwei pi
next prev parent reply other threads:[~2021-11-10 10:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-10 3:16 [PATCH] irqtop: add -c/--cpus option zhenwei pi
2021-11-10 9:58 ` Karel Zak
2021-11-10 10:24 ` zhenwei pi [this message]
2021-11-10 18:50 ` Peter Seiderer
2021-11-11 10:37 ` Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0418c94c-74f3-2503-71a0-ebf457946354@bytedance.com \
--to=pizhenwei@bytedance.com \
--cc=kzak@redhat.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox