Re: [PATCH v8 0/4] perf sched latency: Refine outputs, unit scaling, and histogram support

From: Aaron Tomlin

Date: Thu Aug 06 2026 - 10:11:56 EST


On Wed, Aug 05, 2026 at 03:02:06PM -0700, Ian Rogers wrote:
> On Wed, Aug 5, 2026 at 2:08 PM Aaron Tomlin <atomlin@xxxxxxxxxxx> wrote:
> >
> > Hi Namhyung, Ian, Arnaldo,
> >
> > This patch series improves 'perf sched latency' by suppressing misleading
> > empty table output, extending pipe mode stream processing, introducing
> > dynamic unit auto-scaling for latency and runtime statistics, and adding
> > latency histogram visualisation alongside time-span filtering.
> >
> > Patch 1 addresses an issue where 'perf sched latency' fell through and
> > returned success (0) when perf_session__has_traces() failed due to missing
> > tracepoint events in a perf.data file. This caused empty header tables and
> > zeroed summary statistics to be rendered. In addition,
> > thread__get_runtime() in map_switch_event() is guarded against potential
> > NULL pointer dereferences under memory allocation failures.
> >
> > Patch 2 extends pipe mode stream support. Because event attributes in pipe
> > mode are received dynamically during event processing, session->evlist is
> > not populated prior to event processing.
> > To handle pipe input correctly:
> > - Register the missing .attr, .tracing_data, .build_id, and .feature
> > callbacks in cmd_sched()
> >
> > - Promote the handlers array to file-scope (latency_handlers[]) and
> > dynamically assign matching tracepoint handlers (or
> > process_sched_ignore) inside perf_sched__process_tracepoint_sample()
> > when evsel->handler is NULL; replace process_sched_wakeup_ignore()
> > with process_sched_ignore()
> >
> > - Perform the trace check post-processing when handling pipe data
> >
> > Patch 3 introduces dynamic auto-scaling for latency and runtime display
> > columns (Runtime, Avg delay, Max delay). Previously, all values were
> > unconditionally formatted in milliseconds (ms), making microsecond- or
> > second-scale latencies difficult to read. Columns are now dynamically
> > scaled to the most appropriate unit (ns, us, ms, s), column headers are
> > updated, and format specifiers are aligned character-for-character with
> > table headers.
> >
> > Patch 4 adds three new command-line options to 'perf sched latency':
> > --histogram (-H):
> > Displays an ASCII bar chart of CPU wait latencies between
> > snapshots
> > --hist-mode:
> > Configures the bucketing scheme to either logarithmic (log) or
> > 100 us equal-width linear (linear) mode
> > --time:
> > Filters trace event processing to a specified [start,stop] time
> > span
>
> Thanks for these improvements and the tests for coverage! For the series:
>
> Reviewed-by: Ian Rogers <irogers@xxxxxxxxxx>
>
> Thanks,
> Ian

Thank you Ian!

--
Aaron Tomlin