From f133ca4e4336a58252aa9c1225a043e386ce07ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denilson=20S=C3=A1=20Maia?= Date: Tue, 21 Jun 2022 00:29:43 +0200 Subject: [PATCH] =?UTF-8?q?Improved=20the=20documentation=20of=20the=20too?= =?UTF-8?q?ls=20to=20read=20the=20prof=20and=20the=20call=E2=80=A6=20(#231?= =?UTF-8?q?49)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/_integrations/profiler.markdown | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/source/_integrations/profiler.markdown b/source/_integrations/profiler.markdown index 2d6de6a023d..3cd11b4e5f8 100644 --- a/source/_integrations/profiler.markdown +++ b/source/_integrations/profiler.markdown @@ -28,12 +28,28 @@ When the profile is complete, Profiler will generate a Python `cprof` and a `cal The `cprof` file can be viewed with: -[SnakeViz](https://jiffyclub.github.io/snakeviz/) -[Gprof2dot](https://github.com/jrfonseca/gprof2dot) +* [SnakeViz](https://jiffyclub.github.io/snakeviz/) +* [Gprof2dot](https://github.com/jrfonseca/gprof2dot) Additionally, the profiler will generate a `callgrind.out` file that can be viewed with: -[kcachegrind](https://kcachegrind.github.io/) or qcachegrind +* [KCachegrind or QCachegrind](https://kcachegrind.github.io/) +* [Gprof2dot](https://github.com/jrfonseca/gprof2dot) + +The gprof2dot tool generates [DOT](http://www.graphviz.org/doc/info/lang.html) files, which can be converted to images using the `dot` tool from [Graphviz](http://www.graphviz.org/) or viewed directly using [xdot](https://github.com/jrfonseca/xdot.py). The `-e` and `-n` parameters can be used to set the minimum percentage required to include a function in the output file. Observe these examples: + +```bash +# Generating the .dot files: +gprof2dot -f pstats -e 0.05 -n 0.25 profile.1234567890123456.cprof -o profile.dot +gprof2dot -f callgrind -e 0.05 -n 0.25 callgrind.out.1234567890123456 -o callgrind.dot + +# Converting to SVG and PNG formats: +dot callgrind.dot -Tsvg -o callgrind.svg +dot callgrind.dot -Tpng -o callgrind.png + +# Alternatively, both commands in a single line: +gprof2dot -f pstats profile.1234567890123456.cprof | dot -Tsvg -o profile.svg +``` ### Service `profiler.memory`