From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
"Zanussi, Tom" <tom.zanussi@linux.intel.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
"Yordan Karadzhov" <y.karadz@gmail.com>
Subject: [PATCH 7/7 v2.5] tracing: Add tracing_event_time_stamp() API
Date: Fri, 12 Mar 2021 19:52:27 -0500 [thread overview]
Message-ID: <20210312195227.4cd669b4@gandalf.local.home> (raw)
In-Reply-To: <20210312211505.818683162@goodmis.org>
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Add a tracing_event_time_stamp() API that checks if the event passed in is
not on the ring buffer but a pointer to the per CPU trace_buffered_event
which does not have its time stamp set yet.
If it is a pointer to the trace_buffered_event, then just return the
current time stamp that the ring buffer would produce.
Otherwise, return the time stamp from the event.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
I updated this patch but never committed the changes, before sending to the
list. There's no reason to pass in the trace array, when the trace buffer
would suffice.
kernel/trace/trace.c | 8 ++++++++
kernel/trace/trace.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 8cf7397f3f56..00797a58971d 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -7120,6 +7120,14 @@ static int tracing_time_stamp_mode_open(struct inode *inode, struct file *file)
return ret;
}
+u64 tracing_event_time_stamp(struct trace_buffer *buffer, struct ring_buffer_event *rbe)
+{
+ if (rbe == this_cpu_read(trace_buffered_event))
+ return ring_buffer_time_stamp(buffer, smp_processor_id());
+
+ return ring_buffer_event_time_stamp(buffer, rbe);
+}
+
/*
* Set or disable using the per CPU trace_buffer_event when possible.
*/
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index de717706e863..50f944e0b5a1 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -372,6 +372,7 @@ extern int tracing_check_open_get_tr(struct trace_array *tr);
extern struct trace_array *trace_array_find(const char *instance);
extern struct trace_array *trace_array_find_get(const char *instance);
+extern u64 tracing_event_time_stamp(struct trace_buffer *buffer, struct ring_buffer_event *rbe);
extern int tracing_set_filter_buffering(struct trace_array *tr, bool set);
extern int tracing_set_clock(struct trace_array *tr, const char *clockstr);
--
2.29.2
prev parent reply other threads:[~2021-03-13 0:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-12 21:13 [PATCH 0/7] tracing: Have ring_buffer_event_time_stamp() work for all events Steven Rostedt
2021-03-12 21:13 ` [PATCH 1/7] ring-buffer: Separate out internal use of ring_buffer_event_time_stamp() Steven Rostedt
2021-03-12 21:13 ` [PATCH 2/7] ring-buffer: Add a event_stamp to cpu_buffer for each level of nesting Steven Rostedt
2021-03-12 21:13 ` [PATCH 3/7] tracing: Pass buffer of event to trigger operations Steven Rostedt
2021-03-13 4:04 ` kernel test robot
2021-03-12 21:13 ` [PATCH 4/7] ring-buffer: Allow ring_buffer_event_time_stamp() to return time stamp of all events Steven Rostedt
2021-03-12 21:13 ` [PATCH 5/7] tracing: Use a no_filter_buffering_ref to stop using the filter buffer Steven Rostedt
2021-03-12 21:13 ` [PATCH 6/7] ring-buffer: Add verifier for using ring_buffer_event_time_stamp() Steven Rostedt
2021-03-12 21:14 ` [PATCH 7/7] tracing: Add tracing_event_time_stamp() API Steven Rostedt
2021-03-13 0:52 ` Steven Rostedt [this message]
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=20210312195227.4cd669b4@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=tom.zanussi@linux.intel.com \
--cc=y.karadz@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).