Last updated:
Investigate Callers and Callees
Use Sandwich to inspect a selected frame's callers and callees. See Frame and call stack for these relationships.
When to use Sandwich
Sandwich helps most when a function is reached through many different stacks, so its cost is spread thin across a flame graph:
- Memory allocations: Allocations are expensive and happen deep in many unrelated stacks. Select the allocation function in a memory profile. Its callers show the code paths that lead to the most allocation, however deep and distributed they are.
- Shared code: A library used by many applications across a company is reached through different call stacks in each one. The callers show which applications and paths account for most of its cost.
Read the Sandwich view
Filter the profiles by workload and time range.
The view has two sections:
- CALLERS: Inspect the upper section to understand which operations lead into the frame.
- CALLEES: Inspect the lower section to understand where the frame delegates work.
A helper can have several callers, so changing one may leave most of its cost untouched. A wide parent can also owe most of its value to a single callee. Read values in the selected profile's units.
The screenshot follows an OpenTelemetry Collector queue-batch function. Its caller path leads through queue consumption. Its callee path continues into exporter sending and retry functions.
Reduce unrelated code
Use Add filter to restrict stacks or filter frames. Keep caller context when investigating why a function contributes to the profile. Avoid hiding runtime frames if the runtime may explain the measurement.
Return to Table to check the function's Self and Total, or Flame Graph to choose a different path for investigation.
Sandwich shows relationships in sampled stacks. It is not a complete static call graph and does not count every invocation.
Further Reading
- About Profiling — Overview of profiling workflows.
- Analyze Flame Graphs — Find a frame and inspect its call paths.
- Filter and Group Profiles — Focus on relevant stacks and frames.
- Find Hot Functions in the Table — Rank functions before inspecting their context.
