hydro_deploy/rust_crate/
tracing_options.rs

1#![allow(clippy::too_many_arguments, reason = "buildstructor")]
2#![allow(
3    unexpected_cfgs,
4    reason = "https://github.com/BrynCooke/buildstructor/issues/192"
5)]
6
7use std::path::PathBuf;
8
9use inferno::collapse::dtrace::Options as DtraceOptions;
10use inferno::collapse::perf::Options as PerfOptions;
11
12type FlamegraphOptions = inferno::flamegraph::Options<'static>;
13
14#[derive(Clone, buildstructor::Builder)]
15#[non_exhaustive] // Prevent direct construction.
16pub struct TracingOptions {
17    /// Samples per second.
18    pub frequency: u32,
19
20    /// Output filename for `dtrace`. Example: `my_worker.stacks`.
21    pub dtrace_outfile: Option<PathBuf>,
22
23    /// Output filename for the raw data emitted by `perf record`. Example: `my_worker.perf.data`.
24    pub perf_raw_outfile: Option<PathBuf>,
25
26    // /// Output filename for `perf script -i <`[`Self::perf_raw_outfile`]`>`. Example: `my_worker.perf`.
27    // pub perf_script_outfile: Option<PathBuf>,
28    /// If set, what the write the folded output to.
29    pub fold_outfile: Option<PathBuf>,
30    pub fold_dtrace_options: Option<DtraceOptions>,
31    pub fold_perf_options: Option<PerfOptions>,
32    /// If set, what to write the output flamegraph SVG file to.
33    pub flamegraph_outfile: Option<PathBuf>,
34    // This type is super annoying and isn't `clone` and has a lifetime... so wrap in fn pointer for now.
35    pub flamegraph_options: Option<fn() -> FlamegraphOptions>,
36}