Skip to content

Commit

Permalink
Merge pull request #41 from sj-i/add-flamegraph-visualizer
Browse files Browse the repository at this point in the history
Add flamegraph visualizer
  • Loading branch information
sj-i authored Aug 2, 2021
2 parents 0fe2381 + 67e6a68 commit b2da654
Show file tree
Hide file tree
Showing 7 changed files with 1,696 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ docker build -t php-profiler .
docker run -it --security-opt="apparmor=unconfined" --cap-add=SYS_PTRACE --pid=host php-profiler:latest vendor/bin/php-profiler inspector:trace -p <pid of the target process or thread>
```

### Generate flamegraphs from traces
```bash
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
```

# LICENSE
- MIT (mostly)
- Some C headers defining internal structures are extracted from php-src. They are licensed under the zend engine license. See src/Lib/PhpInternals/Headers . So here are the words required by the zend engine license.
Expand Down
3 changes: 3 additions & 0 deletions tools/flamegraph/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
flamegraph.pl here is copied from https://github.com/brendangregg/FlameGraph and licenced under the CDDL 1.0.

See docs/cddl1.txt and the header of the script for more detail.
384 changes: 384 additions & 0 deletions tools/flamegraph/docs/cddl1.txt

Large diffs are not rendered by default.

Loading

0 comments on commit b2da654

Please sign in to comment.