Expand description
Annotations for Firefox Profiler profiles.
Firefox Profiler can display user-defined annotations for timespans and events, as well as information about network activity and memory use, but only if the profiler added those annotations. The popular samply profiler, however, has only very limited support for adding these annotations. This crate provides a way for a process that is being profiled to record its own annotations and then merge them into profiler output in a postprocessing step.
§Use
This crate can be integrated into an existing profiler workflow. For
example, the Feldera incremental compute engine runs samply as a
subprocess, targeting itself. While samply runs, Feldera uses Capture,
Span, LongSpan, and Event to record annotations. After samply
completes, Feldera finishes the capture to obtain Annotations, applies
them, and then passes the postprocessed output to the user. The annotation
step is invisible to the user.
Short of this kind of integration, where a process effectively profiles itself, there must be some way to enable capturing and saving profile data. For example, a command-line option or an environment variable could do the trick. Once the capture is complete, the process needs to somehow save the annotations.
§Viewing in Firefox Profiler
Spans and events logged by this module show up in the Marker Chart and Marker Table tabs for a given thread. They are linked to particular threads and the profiler will only show them when those threads are selected.
Spans and events are enabled only when a profile is running. They have minimal overhead otherwise.
Structs§
- Annotation
Options - Options for applying annotations.
- Annotations
- Profile annotation data.
- Capture
- An in-progress capture of profile annotations.
- Capture
Options - Options for capturing profile annotations.
- Event
- Annotates an event during a Capture.
- Long
Span - A relatively expensive way to annotate a longer timespan during Captures.
- Long
Span Builder - Builds a LongSpan for annotating a long timespan.
- Span
- Annotates a timespan during a Capture.
Enums§
- Error
- Error returned by Annotations::apply.