From: Andrew Morton <akpm@linux-foundation.org>
To: <wang.yaxin@zte.com.cn>
Cc: <fan.yu9@zte.com.cn>, <yang.yang29@zte.com.cn>, <corbet@lwn.net>,
<linux-kernel@vger.kernel.org>, <linux-doc@vger.kernel.org>,
<xu.xin16@zte.com.cn>
Subject: Re: [PATCH 2/3] delaytop: add timestamp of delay max
Date: Thu, 2 Jul 2026 16:01:10 -0700 [thread overview]
Message-ID: <20260702160110.789de3e4f12f28ae958ecea8@linux-foundation.org> (raw)
In-Reply-To: <20260702205854461V25Py2xQvLesD8HF_2Rh8@zte.com.cn>
On Thu, 2 Jul 2026 20:58:54 +0800 (CST) <wang.yaxin@zte.com.cn> wrote:
> From: Wang Yaxin <wang.yaxin@zte.com.cn>
>
> Record the wall-clock timestamp when each maximum delay occurred for
> all delay types. The timestamp is displayed in the MAX_TIMESTAMP column
> when using -t/--type option.
>
> This enables:
> - Identifying the time when a process experienced an abnormal delay spike
> - Correlating delay peaks across multiple processes at the same timestamp
> - Cross-referencing with system logs, traces, or other metrics at that time
> - Pinpointing the root cause of latency issues by finding concurrent events
>
> ...
>
> +/*
> + * Format __kernel_timespec to human readable string (YYYY-MM-DDTHH:MM:SS)
> + * Returns formatted string or "N/A" if timestamp is zero
> + */
> +static const char *format_timespec64(struct __kernel_timespec *ts)
> +{
> + static char buffer[32];
> + time_t time_sec;
> + struct tm tm_info;
> +
> + /* Check if timestamp is zero (not set) */
> + if (ts->tv_sec == 0 && ts->tv_nsec == 0)
> + return "N/A";
> +
> + /* Avoid Y2038 truncation: check if timestamp fits in time_t on 32-bit platforms */
> + if (sizeof(time_t) < sizeof(ts->tv_sec) &&
> + ts->tv_sec > (__u64)((1ULL << (sizeof(time_t) * 8 - 1)) - 1))
> + return "N/A";
> +
> + time_sec = (time_t)ts->tv_sec;
> +
> + if (localtime_r(&time_sec, &tm_info) == NULL)
> + return "N/A";
> +
> + snprintf(buffer, sizeof(buffer), "%04d-%02d-%02dT%02d:%02d:%02d",
> + tm_info.tm_year + 1900,
> + tm_info.tm_mon + 1,
> + tm_info.tm_mday,
> + tm_info.tm_hour,
> + tm_info.tm_min,
> + tm_info.tm_sec);
> +
> + return buffer;
> +}
This appears to be a copy-paste-edit from format_timespec() in
tools/accounting/getdelays.c. Why do the two differ? Is it possible
to use a common implementation? tools/accounting/format_tiomespec.o?
Does the getdelays.c version have the possible issue which AI review
identified?
next prev parent reply other threads:[~2026-07-02 23:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260702160110.789de3e4f12f28ae958ecea8@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=fan.yu9@zte.com.cn \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wang.yaxin@zte.com.cn \
--cc=xu.xin16@zte.com.cn \
--cc=yang.yang29@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox