diff options
| author | a73x <[email protected]> | 2024-12-29 19:13:27 +0000 |
|---|---|---|
| committer | a73x <[email protected]> | 2024-12-30 11:00:49 +0000 |
| commit | a783270b09af3d873c08a01d13f802018b69fb02 (patch) | |
| tree | bdac4e38357afa535515dd8dda790d7193f371d0 /public/posts/2024-08-25-01.html | |
| parent | 71513b80ebc21240b5b68d8bbbf8b7ee2f54893e (diff) | |
new markdown renderer
since TOC has a title now and it can compact toc headers, we can use
header 2 for everything
use the built in goldmark extension for syntax highlighting
Diffstat (limited to 'public/posts/2024-08-25-01.html')
| -rw-r--r-- | public/posts/2024-08-25-01.html | 80 |
1 files changed, 36 insertions, 44 deletions
diff --git a/public/posts/2024-08-25-01.html b/public/posts/2024-08-25-01.html index f2b48cf..a678b92 100644 --- a/public/posts/2024-08-25-01.html +++ b/public/posts/2024-08-25-01.html @@ -25,39 +25,38 @@ <ul> - <li><a class="no-decorations" href="/">home</a></li> + <li><a class="no-decorations" href="/">Home</a></li> - <li><a class="no-decorations" href="/posts">posts</a></li> + <li><a class="no-decorations" href="/posts">Posts</a></li> - <li><a class="no-decorations" href="/ethos">ethos</a></li> + <li><a class="no-decorations" href="/ethos">Ethos</a></li> </ul> </nav> </div> + <hr /> <a href="/posts">← Posts</a> <h1>Go Benchmarking</h1> -<nav> - -<ul> -<li><a href="#cpuprofile">cpuprofile</a></li> - -<li><a href="#memprofile">memprofile</a></li> - -<li><a href="#pprof">pprof</a> +<h1 id="table-of-contents">Table of Contents</h1> <ul> -<li><a href="#views">views</a></li> -</ul></li> +<li> +<a href="#cpuprofile">cpuprofile</a></li> +<li> +<a href="#memprofile">memprofile</a></li> +<li> +<a href="#pprof">pprof</a><ul> +<li> +<a href="#views">views</a></li> +</ul> +</li> </ul> - -</nav> <p>The benchmark cycle:</p> - <ol> <li>write a benchmark</li> <li>run a benchmark</li> @@ -66,50 +65,43 @@ <li>run your tests</li> <li>goto 2.</li> </ol> - -<h1 id="cpuprofile">cpuprofile</h1> -<pre tabindex="0" class="chroma"><code><span class="line"><span class="cl">go <span class="nb">test</span> -test<span class="o">=</span>XXX -bench <regex> -cpuprofile <file> -</span></span></code></pre> -<h1 id="memprofile">memprofile</h1> -<pre tabindex="0" class="chroma"><code><span class="line"><span class="cl">go <span class="nb">test</span> -test<span class="o">=</span>XXX -bench <regex> -memprofile <file> -benchmem -</span></span></code></pre> -<h1 id="pprof">pprof</h1> - +<h2 id="cpuprofile">cpuprofile</h2> +<pre tabindex="0" style="background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;white-space:pre-wrap;word-break:break-word;"><code>go <span style="color:#0aa">test</span> -test=XXX -bench <regex> -cpuprofile <file> +</code></pre><h2 id="memprofile">memprofile</h2> +<pre tabindex="0" style="background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;white-space:pre-wrap;word-break:break-word;"><code>go <span style="color:#0aa">test</span> -test=XXX -bench <regex> -memprofile <file> -benchmem +</code></pre><h2 id="pprof">pprof</h2> <p><a href="https://github.com/google/pprof/blob/main/doc/README.md">pprof usage</a></p> -<pre tabindex="0" class="chroma"><code><span class="line"><span class="cl">go pprof -http<span class="o">=</span>:8080 profile.pb.gz -</span></span></code></pre> -<p>will show a web UI for analysing the profile.</p> - -<h2 id="views">views</h2> - +<pre tabindex="0" style="background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;white-space:pre-wrap;word-break:break-word;"><code>go pprof -http=:8080 profile.pb.gz +</code></pre><p>will show a web UI for analysing the profile.</p> +<h3 id="views">views</h3> <ul> <li>flame graph: <code>localhost:8080/ui/flamegraph</code> - <ul> -<li>shows percentage breakdown of how much resource each “call” made.</li> -<li>clicking a box will make it “100%” allowing for deep diving</li> -<li>right click “show source code” to view</li> -</ul></li> +<li>shows percentage breakdown of how much resource each "call" made.</li> +<li>clicking a box will make it "100%" allowing for deep diving</li> +<li>right click "show source code" to view</li> +</ul> +</li> <li>top: <code>localhost:8080/ui/top</code> - <ul> <li>shows top functions - <ul> <li><code>flat</code>: profile samples in this function</li> <li><code>cum</code>: (cumulative) profile samples in this function and its callees</li> -</ul></li> -</ul></li> +</ul> +</li> +</ul> +</li> <li>source: <code>localhost:8080/ui/source</code> - <ul> <li>each source line is annotated with the time spent in that source line - <ul> <li>the first number does not count time spent in functions called from the source line</li> <li>the second number does</li> -</ul></li> -</ul></li> +</ul> +</li> +</ul> +</li> </ul> |
