From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
Yun Zhou <yun.zhou@windriver.com>
Subject: [for-next][PATCH 6/9] ftrace: Add max field to function profiler stats
Date: Mon, 19 Oct 2026 15:23:50 -0400 [thread overview]
Message-ID: <20261019192400.157640772@kernel.org> (raw)
In-Reply-To: 20261019192344.004592683@kernel.org
From: Yun Zhou <yun.zhou@windriver.com>
The function profiler (trace_stat/function<cpu>) reports Hit, Time,
Avg and s^2 per function. Add a "max" field recording the maximum
single-call duration, which is valuable for real-time tuning and for
investigating occasional latency spikes.
Like Time/Avg, it honors the graph-time and sleep-time options, so it
reflects entry-to-return wall-clock latency.
Link: https://patch.msgid.link/20260924030108.2673654-1-yun.zhou@windriver.com
Signed-off-by: Yun Zhou <yun.zhou@windriver.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/ftrace.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 673a54fdf392..98535f5533db 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -428,6 +428,7 @@ struct ftrace_profile {
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
unsigned long long time;
unsigned long long time_squared;
+ unsigned long long time_max;
#endif
};
@@ -530,9 +531,9 @@ static int function_stat_headers(struct seq_file *m)
{
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
seq_puts(m, " Function "
- "Hit Time Avg s^2\n"
+ "Hit Time Avg s^2 max\n"
" -------- "
- "--- ---- --- ---\n");
+ "--- ---- --- --- ---\n");
#else
seq_puts(m, " Function Hit\n"
" -------- ---\n");
@@ -613,6 +614,8 @@ static int function_stat_show(struct seq_file *m, void *v)
trace_print_graph_duration(avg, &s);
trace_seq_puts(&s, " ");
trace_print_graph_duration(stddev, &s);
+ trace_seq_puts(&s, " ");
+ trace_print_graph_duration(rec->time_max, &s);
trace_print_seq(m, &s);
#endif
seq_putc(m, '\n');
@@ -920,6 +923,8 @@ static void profile_graph_return(struct ftrace_graph_ret *trace,
if (rec) {
rec->time += calltime;
rec->time_squared += calltime * calltime;
+ if (calltime > rec->time_max)
+ rec->time_max = calltime;
}
}
--
2.53.0
next prev parent reply other threads:[~2026-10-19 19:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 19:23 [for-next][PATCH 0/9] tracing: Updates for 7.4 Steven Rostedt
2026-10-19 19:23 ` [for-next][PATCH 1/9] ftrace: Have stacktrace option work with func-args Steven Rostedt
2026-10-19 19:23 ` [for-next][PATCH 2/9] tracing: Avoid BTF lookup in atomic context Steven Rostedt
2026-10-19 19:23 ` [for-next][PATCH 3/9] ftrace: Build trace_btf.c when CONFIG_DEBUG_INFO_BTF is enabled Steven Rostedt
2026-10-19 19:23 ` [for-next][PATCH 4/9] fgraph: Enhance funcgraph-retval with BTF-based type-aware output Steven Rostedt
2026-10-19 19:23 ` [for-next][PATCH 5/9] tracing: Update funcgraph-retval documentation Steven Rostedt
2026-10-19 19:23 ` Steven Rostedt [this message]
2026-10-19 19:23 ` [for-next][PATCH 7/9] ftrace: Do not leak a modules empty page group Steven Rostedt
2026-10-19 19:23 ` [for-next][PATCH 8/9] ftrace: Let ftrace_call_adjust() reject a patch site Steven Rostedt
2026-10-19 19:23 ` [for-next][PATCH 9/9] ftrace: Initialize modname and offset in print_rec() Steven Rostedt
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=20261019192400.157640772@kernel.org \
--to=rostedt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=yun.zhou@windriver.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.