Convert Stack Samples to Trace Events
Asked at Anthropic · Coding Questions · Difficulty: Medium · Last asked Jun 17, 2026
A sampling profiler records the program's call stack at regular intervals. A trace viewer instead wants spans: "this function ran from time 3 to time 7". Convert a list of stack samples into such trace events, one event per stretch of time a stack frame was running. A debounce parameter `k` lets a frame stay open across short gaps, which removes flicker caused by noisy sampling.
Loading the problem…