iovisor / ply

Dynamic Tracing in Linux
GNU General Public License v2.0
969 stars 90 forks source link

provider: add 'profile' provider #90

Closed ismhong closed 2 weeks ago

ismhong commented 11 months ago

The profile provider supports profiling by allowing the user to specify how many times it will fire pre-second. Values of 1-1000 are supported, and the profile provider supports two probe formats as it's original implementation commit 12b8ca298699("profile provider support").

Test this changes with 4 cores x86-64 PC as below.

$ sudo ./ply 'profile:2:100hz { @[cpu]=count(); } i:1s { print(@); }' 
@:
{  2 }: 100

@:
{  2 }: 200

@:
{  2 }: 300

$ sudo ./ply 'profile:100hz { @[cpu]=count(); } i:1s { print(@); }' 
@:
{  0 }: 100
{  1 }: 100
{  2 }: 100
{  3 }: 100

@:
{  0 }: 200
{  1 }: 200
{  2 }: 200
{  3 }: 200

@:
{  0 }: 300
{  1 }: 300
{  2 }: 300
{  3 }: 300

Change-Id: Ie669db20ed52947f5c75bf91c34f385a64029b19

wkz commented 3 weeks ago

This looks great! Sorry for the (extremely long) delay!

If you are still interested in getting this merged, would you mind:

ismhong commented 3 weeks ago

Hi @wkz I have rebased my PR with latest master, and add one regression test in test/rootfs/lib/ply/test.sh. Could you please help to review the changes? Thanks. :)

BTW, it seems there is a workflow changed notification Github raised due to rebase to latest master. I am not sure how to deal with it. Is there anything I done wrong while pushing changes to PR?