Re: [PATCH linux next] tools/accounting/delaytop: add delaytop to record top-n task delay
From: Andrew Morton
Date: Sun Jun 22 2025 - 18:48:57 EST
On Thu, 19 Jun 2025 21:18:43 +0800 (CST) <jiang.kun2@xxxxxxxxxx> wrote:
> From: Yaxin Wang <wang.yaxin@xxxxxxxxxx>
>
> Problem
> =======
> The "getdelays" can only display the latency of a single task
> by specifying a PID, but it has the following limitations:
> 1. single-task perspective: only supports querying the
> latency (CPU, I/O, memory, etc.) of an individual task via
> PID and cannot provide a global analysis of high-latency
> processes across the system.
> 2. lack of High-Latency process awareness: when the overall
> system latency is high (e.g., a spike in CPU latency), there
> is no way to quickly identify the top N processes contributing
> to the highest latency.
> 3. poor interactivity: It lacks dynamic sorting and refresh
> capabilities (similar to top), making it difficult to monitor
> latency changes in real time.
>
> Solution
> ========
> To address these limitations, we introduce the "delaytop" with
> the following capabilities:
> 1. system view: monitors latency metrics (CPU, I/O, memory, IRQ,
> etc.) for all system processes
> 2. supports field-based sorting (e.g., default sort by CPU latency
> in descending order)
> 3. dynamic interactive interface:
> focus on specific processes with --pid;
> limit displayed entries with --processes 20;
> control monitoring duration with --iterations;
>
> Use case
> ========
> bash# ./delaytop
Looks nice, thanks.
> tools/accounting/Makefile | 2 +-
> tools/accounting/delaytop.c | 673 ++++++++++++++++++++++++++++++++++++
> 2 files changed, 674 insertions(+), 1 deletion(-)
> create mode 100644 tools/accounting/delaytop.c
Some documentation would be nicer ;)
hp2:/usr/src/25> grep -rli getdelays Documentation
Documentation/translations/zh_CN/accounting/delay-accounting.rst
Documentation/translations/zh_CN/accounting/taskstats.rst
Documentation/accounting/delay-accounting.rst
Documentation/accounting/cgroupstats.rst
Documentation/accounting/taskstats.rst