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

Output format #39

Closed
dndeus opened this issue Jul 25, 2021 · 2 comments
Closed

Output format #39

dndeus opened this issue Jul 25, 2021 · 2 comments

Comments

@dndeus
Copy link

dndeus commented Jul 25, 2021

Hello there

Is there a way to view the results of the profile as a flamegraph r something?? If so can you provide with an example?

Thank you for your efforts

@sj-i
Copy link
Member

sj-i commented Jul 28, 2021

Hi! Sorry for the late reply.
Currently, there is no provided way to visualize the result.
You can still output the result to a file, and then you can see hot paths by using a one-liner like this.

sudo ./php-profiler inspector:trace -p [process ID of the target] > result
cat result | sort | uniq -c | sort -nr

I'm slowly working on a generalized solution for customizing the output format, but I don't have much time to do it for now.
Just adding ad hoc support for outputting a flame graph is easy. So I'll give it a shot in days.

@sj-i
Copy link
Member

sj-i commented Aug 2, 2021

@dndeus
I've just released v0.2.1. This release includes tools for generating flamegraphs borrowed from phpspy. The default format of the traces is adjusted at v0.2.0 to match the output of phpspy, so you can now generate flamegraphs by using commands like following.

sudo php ./php-profiler inspector:trace -p [pid of the target process or thread] >traces
./tools/stackcollapse-phpspy/stackcollapse-phpspy.pl <traces | ./tools/flamegraph/flamegraph.pl >flame.svg

@sj-i sj-i closed this as completed Aug 2, 2021
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

No branches or pull requests

2 participants