Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add :report option to aggregate results over multiple processes in tprof #13632

Merged
merged 1 commit into from
Jun 3, 2024

Conversation

sabiwara
Copy link

@sabiwara sabiwara commented Jun 3, 2024

Expose this "Type" param of tprof's inspect/3 function.
I struggled a bit to find a good name for the argument, alternative proposals welcome.
I also considered making this a boolean flag but I finally decided to stick to Erlang's atoms.

process (default):

$mix profile.tprof -e "Task.async_stream(1..2, & &1 ** 2) |> Enum.to_list()"
Warmup...


Profile results of #PID<0.109.0>
#                                               CALLS      % TIME µS/CALL
Total                                              99 100.00   16    0.16
:elixir_aliases.concat/1                            1   0.00    0    0.00
...
:erlang.send/2                                      6  31.25    5    0.83

Profile done over 53 matching functions

Profile results of #PID<0.110.0>
#                                            CALLS      % TIME µS/CALL
Total                                           51 100.00   12    0.24
:erts_internal.map_next/3                        2   0.00    0    0.00
...

total:

$ mix profile.tprof -e "Task.async_stream(1..2, & &1 ** 2) |> Enum.to_list()" --report total
Warmup...


Profile results over all processes
#                                               CALLS      % TIME µS/CALL
Total                                             188 100.00   26    0.14
Module.concat/2                                     1   0.00    0    0.00
...
Task.Supervised.stream_reduce/7                     8  15.38    4    0.50
Task.Supervised.stream_monitor_loop/2               5  19.23    5    1.00
:erlang.send/2                                     12  19.23    5    0.42

Profile done over 89 matching functions

Copy link
Member

@josevalim josevalim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And please backport!

@sabiwara sabiwara merged commit 48113d4 into elixir-lang:main Jun 3, 2024
9 checks passed
@sabiwara sabiwara deleted the tprof-total-processes branch June 3, 2024 11:47
@sabiwara
Copy link
Author

sabiwara commented Jun 3, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants