Linux Documentation
 help / color / mirror / Atom feed
* [PATCH 0/3 v3] delaytop: add delay max, timestamp and sorting for top latency analysis
@ 2026-07-02 12:57 wang.yaxin
  2026-07-02 12:58 ` [PATCH 1/3] delaytop: add delay max for delaytop wang.yaxin
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: wang.yaxin @ 2026-07-02 12:57 UTC (permalink / raw)
  To: akpm, fan.yu9, yang.yang29
  Cc: corbet, linux-kernel, linux-doc, xu.xin16, wang.yaxin

From: Wang Yaxin <wang.yaxin@zte.com.cn>

Previously delaytop only showed average delays. This patch adds:

1. delay_max fields to track the maximum delay value for each delay type
   (cpu, blkio, irq, swapin, freepages, thrashing, compact, wpcopy)
   per task.

2. The -t/--type option displays only the specified delay type with avg/max
   values side by side, allowing focused analysis:
     delaytop -t cpu    # Show only CPU delay with avg/max
     delaytop -t wpcopy # Show Copy-on-Write delay with avg/max

3. Wall-clock timestamp when each maximum delay occurred, displayed in the
   MAX_TIMESTAMP column when using -t/--type option. This enables:
   - Identifying the time when a process experienced an abnormal delay max
   - Correlating delay max across multiple processes at the same timestamp
   - Cross-referencing with logs, traces, or other metrics at that time

4. When using -t/--type option, tasks are sorted by maximum delay value in
   descending order (largest delay first), enabling quick identification of
   top N processes with highest delay spikes.

Signed-off-by: Wang Yaxin <wang.yaxin@zte.com.cn>

v2->v3:
[patch 1/3]
1. fix get_field_by_name() MODE_TYPE filter breaking --sort for non-type fields
2. zero-init stats struct and cap memcpy size in netlink response parsing
3. fix compare_tasks() count field read as unsigned long long for 32-bit safety
4. strcmp → offset-based access via field_desc.max_offset

[patch 2/3]
1. fix 32-bit time_t overflow check to use max representable value instead of (time_t)-1
2. fix gmtime() pointer aliasing by assigning timespec64 tv_sec to local time_t
3. dropped pre-2000 check; gmtime → localtime_r + stack struct tm

[patch 3/3]
1. fixed Y2038 overflow false negative in format_kernel_timespec()
2. switched to localtime_r() with stack `struct tm` for thread safety.
3. `field_delay_max_and_ts()` `max_ts` nullable; removed unused ts_scratch
4. `-t/--type` mode: hide `[o]sort` and `[M]memverbose`, show only `[q]quit`

Wang Yaxin (3):
  delaytop: add delay max for delaytop
  delaytop: add timestamp of delay max
  delaytop: sort by max delay to highlight top latency processes

 Documentation/accounting/delay-accounting.rst |  43 +++
 tools/accounting/delaytop.c                   | 286 +++++++++++++++---
 tools/accounting/getdelays.c                  |   5 +
 3 files changed, 296 insertions(+), 38 deletions(-)

-- 
2.25.1

^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH 0/3 v2] delaytop: add delay max, timestamp and sorting for top latency analysis
@ 2026-05-30  3:16 wang.yaxin
  2026-05-30  3:18 ` [PATCH 2/3] delaytop: add timestamp of delay max wang.yaxin
  0 siblings, 1 reply; 9+ messages in thread
From: wang.yaxin @ 2026-05-30  3:16 UTC (permalink / raw)
  To: akpm, fan.yu9, yang.yang29
  Cc: corbet, linux-kernel, linux-doc, xu.xin16, wang.yaxin

From: Wang Yaxin <wang.yaxin@zte.com.cn>

Previously delaytop only showed average delays. This patch adds:

1. delay_max fields to track the maximum delay value for each delay type
   (cpu, blkio, irq, swapin, freepages, thrashing, compact, wpcopy)
   per task.

2. The -t/--type option displays only the specified delay type with avg/max
   values side by side, allowing focused analysis:
     delaytop -t cpu    # Show only CPU delay with avg/max
     delaytop -t wpcopy # Show Copy-on-Write delay with avg/max

3. Wall-clock timestamp when each maximum delay occurred, displayed in the
   MAX_TIMESTAMP column when using -t/--type option. This enables:
   - Identifying the time when a process experienced an abnormal delay max
   - Correlating delay max across multiple processes at the same timestamp
   - Cross-referencing with logs, traces, or other metrics at that time

4. When using -t/--type option, tasks are sorted by maximum delay value in
   descending order (largest delay first), enabling quick identification of
   top N processes with highest delay spikes.

Signed-off-by: Wang Yaxin <wang.yaxin@zte.com.cn>

v1->v2:
https://lore.kernel.org/all/20260527124210.19726c1c89a94b89310e5a47@linux-foundation.org/
[patch 1/3]
1. Fix potential NULL pointer dereference in get_field_by_name().
2. Fix data truncation by changing count pointer type from unsigned long to
	unsigned long long.
3. Fix column misalignment by changing COMMAND format from %-15s to %-17s.

[patch 2/3]
1. Add missing freepages_delay_max_ts initialization to avoid stale
	timestamps.
2. Fix Year 2038 regression by removing explicit time_t cast.

[patch 3/3]
1. Fix Y2038 truncation on 32-bit platforms by checking timestamp
	overflow before cast.
2. Mark field_delay_max_and_ts and get_field_delay_values as static
	to avoid missing-prototypes warnings.
3. Fix unexpected unindent in the Documentation.

Wang Yaxin (3):
  delaytop: add delay max for delaytop
  delaytop: add timestamp of delay max
  delaytop: sort by max delay to highlight top latency processes

 Documentation/accounting/delay-accounting.rst |  43 +++
 tools/accounting/delaytop.c                   | 263 ++++++++++++++++--
 2 files changed, 276 insertions(+), 30 deletions(-)

-- 
2.25.1

^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH 0/3] delaytop: add delay max, timestamp and sorting for top latency analysis
@ 2026-05-27 13:55 wang.yaxin
  2026-05-27 13:58 ` [PATCH 2/3] delaytop: add timestamp of delay max wang.yaxin
  0 siblings, 1 reply; 9+ messages in thread
From: wang.yaxin @ 2026-05-27 13:55 UTC (permalink / raw)
  To: akpm, fan.yu9, yang.yang29; +Cc: corbet, linux-kernel, linux-doc, xu.xin16

From: Wang Yaxin <wang.yaxin@zte.com.cn>

Previously delaytop only showed average delays. This patch adds:

1. delay_max fields to track the maximum delay value for each delay type
   (cpu, blkio, irq, swapin, freepages, thrashing, compact, wpcopy)
   per task.

2. The -t/--type option displays only the specified delay type with avg/max
   values side by side, allowing focused analysis:
     delaytop -t cpu    # Show only CPU delay with avg/max
     delaytop -t wpcopy # Show Copy-on-Write delay with avg/max

3. Wall-clock timestamp when each maximum delay occurred, displayed in the
   MAX_TIMESTAMP column when using -t/--type option. This enables:
   - Identifying the time when a process experienced an abnormal delay max
   - Correlating delay max across multiple processes at the same timestamp
   - Cross-referencing with logs, traces, or other metrics at that time

4. When using -t/--type option, tasks are sorted by maximum delay value in
   descending order (largest delay first), enabling quick identification of
   top N processes with highest delay spikes.

Signed-off-by: Wang Yaxin <wang.yaxin@zte.com.cn>

Wang Yaxin (3):
  delaytop: add delay max for delaytop
  delaytop: add timestamp of delay max
  delaytop: sort by max delay to highlight top latency processes

 Documentation/accounting/delay-accounting.rst |  43 ++++
 tools/accounting/delaytop.c                   | 232 +++++++++++++++---
 2 files changed, 247 insertions(+), 28 deletions(-)

-- 
2.25.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-07-02 23:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-02 12:57 [PATCH 0/3 v3] delaytop: add delay max, timestamp and sorting for top latency analysis wang.yaxin
2026-07-02 12:58 ` [PATCH 1/3] delaytop: add delay max for delaytop wang.yaxin
2026-07-02 22:58   ` Andrew Morton
2026-07-02 12:58 ` [PATCH 2/3] delaytop: add timestamp of delay max wang.yaxin
2026-07-02 23:01   ` Andrew Morton
2026-07-02 13:00 ` [PATCH 3/3] delaytop: sort by max delay to highlight top latency processes wang.yaxin
2026-07-02 23:01 ` [PATCH 0/3 v3] delaytop: add delay max, timestamp and sorting for top latency analysis Andrew Morton
  -- strict thread matches above, loose matches on Subject: below --
2026-05-30  3:16 [PATCH 0/3 v2] " wang.yaxin
2026-05-30  3:18 ` [PATCH 2/3] delaytop: add timestamp of delay max wang.yaxin
2026-05-27 13:55 [PATCH 0/3] delaytop: add delay max, timestamp and sorting for top latency analysis wang.yaxin
2026-05-27 13:58 ` [PATCH 2/3] delaytop: add timestamp of delay max wang.yaxin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox