<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
        <title>Perf - Tag - NTOHL</title>
        <link>https://www.ntohl.com/en/tags/perf/</link>
        <description>Perf - Tag - NTOHL</description>
        <generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>wyatt@ntohl.com (Wyatt Sun)</managingEditor>
            <webMaster>wyatt@ntohl.com (Wyatt Sun)</webMaster><copyright>This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.</copyright><lastBuildDate>Wed, 09 Jan 2019 08:10:40 &#43;0000</lastBuildDate><atom:link href="https://www.ntohl.com/en/tags/perf/" rel="self" type="application/rss+xml" /><item>
    <title>Profiling C/C&#43;&#43; with google-perftools</title>
    <link>https://www.ntohl.com/en/google_perftools/</link>
    <pubDate>Wed, 09 Jan 2019 08:10:40 &#43;0000</pubDate>
    <author>wyatt@ntohl.com (Wyatt Sun)</author>
    <guid>https://www.ntohl.com/en/google_perftools/</guid>
    <description><![CDATA[<div class="featured-image">
                <img src="/images/posts/google_perftools.svg" referrerpolicy="no-referrer">
            </div><h2 id="install-libunwind">Install libunwind</h2>
<div class="code-block code-line-numbers open" style="counter-reset: code-block 0">
    <div class="code-header language-bash">
        <button type="button" class="code-title link-like" aria-expanded="true" aria-label="bash"><svg class="icon arrow" viewBox="0 0 256 512" fill="currentColor" width="1.25em" height="1em" aria-hidden="true"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path d="M247.1 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L179.2 256 41.9 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z"/></svg></button>
        <span class="ellipses"><svg class="icon" viewBox="0 0 448 512" fill="currentColor" width="1.25em" height="1em" aria-hidden="true"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path d="M0 256a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm168 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm224-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z"/></svg></span>
        <button type="button" class="line-numbers-toggle link-like" title="Line numbers" aria-label="Line numbers" aria-pressed="true"><svg class="icon" viewBox="0 0 512 512" fill="currentColor" width="1.25em" height="1em" aria-hidden="true"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path d="M0 72C0 58.8 10.7 48 24 48l48 0c13.3 0 24 10.7 24 24l0 104 24 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-96 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l24 0 0-80-24 0C10.7 96 0 85.3 0 72zM30.4 301.2C41.8 292.6 55.7 288 70 288l4.9 0c33.7 0 61.1 27.4 61.1 61.1 0 19.6-9.4 37.9-25.2 49.4l-24 17.5 33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-90.7 0C13.1 464 0 450.9 0 434.7 0 425.3 4.5 416.5 12.1 411l70.5-51.3c3.4-2.5 5.4-6.4 5.4-10.6 0-7.2-5.9-13.1-13.1-13.1L70 336c-3.9 0-7.7 1.3-10.8 3.6L38.4 355.2c-10.6 8-25.6 5.8-33.6-4.8S-1 324.8 9.6 316.8l20.8-15.6zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z"/></svg></button>
        <button type="button" class="wrap-toggle link-like" title="Wrap lines" aria-label="Wrap lines" aria-pressed="false"><svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" width="1.25em" height="1em" aria-hidden="true"><path d="M2 3.5h12M2 8h9.25a2.5 2.5 0 0 1 0 5H8M2 12.5h3.5M9.75 11.25 8 13l1.75 1.75"/></svg></button>
        <button type="button" class="copy link-like" title="Copy to clipboard" aria-label="Copy to clipboard" data-copied="Success" data-copy-failed="Failure"><svg class="icon" viewBox="0 0 448 512" fill="currentColor" width="1.25em" height="1em" aria-hidden="true"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path d="M384 336l-192 0c-8.8 0-16-7.2-16-16l0-256c0-8.8 7.2-16 16-16l133.5 0c4.2 0 8.3 1.7 11.3 4.7l58.5 58.5c3 3 4.7 7.1 4.7 11.3L400 320c0 8.8-7.2 16-16 16zM192 384l192 0c35.3 0 64-28.7 64-64l0-197.5c0-17-6.7-33.3-18.7-45.3L370.7 18.7C358.7 6.7 342.5 0 325.5 0L192 0c-35.3 0-64 28.7-64 64l0 256c0 35.3 28.7 64 64 64zM64 128c-35.3 0-64 28.7-64 64L0 448c0 35.3 28.7 64 64 64l192 0c35.3 0 64-28.7 64-64l0-16-48 0 0 16c0 8.8-7.2 16-16 16L64 464c-8.8 0-16-7.2-16-16l0-256c0-8.8 7.2-16 16-16l16 0 0-48-16 0z"/></svg></button><span class="copy-status" role="status"></span>
    </div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">wget https://github.com/libunwind/libunwind/releases/download/v1.3.0/libunwind-1.3.0.tar.gz --no-check-certificate
</span></span><span class="line"><span class="cl">tar -xvf libunwind-1.3.0.tar.gz
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> libunwind-1.3.0
</span></span><span class="line"><span class="cl">./configure
</span></span><span class="line"><span class="cl">make <span class="o">&amp;&amp;</span> make install</span></span></code></pre></div></div>
<h2 id="install-gperftools">Install gperftools</h2>
<div class="code-block code-line-numbers open" style="counter-reset: code-block 0">
    <div class="code-header language-bash">
        <button type="button" class="code-title link-like" aria-expanded="true" aria-label="bash"><svg class="icon arrow" viewBox="0 0 256 512" fill="currentColor" width="1.25em" height="1em" aria-hidden="true"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path d="M247.1 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L179.2 256 41.9 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z"/></svg></button>
        <span class="ellipses"><svg class="icon" viewBox="0 0 448 512" fill="currentColor" width="1.25em" height="1em" aria-hidden="true"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path d="M0 256a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm168 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm224-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z"/></svg></span>
        <button type="button" class="line-numbers-toggle link-like" title="Line numbers" aria-label="Line numbers" aria-pressed="true"><svg class="icon" viewBox="0 0 512 512" fill="currentColor" width="1.25em" height="1em" aria-hidden="true"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path d="M0 72C0 58.8 10.7 48 24 48l48 0c13.3 0 24 10.7 24 24l0 104 24 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-96 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l24 0 0-80-24 0C10.7 96 0 85.3 0 72zM30.4 301.2C41.8 292.6 55.7 288 70 288l4.9 0c33.7 0 61.1 27.4 61.1 61.1 0 19.6-9.4 37.9-25.2 49.4l-24 17.5 33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-90.7 0C13.1 464 0 450.9 0 434.7 0 425.3 4.5 416.5 12.1 411l70.5-51.3c3.4-2.5 5.4-6.4 5.4-10.6 0-7.2-5.9-13.1-13.1-13.1L70 336c-3.9 0-7.7 1.3-10.8 3.6L38.4 355.2c-10.6 8-25.6 5.8-33.6-4.8S-1 324.8 9.6 316.8l20.8-15.6zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z"/></svg></button>
        <button type="button" class="wrap-toggle link-like" title="Wrap lines" aria-label="Wrap lines" aria-pressed="false"><svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" width="1.25em" height="1em" aria-hidden="true"><path d="M2 3.5h12M2 8h9.25a2.5 2.5 0 0 1 0 5H8M2 12.5h3.5M9.75 11.25 8 13l1.75 1.75"/></svg></button>
        <button type="button" class="copy link-like" title="Copy to clipboard" aria-label="Copy to clipboard" data-copied="Success" data-copy-failed="Failure"><svg class="icon" viewBox="0 0 448 512" fill="currentColor" width="1.25em" height="1em" aria-hidden="true"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path d="M384 336l-192 0c-8.8 0-16-7.2-16-16l0-256c0-8.8 7.2-16 16-16l133.5 0c4.2 0 8.3 1.7 11.3 4.7l58.5 58.5c3 3 4.7 7.1 4.7 11.3L400 320c0 8.8-7.2 16-16 16zM192 384l192 0c35.3 0 64-28.7 64-64l0-197.5c0-17-6.7-33.3-18.7-45.3L370.7 18.7C358.7 6.7 342.5 0 325.5 0L192 0c-35.3 0-64 28.7-64 64l0 256c0 35.3 28.7 64 64 64zM64 128c-35.3 0-64 28.7-64 64L0 448c0 35.3 28.7 64 64 64l192 0c35.3 0 64-28.7 64-64l0-16-48 0 0 16c0 8.8-7.2 16-16 16L64 464c-8.8 0-16-7.2-16-16l0-256c0-8.8 7.2-16 16-16l16 0 0-48-16 0z"/></svg></button><span class="copy-status" role="status"></span>
    </div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">git clone https://github.com/gperftools/gperftools
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> gperftools/
</span></span><span class="line"><span class="cl">sh autogen.sh
</span></span><span class="line"><span class="cl">./configure
</span></span><span class="line"><span class="cl">make <span class="o">&amp;&amp;</span> make install
</span></span><span class="line"><span class="cl">ln -s /usr/local/lib/libprofiler.so.0 /usr/lib64/libprofiler.so.0</span></span></code></pre></div></div>
<p>For the symlink, 64-bit systems use <code>/usr/lib64/</code>, 32-bit systems <code>/usr/lib/</code>.</p>]]></description>
</item>
<item>
    <title>go tool pprof returns an empty debug/pprof/heap profile</title>
    <link>https://www.ntohl.com/en/golang_pprof_heap_empty/</link>
    <pubDate>Wed, 01 Aug 2018 07:43:55 &#43;0000</pubDate>
    <author>wyatt@ntohl.com (Wyatt Sun)</author>
    <guid>https://www.ntohl.com/en/golang_pprof_heap_empty/</guid>
    <description><![CDATA[<div class="featured-image">
                <img src="/images/posts/golang_pprof_heap_empty.svg" referrerpolicy="no-referrer">
            </div><p>Fetching <code>debug/pprof/heap</code> with <code>go tool pprof</code> gave an empty profile.</p>
<p>The reason is that Go samples memory allocations by default once every 512KB (<code>runtime.MemProfileRate</code> defaults to <code>512 * 1024</code>). If the process doesn&rsquo;t allocate that much during the window, no samples are taken at all and the profile stays empty.</p>
<p>The fix is to shrink the sampling interval, most easily through the <code>GODEBUG</code> environment variable:</p>
<div class="code-block code-line-numbers open" style="counter-reset: code-block 0">
    <div class="code-header language-bash">
        <button type="button" class="code-title link-like" aria-expanded="true" aria-label="bash"><svg class="icon arrow" viewBox="0 0 256 512" fill="currentColor" width="1.25em" height="1em" aria-hidden="true"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path d="M247.1 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L179.2 256 41.9 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z"/></svg></button>
        <span class="ellipses"><svg class="icon" viewBox="0 0 448 512" fill="currentColor" width="1.25em" height="1em" aria-hidden="true"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path d="M0 256a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm168 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm224-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z"/></svg></span>
        <button type="button" class="line-numbers-toggle link-like" title="Line numbers" aria-label="Line numbers" aria-pressed="true"><svg class="icon" viewBox="0 0 512 512" fill="currentColor" width="1.25em" height="1em" aria-hidden="true"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path d="M0 72C0 58.8 10.7 48 24 48l48 0c13.3 0 24 10.7 24 24l0 104 24 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-96 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l24 0 0-80-24 0C10.7 96 0 85.3 0 72zM30.4 301.2C41.8 292.6 55.7 288 70 288l4.9 0c33.7 0 61.1 27.4 61.1 61.1 0 19.6-9.4 37.9-25.2 49.4l-24 17.5 33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-90.7 0C13.1 464 0 450.9 0 434.7 0 425.3 4.5 416.5 12.1 411l70.5-51.3c3.4-2.5 5.4-6.4 5.4-10.6 0-7.2-5.9-13.1-13.1-13.1L70 336c-3.9 0-7.7 1.3-10.8 3.6L38.4 355.2c-10.6 8-25.6 5.8-33.6-4.8S-1 324.8 9.6 316.8l20.8-15.6zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z"/></svg></button>
        <button type="button" class="wrap-toggle link-like" title="Wrap lines" aria-label="Wrap lines" aria-pressed="false"><svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" width="1.25em" height="1em" aria-hidden="true"><path d="M2 3.5h12M2 8h9.25a2.5 2.5 0 0 1 0 5H8M2 12.5h3.5M9.75 11.25 8 13l1.75 1.75"/></svg></button>
        <button type="button" class="copy link-like" title="Copy to clipboard" aria-label="Copy to clipboard" data-copied="Success" data-copy-failed="Failure"><svg class="icon" viewBox="0 0 448 512" fill="currentColor" width="1.25em" height="1em" aria-hidden="true"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path d="M384 336l-192 0c-8.8 0-16-7.2-16-16l0-256c0-8.8 7.2-16 16-16l133.5 0c4.2 0 8.3 1.7 11.3 4.7l58.5 58.5c3 3 4.7 7.1 4.7 11.3L400 320c0 8.8-7.2 16-16 16zM192 384l192 0c35.3 0 64-28.7 64-64l0-197.5c0-17-6.7-33.3-18.7-45.3L370.7 18.7C358.7 6.7 342.5 0 325.5 0L192 0c-35.3 0-64 28.7-64 64l0 256c0 35.3 28.7 64 64 64zM64 128c-35.3 0-64 28.7-64 64L0 448c0 35.3 28.7 64 64 64l192 0c35.3 0 64-28.7 64-64l0-16-48 0 0 16c0 8.8-7.2 16-16 16L64 464c-8.8 0-16-7.2-16-16l0-256c0-8.8 7.2-16 16-16l16 0 0-48-16 0z"/></svg></button><span class="copy-status" role="status"></span>
    </div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">export</span> <span class="nv">GODEBUG</span><span class="o">=</span><span class="s2">&#34;memprofilerate=1&#34;</span></span></span></code></pre></div></div>
<p><code>1</code> means sample on every allocation. That costs real performance, so only turn it on while you&rsquo;re debugging.</p>]]></description>
</item>
<item>
    <title>golang pprof returns 404 page not found for debug/pprof</title>
    <link>https://www.ntohl.com/en/golang_pprof_404/</link>
    <pubDate>Wed, 01 Aug 2018 03:23:31 &#43;0000</pubDate>
    <author>wyatt@ntohl.com (Wyatt Sun)</author>
    <guid>https://www.ntohl.com/en/golang_pprof_404/</guid>
    <description><![CDATA[<div class="featured-image">
                <img src="/images/posts/golang_pprof_404.svg" referrerpolicy="no-referrer">
            </div><p>Hitting <code>/debug/pprof/</code> always returned <code>404 page not found</code>. The explanation starts with how <code>net/http/pprof</code> registers itself:</p>
<div class="code-block code-line-numbers open" style="counter-reset: code-block 0">
    <div class="code-header language-go">
        <button type="button" class="code-title link-like" aria-expanded="true" aria-label="go"><svg class="icon arrow" viewBox="0 0 256 512" fill="currentColor" width="1.25em" height="1em" aria-hidden="true"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path d="M247.1 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L179.2 256 41.9 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z"/></svg></button>
        <span class="ellipses"><svg class="icon" viewBox="0 0 448 512" fill="currentColor" width="1.25em" height="1em" aria-hidden="true"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path d="M0 256a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm168 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm224-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z"/></svg></span>
        <button type="button" class="line-numbers-toggle link-like" title="Line numbers" aria-label="Line numbers" aria-pressed="true"><svg class="icon" viewBox="0 0 512 512" fill="currentColor" width="1.25em" height="1em" aria-hidden="true"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path d="M0 72C0 58.8 10.7 48 24 48l48 0c13.3 0 24 10.7 24 24l0 104 24 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-96 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l24 0 0-80-24 0C10.7 96 0 85.3 0 72zM30.4 301.2C41.8 292.6 55.7 288 70 288l4.9 0c33.7 0 61.1 27.4 61.1 61.1 0 19.6-9.4 37.9-25.2 49.4l-24 17.5 33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-90.7 0C13.1 464 0 450.9 0 434.7 0 425.3 4.5 416.5 12.1 411l70.5-51.3c3.4-2.5 5.4-6.4 5.4-10.6 0-7.2-5.9-13.1-13.1-13.1L70 336c-3.9 0-7.7 1.3-10.8 3.6L38.4 355.2c-10.6 8-25.6 5.8-33.6-4.8S-1 324.8 9.6 316.8l20.8-15.6zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z"/></svg></button>
        <button type="button" class="wrap-toggle link-like" title="Wrap lines" aria-label="Wrap lines" aria-pressed="false"><svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" width="1.25em" height="1em" aria-hidden="true"><path d="M2 3.5h12M2 8h9.25a2.5 2.5 0 0 1 0 5H8M2 12.5h3.5M9.75 11.25 8 13l1.75 1.75"/></svg></button>
        <button type="button" class="copy link-like" title="Copy to clipboard" aria-label="Copy to clipboard" data-copied="Success" data-copy-failed="Failure"><svg class="icon" viewBox="0 0 448 512" fill="currentColor" width="1.25em" height="1em" aria-hidden="true"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path d="M384 336l-192 0c-8.8 0-16-7.2-16-16l0-256c0-8.8 7.2-16 16-16l133.5 0c4.2 0 8.3 1.7 11.3 4.7l58.5 58.5c3 3 4.7 7.1 4.7 11.3L400 320c0 8.8-7.2 16-16 16zM192 384l192 0c35.3 0 64-28.7 64-64l0-197.5c0-17-6.7-33.3-18.7-45.3L370.7 18.7C358.7 6.7 342.5 0 325.5 0L192 0c-35.3 0-64 28.7-64 64l0 256c0 35.3 28.7 64 64 64zM64 128c-35.3 0-64 28.7-64 64L0 448c0 35.3 28.7 64 64 64l192 0c35.3 0 64-28.7 64-64l0-16-48 0 0 16c0 8.8-7.2 16-16 16L64 464c-8.8 0-16-7.2-16-16l0-256c0-8.8 7.2-16 16-16l16 0 0-48-16 0z"/></svg></button><span class="copy-status" role="status"></span>
    </div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-go" data-lang="go"><span class="line"><span class="cl"><span class="kd">func</span><span class="w"> </span><span class="nf">init</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">	</span><span class="nx">http</span><span class="p">.</span><span class="nf">HandleFunc</span><span class="p">(</span><span class="s">&#34;/debug/pprof/&#34;</span><span class="p">,</span><span class="w"> </span><span class="nx">Index</span><span class="p">)</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">	</span><span class="nx">http</span><span class="p">.</span><span class="nf">HandleFunc</span><span class="p">(</span><span class="s">&#34;/debug/pprof/cmdline&#34;</span><span class="p">,</span><span class="w"> </span><span class="nx">Cmdline</span><span class="p">)</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">	</span><span class="nx">http</span><span class="p">.</span><span class="nf">HandleFunc</span><span class="p">(</span><span class="s">&#34;/debug/pprof/profile&#34;</span><span class="p">,</span><span class="w"> </span><span class="nx">Profile</span><span class="p">)</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">	</span><span class="nx">http</span><span class="p">.</span><span class="nf">HandleFunc</span><span class="p">(</span><span class="s">&#34;/debug/pprof/symbol&#34;</span><span class="p">,</span><span class="w"> </span><span class="nx">Symbol</span><span class="p">)</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">	</span><span class="nx">http</span><span class="p">.</span><span class="nf">HandleFunc</span><span class="p">(</span><span class="s">&#34;/debug/pprof/trace&#34;</span><span class="p">,</span><span class="w"> </span><span class="nx">Trace</span><span class="p">)</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div>
<p>Importing <code>_ &quot;net/http/pprof&quot;</code> registers those five routes on <code>http.DefaultServeMux</code> from <code>init</code>. If the service uses its own router (httprouter, in my case), requests never reach <code>DefaultServeMux</code>, the pprof routes are dead weight, and you get a 404.</p>]]></description>
</item>
</channel>
</rss>
