This repository has been archived on 2022-04-04. You can view files and clone it, but cannot push or open issues or pull requests.

60 lines
16 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Usage:"><meta name="keywords" content="rust, rustlang, rust-lang, puffin"><title>puffin - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><script defer src="../main.js"></script>
<noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a class="sidebar-logo" href="../puffin/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.png" alt="logo"></div>
</a><h2 class="location">Crate puffin</h2><div class="block version"><div class="narrow-helper"></div><p>Version 0.13.1</p></div><div class="sidebar-elems"><a id="all-types" href="all.html"><p>See all puffin's items</p></a><div class="block items"><ul><li><a href="#macros">Macros</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#functions">Functions</a></li><li><a href="#types">Type Definitions</a></li></ul></div><div id="sidebar-vars" data-name="puffin" data-ty="mod" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../puffin/index.html"><img class="rust-logo" src="../rust-logo.png" alt="logo"></a><nav class="sub"><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav></div><section id="main-content" class="content"><h1 class="fqn"><span class="in-band">Crate <a class="mod" href="#">puffin</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../src/puffin/lib.rs.html#1-741" title="goto source code">[src]</a></span></h1><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Usage:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">fn</span> <span class="ident">main</span>() {
<span class="ident">puffin::set_scopes_on</span>(<span class="bool-val">true</span>); <span class="comment">// you may want to control this with a flag</span>
<span class="comment">// game loop</span>
<span class="kw">loop</span> {
<span class="ident">puffin::GlobalProfiler::lock</span>().<span class="ident">new_frame</span>();
{
<span class="macro">puffin::profile_scope!</span>(<span class="string">&quot;slow_code&quot;</span>);
<span class="ident">slow_code</span>();
}
}
}
</code></pre></div>
</div></details><h2 id="macros" class="small-section-header"><a href="#macros">Macros</a></h2>
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="macro" href="macro.current_file_name.html" title="puffin::current_file_name macro">current_file_name</a></div><div class="item-right docblock-short"><p>Returns a shortened path to the current file.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="macro" href="macro.current_function_name.html" title="puffin::current_function_name macro">current_function_name</a></div><div class="item-right docblock-short"><p>Returns the name of the calling function without a long module path prefix.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="macro" href="macro.profile_function.html" title="puffin::profile_function macro">profile_function</a></div><div class="item-right docblock-short"><p>Automatically name the profiling scope based on function name.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="macro" href="macro.profile_scope.html" title="puffin::profile_scope macro">profile_scope</a></div><div class="item-right docblock-short"><p>Profile the current scope with the given name (unique in the parent scope).</p>
</div></div></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2>
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.FrameData.html" title="puffin::FrameData struct">FrameData</a></div><div class="item-right docblock-short"><p>One frame worth of profile data, collected from many sources.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.FrameMeta.html" title="puffin::FrameMeta struct">FrameMeta</a></div><div class="item-right docblock-short"><p>Meta-information about a frame.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.FrameSinkId.html" title="puffin::FrameSinkId struct">FrameSinkId</a></div><div class="item-right docblock-short"><p>Identifies a specific <a href="type.FrameSink.html" title="FrameSink"><code>FrameSink</code></a> when added to <a href="struct.GlobalProfiler.html" title="GlobalProfiler"><code>GlobalProfiler</code></a>.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.FrameView.html" title="puffin::FrameView struct">FrameView</a></div><div class="item-right docblock-short"><p>A view of recent and slowest frames, used by GUIs.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.GlobalFrameView.html" title="puffin::GlobalFrameView struct">GlobalFrameView</a></div><div class="item-right docblock-short"><p>Automatically connects to <a href="struct.GlobalProfiler.html" title="crate::GlobalProfiler"><code>crate::GlobalProfiler</code></a>.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.GlobalProfiler.html" title="puffin::GlobalProfiler struct">GlobalProfiler</a></div><div class="item-right docblock-short"><p>Singleton. Collects profiling data from multiple threads
and passes them on to different <a href="type.FrameSink.html" title="FrameSink"><code>FrameSink</code></a>s.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.MergeScope.html" title="puffin::MergeScope struct">MergeScope</a></div><div class="item-right docblock-short"><p>A scope that has been merged from many different sources</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ProfilerScope.html" title="puffin::ProfilerScope struct">ProfilerScope</a></div><div class="item-right docblock-short"><p>Created by the <code>puffin::profile*!(...)</code> macros.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Reader.html" title="puffin::Reader struct">Reader</a></div><div class="item-right docblock-short"><p>Parses a <a href="struct.Stream.html" title="Stream"><code>Stream</code></a> of profiler data.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Record.html" title="puffin::Record struct">Record</a></div><div class="item-right docblock-short"><p>Used when parsing a Stream.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Scope.html" title="puffin::Scope struct">Scope</a></div><div class="item-right docblock-short"><p>Used when parsing a Stream.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Stream.html" title="puffin::Stream struct">Stream</a></div><div class="item-right docblock-short"><p>Stream of profiling events from one thread.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.StreamInfo.html" title="puffin::StreamInfo struct">StreamInfo</a></div><div class="item-right docblock-short"><p>A <a href="struct.Stream.html" title="Stream"><code>Stream</code></a> plus some info about it.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.StreamInfoRef.html" title="puffin::StreamInfoRef struct">StreamInfoRef</a></div><div class="item-right docblock-short"><p>A reference to the contents of a <a href="struct.StreamInfo.html" title="StreamInfo"><code>StreamInfo</code></a>.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ThreadInfo.html" title="puffin::ThreadInfo struct">ThreadInfo</a></div><div class="item-right docblock-short"><p>Used to identify one source of profiling data.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ThreadProfiler.html" title="puffin::ThreadProfiler struct">ThreadProfiler</a></div><div class="item-right docblock-short"><p>Collects profiling data for one thread</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.UnpackedFrameData.html" title="puffin::UnpackedFrameData struct">UnpackedFrameData</a></div><div class="item-right docblock-short"><p>One frame worth of profile data, collected from many sources.</p>
</div></div></div><h2 id="enums" class="small-section-header"><a href="#enums">Enums</a></h2>
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Error.html" title="puffin::Error enum">Error</a></div><div class="item-right docblock-short"><p>Errors that can happen when parsing a <a href="struct.Stream.html" title="Stream"><code>Stream</code></a> of profile data.</p>
</div></div></div><h2 id="functions" class="small-section-header"><a href="#functions">Functions</a></h2>
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.are_scopes_on.html" title="puffin::are_scopes_on fn">are_scopes_on</a></div><div class="item-right docblock-short"><p>Are the profiler scope macros turned on?
This is <a href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html" title="false"><code>false</code></a> by default.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.global_reporter.html" title="puffin::global_reporter fn">global_reporter</a></div><div class="item-right docblock-short"><p>Report a stream of profile data from a thread to the <a href="struct.GlobalProfiler.html" title="GlobalProfiler"><code>GlobalProfiler</code></a> singleton.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.merge_scopes_for_thread.html" title="puffin::merge_scopes_for_thread fn">merge_scopes_for_thread</a></div><div class="item-right docblock-short"><p>For the given thread, merge all scopes with the same id path.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.now_ns.html" title="puffin::now_ns fn">now_ns</a></div><div class="item-right docblock-short"><p>Returns a high-precision, monotonically increasing nanosecond count since unix epoch.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.select_slowest.html" title="puffin::select_slowest fn">select_slowest</a></div><div class="item-right docblock-short"><p>Select the slowest frames, up to a certain count.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.set_scopes_on.html" title="puffin::set_scopes_on fn">set_scopes_on</a></div><div class="item-right docblock-short"><p>Turn on/off the profiler macros (<a href="macro.profile_function.html" title="profile_function"><code>profile_function</code></a>, <a href="macro.profile_scope.html" title="profile_scope"><code>profile_scope</code></a> etc).
When off, these calls take only 1-2 ns to call (100x faster).
This is <a href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html" title="false"><code>false</code></a> by default.</p>
</div></div></div><h2 id="types" class="small-section-header"><a href="#types">Type Definitions</a></h2>
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="type" href="type.FrameIndex.html" title="puffin::FrameIndex type">FrameIndex</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="type" href="type.FrameSink.html" title="puffin::FrameSink type">FrameSink</a></div><div class="item-right docblock-short"><p>Add these to <a href="struct.GlobalProfiler.html" title="GlobalProfiler"><code>GlobalProfiler</code></a> with <a href="struct.GlobalProfiler.html#method.add_sink" title="GlobalProfiler::add_sink()"><code>GlobalProfiler::add_sink()</code></a>.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="type" href="type.NanoSecond.html" title="puffin::NanoSecond type">NanoSecond</a></div><div class="item-right docblock-short"><p>All times are expressed as integer nanoseconds since some event.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="type" href="type.Result.html" title="puffin::Result type">Result</a></div><div class="item-right docblock-short"></div></div></div></section><section id="search" class="content hidden"></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="puffin" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.59.0 (9d1b2106e 2022-02-23)" ></div>
</body></html>