Expand description
This crate is a set of safe bindings to the client library of the Tracy profiler.
If you have already instrumented your application with tracing, consider the tracing-tracy
crate.
§Important note
Depending on the configuration Tracy may broadcast discovery packets to the local network and expose the data it collects in the background to that same network. Traces collected by Tracy may include source and assembly code as well.
As thus, you may want make sure to only enable the tracy-client crate conditionally, via
the enable feature flag provided by this crate.
§Features
The following crate features are provided to customize the functionality of the Tracy client:
enable– enables the Tracy client. Corresponds to theTRACY_ENABLEdefine.flush-on-exit– waits for Tracy to connect and read out the profiling data before the program terminates. Corresponds to theTRACY_NO_EXITdefine. Does not work in combination with themanual-lifetimefeature.manual-lifetime– allow for manual initialization and deinitialization of the profiler data structures. Corresponds to theTRACY_MANUAL_LIFETIMEdefine.tracy_client::Clienttransparently switches to manual lifetime management when this feature is enabled. Impliesdelayed-init.system-tracing– enable capture of system level details. Corresponds to theTRACY_NO_SYSTEM_TRACINGdefine.context-switch-tracing– enable capture of the context switch data. Corresponds to theTRACY_NO_CONTEXT_SWITCHdefine.sampling– enable periodic sampling of the call stack. Corresponds to theTRACY_NO_SAMPLINGdefine.code-transfer– enable transfer of the machine code to the profiler. Corresponds to theTRACY_NO_CODE_TRANSFERdefine.broadcast– announce presence of the client to the profilers on the local network. Corresponds to theTRACY_NO_BROADCASTdefine.only-localhost– listen for profilers on the localhost interface only. Corresponds to theTRACY_ONLY_LOCALHOSTdefine.only-ipv4– listen for profilers on IPv4 interfaces only. Corresponds to theTRACY_ONLY_IPV4define.timer-fallback– allow running on devices without a high resolution timer support. Corresponds to theTRACY_TIMER_FALLBACKdefine.ondemand– start collecting traces only when a server connects to the client. Corresponds to theTRACY_ON_DEMANDdefine.fibers– enable support for instrumenting fibers, coroutines and similar such asynchrony primitives. Corresponds to theTRACY_FIBERSdefine.callstack-inlines- enables resolution of inline frames for call stacks. Disabling it will make the profiler use the basic but much faster frame resolution mode. Corresponds to theTRACY_NO_CALLSTACK_INLINESdefine.delayed-init– initializes trace structures upon a first request, rather than at load time. Corresponds to theTRACY_DELAYED_INITdefine.demangle- requires that the demangling function be defined by the user. See theregister_demangler!macro for more details. Corresponds to theTRACY_DEMANGLEdefine.verify- enables verification that instrumentation is well formed. Enabling this introduces additional instrumentation overhead (~50% for 0 callstack depth spans.) When disabled corresponds to theTRACY_NO_VERIFYdefine.debuginfod- enables debuginfo for system libraries on systems supporting debuginfod. Corresponds to theTRACY_DEBUGINFODdefine.
Refer to this package’s Cargo.toml for the list of the features enabled by default. Refer to
the Tracy manual for more information on the implications of each feature.
Re-exports§
pub use sys;
Modules§
- demangle
demangle - Custom symbol demangling support.
Macros§
- frame_
name - Construct a
FrameName. - non_
continuous_ frame - Convenience macro for
Client::non_continuous_frameon the current client. - plot
- Convenience macro for
Client::ploton the current client. - plot_
name - Construct a
PlotName. - register_
demangler demangle - Registers a custom demangler function.
- secondary_
frame_ mark - Convenience macro for
Client::secondary_frame_markon the current client. - set_
thread_ name - Convenience macro for
Client::set_thread_nameon the current client. - span
- Start a new Tracy span with function, file, and line determined automatically.
- span_
location - Construct a
&’static SpanLocation.
Structs§
- Client
- A type representing an enabled Tracy client.
- Frame
- A non-continuous frame region.
- Frame
Name - A name for secondary and non-continuous frames.
- GpuContext
- Context for creating gpu spans.
- GpuSpan
- Span for timing gpu work.
- Plot
Configuration - Configuration for how a plot appears in the Tracy profiling UI.
- Plot
Name - Name of a plot.
- Profiled
Allocator - A profiling wrapper around another allocator.
- Span
- A handle representing a span of execution.
- Span
Location - A statically allocated location information for a span.
Enums§
- GpuContext
Creation Error - Errors that can occur when creating a gpu context.
- GpuContext
Type - The API label associated with the given gpu context. The list here only includes APIs that are currently supported by Tracy’s own gpu implementations.
- GpuSpan
Creation Error - Errors that can occur when creating a gpu span.
- Plot
Format - The format of a plot to be shown in the Tracy profiler UI.
- Plot
Line Style - The style of lines of a plot, shown in the Tracy profiler UI.
Functions§
- frame_
image - Convenience shortcut for
Client::frame_imageon the current client. - frame_
mark - Convenience shortcut for
Client::frame_markon the current client.