linux/tools/perf/tests/shell
Aaron Tomlin bf10e6ee2a perf sched latency: Add histogram and time interval options
While 'perf sched latency' reports task runtime and delay statistics
(average and maximum delay), it does not provide a visual representation
of how task wait times are distributed across latency ranges between
snapshots (start and finish of the analysis window).

The --histogram option collects CPU wait latencies (time between when
a task becomes runnable and when it gets scheduled onto a CPU) into 22
latency buckets, displaying an ASCII bar chart distribution.

The --hist-mode option configures the bucketing scheme:
  - log (default). Logarithmic latency buckets ranging from
    sub-microsecond (< 1 us) up to >= 1.05 seconds

  - linear. Equal-width linear latency buckets
    (i.e., 100 us steps up to >= 2.1 ms)

The --time option allows filtering trace event processing to a
specific time interval [start,stop].

Example histogram output excerpt:

    ❯ sudo perf sched latency --histogram --CPU 0

     CPU Wait Latency Distribution Histogram (between snapshots) (total samples: 36114)
     -------------------------------------------------------------------
      Latency Range    |      Count |    Pct | Histogram Graph
     -------------------------------------------------------------------
      < 1 us           |         17 |   0.0% | #
      2 - 4 us         |        673 |   1.9% | #
      4 - 8 us         |       6237 |  17.3% | ######
      8 - 16 us        |       3224 |   8.9% | ###
      16 - 32 us       |       1388 |   3.8% | #
      32 - 64 us       |        709 |   2.0% | #
      64 - 128 us      |        690 |   1.9% | #
      128 - 256 us     |        789 |   2.2% | #
      256 - 512 us     |        541 |   1.5% | #
      512 - 1024 us    |       2256 |   6.2% | ##
      1 - 2 ms         |       3577 |   9.9% | ###
      2 - 4 ms         |      13259 |  36.7% | ##############
      4 - 8 ms         |       2523 |   7.0% | ##
      8 - 16 ms        |        222 |   0.6% | #
      16 - 32 ms       |         10 |   0.0% | #
      >= 1.05 s        |          3 |   0.0% | #
     -------------------------------------------------------------------

Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Aaron Tomlin <atomlin@atomlin.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
2026-08-07 10:56:23 -07:00
..
attr
base_probe
base_report
common
coresight perf test: Add Arm CoreSight callchain test 2026-07-03 16:52:00 -07:00
lib perf tests: Fix flakiness in trace record and replay test 2026-06-30 17:09:13 -07:00
addr2line_inlines.sh
amd-ibs-swfilt.sh
annotate.sh
attr.sh
buildid.sh
c2c.sh
daemon.sh
data_file_offset_diagnostics.sh
data_type_profiling.sh
data_validation.sh
diff.sh
drm_pmu.sh
evlist.sh
ftrace.sh
header.sh
inject_aslr.sh
inject-callchain.sh
jitdump-python.sh perf tests: Fix Python JIT dump profiling test failure 2026-06-30 17:09:13 -07:00
kallsyms.sh
kvm.sh perf test: Extend perf kvm tests to check default event 2026-07-03 13:40:24 -07:00
kwork.sh
list.sh
lock_contention.sh perf tests: Restore -p flag to lock contention test 2026-07-09 17:44:22 -07:00
perf_sched_stats.sh
perf-report-hierarchy.sh
perftool-testsuite_probe.sh
perftool-testsuite_report.sh
pipe_test.sh
probe_vfs_getname.sh
python-use.sh
record_bpf_filter.sh
record_lbr.sh
record_offcpu.sh perf tests: Speed up off-cpu profiling tests 2026-06-30 17:09:14 -07:00
record_sideband.sh
record_weak_term.sh
record.sh perf tests: Add auto counter reload (ACR) sampling test 2026-07-04 09:39:04 -07:00
record+probe_libc_inet_pton.sh
record+script_probe_vfs_getname.sh
record+zstd_comp_decomp_multi_record.sh perf record: Fix multiple PERF_RECORD_COMPRESSED2 records per push 2026-07-13 13:25:17 -07:00
record+zstd_comp_decomp.sh
sched.sh perf sched latency: Add histogram and time interval options 2026-08-07 10:56:23 -07:00
script_dlfilter.sh
script_perl.sh
script_python.sh
script.sh
stat_all_metricgroups.sh
stat_all_metrics.sh perf tests: Speed up metrics checking shell tests 2026-06-30 17:09:14 -07:00
stat_all_pfm.sh
stat_all_pmu.sh
stat_bpf_counters_cgrp.sh perf test: Update test for --for-each-cgroup option 2026-07-16 10:35:23 -07:00
stat_bpf_counters.sh perf tests: Fix flakiness in BPF counters test on hybrid systems 2026-06-30 17:09:14 -07:00
stat_metrics_cgrp.sh
stat_metrics_values.sh perf tests: Speed up metrics checking shell tests 2026-06-30 17:09:14 -07:00
stat.sh perf stat: Add --hide-zero-events option to suppress zero-count events 2026-07-19 21:49:30 -07:00
stat+csv_output.sh
stat+csv_summary.sh
stat+event_uniquifying.sh
stat+json_output.sh
stat+shadow_stat.sh
stat+std_output.sh
test_arm_callgraph_fp.sh
test_arm_spe_fork.sh
test_arm_spe.sh
test_bpf_metadata.sh
test_brstack.sh perf tests: Fix flakiness in branch stack sampling tests 2026-06-30 17:09:14 -07:00
test_data_symbol.sh
test_dwarf_unwind_multithreaded.sh perf unwind-libdw: Fix unwinding of multi-threaded processes 2026-07-31 15:31:20 -07:00
test_event_open_fallback.sh
test_intel_pt.sh
test_java_symbol.sh
test_perf_data_converter_ctf.sh
test_perf_data_converter_json.sh
test_stat_intel_tpebs.sh
test_task_analyzer.sh
test_test_junit_output.sh
test_uprobe_from_different_cu.sh
timechart.sh
top.sh
trace_btf_enum.sh
trace_btf_general.sh
trace_exit_race.sh
trace_record_replay.sh perf tests: Fix flakiness in trace record and replay test 2026-06-30 17:09:13 -07:00
trace_summary.sh
trace+probe_vfs_getname.sh