Skip to content

Commit 09a87b2

Browse files
committed
Profiling
1 parent e69f01c commit 09a87b2

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2620,13 +2620,13 @@ Line # Hits Time Per Hit % Time Line Contents
26202620
```
26212621

26222622
### Call and Flame Graphs
2623-
```text
2624-
$ apt/brew install graphviz && pip3 install gprof2dot snakeviz
2625-
$ tail --lines=4 test.py > test.py
2626-
$ python3 -m cProfile -o test.prof test.py
2627-
$ gprof2dot --format=pstats test.prof | dot -T png -o test.png
2628-
$ xdg-open/open test.png
2629-
$ snakeviz test.prof
2623+
```bash
2624+
$ apt/brew install graphviz && pip3 install gprof2dot snakeviz # Or download installer.
2625+
$ tail --lines=4 test.py > test.py # Removes first line.
2626+
$ python3 -m cProfile -o test.prof test.py # Runs built-in profiler.
2627+
$ gprof2dot --format=pstats test.prof | dot -T png -o test.png # Generates call graph.
2628+
$ xdg-open/open test.png # Displays call graph.
2629+
$ snakeviz test.prof # Displays flame graph.
26302630
```
26312631

26322632
### Sampling and Memory Profilers

index.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
<body>
5656
<header>
57-
<aside>March 9, 2024</aside>
57+
<aside>March 11, 2024</aside>
5858
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
5959
</header>
6060

@@ -2157,12 +2157,12 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
21572157
4 1 534.1 534.1 67.8 b = set(range(10000))
21582158
</code></pre></div>
21592159

2160-
<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
2161-
$ tail --lines=4 test.py &gt; test.py
2162-
$ python3 -m cProfile -o test.prof test.py
2163-
$ gprof2dot --format=pstats test.prof | dot -T png -o test.png
2164-
$ xdg-open/open test.png
2165-
$ snakeviz test.prof
2160+
<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>
2161+
$ tail --lines=4 test.py &gt; test.py <span class="hljs-comment"># Removes first line.</span>
2162+
$ python3 -m cProfile -o test.prof test.py <span class="hljs-comment"># Runs built-in profiler.</span>
2163+
$ gprof2dot --format=pstats test.prof | dot -T png -o test.png <span class="hljs-comment"># Generates call graph.</span>
2164+
$ xdg-open/open test.png <span class="hljs-comment"># Displays call graph.</span>
2165+
$ snakeviz test.prof <span class="hljs-comment"># Displays flame graph.</span>
21662166
</code></pre></div>
21672167

21682168
<div><h3 id="samplingandmemoryprofilers">Sampling and Memory Profilers</h3><pre><code class="text language-text">┏━━━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┓
@@ -2935,7 +2935,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
29352935

29362936

29372937
<footer>
2938-
<aside>March 9, 2024</aside>
2938+
<aside>March 11, 2024</aside>
29392939
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
29402940
</footer>
29412941

0 commit comments

Comments
 (0)