Browse Source

Profiling

pull/183/head
Jure Šorn 8 months ago
parent
commit
09a87b206b
2 changed files with 15 additions and 15 deletions
  1. 14
      README.md
  2. 16
      index.html

14
README.md

@ -2620,13 +2620,13 @@ Line # Hits Time Per Hit % Time Line Contents
```
### Call and Flame Graphs
```text
$ apt/brew install graphviz && pip3 install gprof2dot snakeviz
$ tail --lines=4 test.py > test.py
$ python3 -m cProfile -o test.prof test.py
$ gprof2dot --format=pstats test.prof | dot -T png -o test.png
$ xdg-open/open test.png
$ snakeviz test.prof
```bash
$ apt/brew install graphviz && pip3 install gprof2dot snakeviz # Or download installer.
$ tail --lines=4 test.py > test.py # Removes first line.
$ python3 -m cProfile -o test.prof test.py # Runs built-in profiler.
$ gprof2dot --format=pstats test.prof | dot -T png -o test.png # Generates call graph.
$ xdg-open/open test.png # Displays call graph.
$ snakeviz test.prof # Displays flame graph.
```
### Sampling and Memory Profilers

16
index.html

@ -54,7 +54,7 @@
<body>
<header>
<aside>March 9, 2024</aside>
<aside>March 11, 2024</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</header>
@ -2157,12 +2157,12 @@ Line # Hits Time Per Hit % Time Line Contents
4 1 534.1 534.1 67.8 b = set(range(10000))
</code></pre></div>
<div><h3 id="callandflamegraphs">Call and Flame Graphs</h3><pre><code class="text language-text">$ apt/brew install graphviz &amp;&amp; pip3 install gprof2dot snakeviz
$ tail --lines=4 test.py &gt; test.py
$ python3 -m cProfile -o test.prof test.py
$ gprof2dot --format=pstats test.prof | dot -T png -o test.png
$ xdg-open/open test.png
$ snakeviz test.prof
<div><h3 id="callandflamegraphs">Call and Flame Graphs</h3><pre><code class="bash language-bash hljs">$ apt/brew install graphviz &amp;&amp; pip3 install gprof2dot snakeviz <span class="hljs-comment"># Or download installer.</span>
$ tail --lines=4 test.py &gt; test.py <span class="hljs-comment"># Removes first line.</span>
$ python3 -m cProfile -o test.prof test.py <span class="hljs-comment"># Runs built-in profiler.</span>
$ gprof2dot --format=pstats test.prof | dot -T png -o test.png <span class="hljs-comment"># Generates call graph.</span>
$ xdg-open/open test.png <span class="hljs-comment"># Displays call graph.</span>
$ snakeviz test.prof <span class="hljs-comment"># Displays flame graph.</span>
</code></pre></div>
<div><h3 id="samplingandmemoryprofilers">Sampling and Memory Profilers</h3><pre><code class="text language-text">┏━━━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┓
@ -2935,7 +2935,7 @@ $ deactivate <span class="hljs-comment"># Deactivates the activ
<footer>
<aside>March 9, 2024</aside>
<aside>March 11, 2024</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</footer>

Loading…
Cancel
Save