All of lore.kernel.org
 help / color / mirror / Atom feed
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>,
	Tom Zanussi <zanussi@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	"Yordan Karadzhov" <y.karadz@gmail.com>
Subject: [PATCH 7/7 v2] tracing: Add tracing_event_time_stamp() API
Date: Tue, 16 Mar 2021 12:41:07 -0400	[thread overview]
Message-ID: <20210316164114.131996180@goodmis.org> (raw)
In-Reply-To: 20210316164100.546961804@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>
---
 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.30.1



  parent reply	other threads:[~2021-03-16 16:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16 16:41 [PATCH 0/7 v2] tracing: Have ring_buffer_event_time_stamp() work for all events Steven Rostedt
2021-03-16 16:41 ` [PATCH 1/7 v2] ring-buffer: Separate out internal use of ring_buffer_event_time_stamp() Steven Rostedt
2021-03-16 16:41 ` [PATCH 2/7 v2] ring-buffer: Add a event_stamp to cpu_buffer for each level of nesting Steven Rostedt
2021-03-16 16:41 ` [PATCH 3/7 v2] tracing: Pass buffer of event to trigger operations Steven Rostedt
2021-03-16 16:41 ` [PATCH 4/7 v2] ring-buffer: Allow ring_buffer_event_time_stamp() to return time stamp of all events Steven Rostedt
2021-03-16 16:41 ` [PATCH 5/7 v2] tracing: Use a no_filter_buffering_ref to stop using the filter buffer Steven Rostedt
2021-03-16 16:41 ` [PATCH 6/7 v2] ring-buffer: Add verifier for using ring_buffer_event_time_stamp() Steven Rostedt
2021-03-16 16:41 ` Steven Rostedt [this message]
2021-03-16 21:16 ` [PATCH 0/7 v2] tracing: Have ring_buffer_event_time_stamp() work for all events Tom Zanussi
2021-03-16 21:35   ` 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=20210316164114.131996180@goodmis.org \
    --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 \
    --cc=zanussi@kernel.org \
    /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.