Skip to content

tools/cpudist: Add extension summary support#4131

Merged
yonghong-song merged 2 commits intoiovisor:masterfrom
xingfeng2510:fixup
Jul 29, 2022
Merged

tools/cpudist: Add extension summary support#4131
yonghong-song merged 2 commits intoiovisor:masterfrom
xingfeng2510:fixup

Conversation

@xingfeng2510
Copy link
Copy Markdown
Contributor

@xingfeng2510 xingfeng2510 commented Jul 25, 2022

Sometimes, I want to known total on-CPU or off-CPU time and count (same as context switch times) at a fixed interval (for example: 1s).

Like #3384, This patch try to add an option -e to show extension summary (average/total/count).

# ./cpudist.py -p $(pgrep -nx mysqld) -e 1

     usecs               : count     distribution
         0 -> 1          : 4123     |**************                          |
         2 -> 3          : 11690    |****************************************|
         4 -> 7          : 1668     |*****                                   |
         8 -> 15         : 859      |**                                      |
        16 -> 31         : 618      |**                                      |
        32 -> 63         : 290      |                                        |
        64 -> 127        : 247      |                                        |
       128 -> 255        : 198      |                                        |
       256 -> 511        : 161      |                                        |
       512 -> 1023       : 370      |*                                       |
      1024 -> 2047       : 98       |                                        |
      2048 -> 4095       : 6        |                                        |
      4096 -> 8191       : 16       |                                        |

avg = 33 usecs, total: 682091 usecs, count: 20383

@yonghong-song Please take a look, thanks.

@yonghong-song
Copy link
Copy Markdown
Collaborator

LGTM. The implementation is very similar to biolatency.py.

@yonghong-song yonghong-song merged commit 4a60443 into iovisor:master Jul 29, 2022
chenhengqi added a commit to chenhengqi/bcc that referenced this pull request Aug 6, 2022
With iovisor#4131 included, running the tool with -L reports the following warning:

    /virtual/main.c:57:28: warning: multi-character character constant [-Wmultichar]
        pid_key_t key = {.id = ' + pid + ', .slot = bpf_log2l(delta)};
                               ^
    /virtual/main.c:57:28: warning: character constant too long for its type
    2 warnings generated.

The `pid` part should not be treated as string literal. Fix it.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants