ocaml-trace/trace-tef/Trace_tef/index.html
2026-01-21 01:33:49 +00:00

7 lines
6.5 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 xmlns="http://www.w3.org/1999/xhtml"><head><title>Trace_tef (trace-tef.Trace_tef)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 3.1.0"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> <a href="../../index.html">Index</a> &#x00BB; <a href="../index.html">trace-tef</a> &#x00BB; Trace_tef</nav><header class="odoc-preamble"><h1>Module <code><span>Trace_tef</span></code></h1><p>TEF collector for Trace.</p><p>This emits chrome traces (https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/), which are very simple and a known quantity.</p><p>They can be opened in https://ui.perfetto.dev .</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec module anchored" id="module-Collector_tef"><a href="#module-Collector_tef" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Collector_tef/index.html">Collector_tef</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Exporter"><a href="#module-Exporter" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Exporter/index.html">Exporter</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>An exporter, takes JSON objects and writes them somewhere</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Writer"><a href="#module-Writer" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Writer/index.html">Writer</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Write JSON events to a buffer.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Types"><a href="#module-Types" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Types/index.html">Types</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-output"><a href="#type-output" class="anchor"></a><code><span><span class="keyword">type</span> output</span><span> = </span><span>[ </span></code><ol><li id="type-output.Stdout" class="def variant constructor anchored"><a href="#type-output.Stdout" class="anchor"></a><code><span>| </span><span>`Stdout</span></code></li><li id="type-output.Stderr" class="def variant constructor anchored"><a href="#type-output.Stderr" class="anchor"></a><code><span>| </span><span>`Stderr</span></code></li><li id="type-output.File" class="def variant constructor anchored"><a href="#type-output.File" class="anchor"></a><code><span>| </span><span>`File <span class="keyword">of</span> string</span></code></li></ol><code><span> ]</span></code></div><div class="spec-doc"><p>Output for tracing.</p><ul><li><code>`Stdout</code> will enable tracing and print events on stdout</li><li><code>`Stderr</code> will enable tracing and print events on stderr</li><li><code>`File &quot;foo&quot;</code> will enable tracing and print events into file named &quot;foo&quot;</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-collector"><a href="#val-collector" class="anchor"></a><code><span><span class="keyword">val</span> collector : <span><span class="label">out</span>:<span>[&lt; <a href="#type-output">output</a> ]</span> <span class="arrow">&#45;&gt;</span></span> <span>unit <span class="arrow">&#45;&gt;</span></span> <a href="../../trace/Trace_core/index.html#type-collector">Trace_core.collector</a></span></code></div><div class="spec-doc"><p>Make a collector that writes into the given output. See <a href="#val-setup"><code>setup</code></a> for more details.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-setup"><a href="#val-setup" class="anchor"></a><code><span><span class="keyword">val</span> setup : <span><span class="optlabel">?debug</span>:bool <span class="arrow">&#45;&gt;</span></span> <span><span class="optlabel">?out</span>:<span>[ <a href="#type-output">output</a> <span>| `Env</span> ]</span> <span class="arrow">&#45;&gt;</span></span> <span>unit <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>setup ()</code> installs the collector depending on <code>out</code>.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">out</span> <p>can take different values:</p><ul><li>regular <a href="#type-output"><code>output</code></a> value to specify where events go</li><li><code>`Env</code> will enable tracing if the environment variable &quot;TRACE&quot; is set.</li></ul></li></ul><ul><li>If it's set to &quot;1&quot;, then the file is &quot;trace.json&quot;.</li><li>If it's set to &quot;stdout&quot;, then logging happens on stdout (since 0.2)</li><li>If it's set to &quot;stderr&quot;, then logging happens on stdout (since 0.2)</li><li>Otherwise, if it's set to a non empty string, the value is taken to be the file path into which to write.</li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">debug</span> <p>if true, use <code>Trace_debug</code>. Default <code>false</code>.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_setup"><a href="#val-with_setup" class="anchor"></a><code><span><span class="keyword">val</span> with_setup :
<span><span class="optlabel">?debug</span>:bool <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?out</span>:<span>[ <a href="#type-output">output</a> <span>| `Env</span> ]</span> <span class="arrow">&#45;&gt;</span></span>
<span>unit <span class="arrow">&#45;&gt;</span></span>
<span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span>
<span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>with_setup () f</code> (optionally) sets a collector up, calls <code>f()</code>, and makes sure to shutdown before exiting. since 0.2 a () argument was added.</p></div></div></div></body></html>