public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Leo Yan <leo.yan@linaro.org>
Cc: brouer@redhat.com, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	eas-dev@lists.linaro.org,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Vincent Guittot <vincent.guittot@linaro.org>
Subject: Re: [PATCH] samples/bpf: Add program for CPU state statistics
Date: Wed, 31 Jan 2018 10:14:27 +0100	[thread overview]
Message-ID: <20180131101427.4c55fc21@redhat.com> (raw)
In-Reply-To: <1517336999-5731-1-git-send-email-leo.yan@linaro.org>

On Wed, 31 Jan 2018 02:29:59 +0800
Leo Yan <leo.yan@linaro.org> wrote:

> CPU 0
> State    : Duration(ms)  Distribution
> cstate 0 : 47555        |*********************************       |
> cstate 1 : 0            |                                        |
> cstate 2 : 0            |                                        |
> pstate 0 : 15239        |*********                               |
> pstate 1 : 1521         |                                        |
> pstate 2 : 3188         |*                                       |
> pstate 3 : 1836         |                                        |
> pstate 4 : 94           |                                        |
> 
> CPU 1
> State    : Duration(ms)  Distribution
> cstate 0 : 87           |                                        |
> cstate 1 : 16264        |**********                              |
> cstate 2 : 50458        |***********************************     |
> pstate 0 : 832          |                                        |
> pstate 1 : 131          |                                        |
> pstate 2 : 825          |                                        |
> pstate 3 : 787          |                                        |
> pstate 4 : 4            |                                        |
> 
> CPU 2
> State    : Duration(ms)  Distribution
> cstate 0 : 177          |                                        |
> cstate 1 : 9363         |*****                                   |
> cstate 2 : 55835        |*************************************** |
> pstate 0 : 1468         |                                        |
> pstate 1 : 350          |                                        |
> pstate 2 : 1062         |                                        |
> pstate 3 : 1164         |                                        |
> pstate 4 : 7            |                                        |

The output gets very long as the number of CPUs grow...
What about using the following output:

state(ms)  cstate-0  cstate-1  cstate-2  pstate-0  pstate-1  pstate-2  pstate-3  pstate-4
CPU-0        47,555         0         0    15,239     1,521     1,836     1,836        94
CPU-1            87    16,264    50,458       832       131       825       787         4
CPU-2           177     9,363    55,835     1,468       350     1,062     1,164         7

Look at the code samples/bpf/xdp_redirect_cpu_user.c for an examples of
howto align the columns, and the trick to get printf to pretty print
with thousands separators use %' and setlocale(LC_NUMERIC, "en_US").


P.S. net-next and bpf-next is closed at the moment.
 Next time you submit read[1] and [2], especially howto indicate which
tree (bpf vs. bpf-next) the patch is against, as this helps the
workflow of the maintainers.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/Documentation/bpf/bpf_devel_QA.txt
[2] Documentation/networking/netdev-FAQ.txt 
-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

  reply	other threads:[~2018-01-31  9:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-30 18:29 [PATCH] samples/bpf: Add program for CPU state statistics Leo Yan
2018-01-31  9:14 ` Jesper Dangaard Brouer [this message]
2018-01-31 11:38   ` Leo Yan

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=20180131101427.4c55fc21@redhat.com \
    --to=brouer@redhat.com \
    --cc=ast@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=daniel@iogearbox.net \
    --cc=eas-dev@lists.linaro.org \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vincent.guittot@linaro.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