Reference
spoor
noun | the track or scent of an animal
verb | follow or scent of (an animal or person)
Metaphor
Your application is the animal and the function traces are the scent it leaves behind.
Introduction
Spoor gives you deep insight into your application's performance. Its three-part toolchain enables you to analyze your application down to the function call with nanosecond precision and includes:
- Compiler instrumentation to auto-inject trace events.
- A runtime library to capture and buffer events.
- Tools to process and visualize the traces.
Goals
Spoor is designed to achieve the following goals.
- Develop a tool capable of collecting an exhaustive application trace including function entries and exists with highly accurate timestamps.
- Be language- and platform-independent.
- Have a virtually imperceptible performance impact when turned off and a "usable" performance impact when turned on. This includes deferring as much processing as possible to an offline postprocessing tool.
- Provide configurable parameters that allow developers to tune the runtime performance (speed, memory, and disk space) of the tracing, possibly at the expense of dropping events.
- Allow the instrumented application to dynamically enable tracing, disable tracing, and flush the buffers.
- Achieve all runtime features in-process.
Project status
Spoor is still in its infancy and should be considered alpha-quality software. Please anticipate breaking changes, report bugs that you encounter, and consider contributing code to support Spoor's development.
Alternatives
XRay
XRay is a toolchain that also collects high-accuracy function traces with the ability to dynamically enable and disable tracing at runtime. At a high level, XRay's architecture is similar to Spoor's because it combines compiler-inserted instrumentation with a runtime library to collect traces.
However, XRay's implementation and underlying architecture differs. XRay dynamically enables and disables tracing by patching the binary at runtime to insert or remove function entry and exit logs whereas Spoor checks if the runtime is enabled before logging.
Although XRay's approach is more efficient, is does not work on Apple platforms because the kernel does not permit patching the binary at runtime due to the resulting security and performance implications.
XRay is open sourced as part of the LLVM project.
https://llvm.org/docs/XRay.html
dtrace
dtrace is a static and dynamic tracing framework that samples an application's runtime stack.
Unlike Spoor, dtrace's dynamic tracing can capture non-instrumented code including operating system kernel calls and precompiled libraries, however, does not run in-process and captures samples (i.e., not an exhaustive trace) of an application.