From: Korben Rusek <korben@google.com>
To: Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>, Jonathan Corbet <corbet@lwn.net>
Cc: Peter Shier <pshier@google.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
jbehmer@google.com, franksie@google.com,
Korben Rusek <korben@google.com>
Subject: [PATCH 1/2] Add force-abs-timestamp trace option.
Date: Thu, 18 Jun 2020 15:15:40 -0700 [thread overview]
Message-ID: <20200618221541.247643-2-korben@google.com> (raw)
In-Reply-To: <20200618221541.247643-1-korben@google.com>
Normally a data event includes the delta time between itself and
the previous data event. But if a write interrupts another write
then the event cannot check the timestamp of the previous event
and so it uses a delta of 0.
Adds a new trace option: force-abs-timestamp. When this is on
each event is proceeded by an absolute timestamp event.
Reviewed-by: Peter Shier <pshier@google.com>
Signed-off-by: Korben Rusek <korben@google.com>
---
Documentation/trace/ftrace.rst | 5 +++++
kernel/trace/trace.c | 4 ++++
kernel/trace/trace.h | 1 +
3 files changed, 10 insertions(+)
diff --git a/Documentation/trace/ftrace.rst b/Documentation/trace/ftrace.rst
index 430a16283103..704264164ffd 100644
--- a/Documentation/trace/ftrace.rst
+++ b/Documentation/trace/ftrace.rst
@@ -1029,6 +1029,7 @@ To see what is available, simply cat the file::
irq-info
markers
noevent-fork
+ noforce-abs-timestamp
function-trace
nofunction-fork
nodisplay-graph
@@ -1212,6 +1213,10 @@ Here are the available options:
This affects PIDs listed in set_event_notrace_pid as well.
+ force-abs-timestamp
+ When set, always use absolute timestamps rather than
+ defaulting to deltas.
+
function-trace
The latency tracers will enable function tracing
if this option is enabled (default it is). When
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index ec44b0e2a19c..8b5c4e998895 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4852,6 +4852,12 @@ int set_tracer_flag(struct trace_array *tr, unsigned int mask, int enabled)
trace_printk_control(enabled);
}
+ if (mask == TRACE_ITER_FORCE_ABS_TIMESTAMP) {
+ ring_buffer_set_time_stamp_abs(tr->array_buffer.buffer, enabled);
+#ifdef CONFIG_TRACER_MAX_TRACE
+ ring_buffer_set_time_stamp_abs(tr->max_buffer.buffer, enabled);
+#endif
+ }
return 0;
}
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index def769df5bf1..cb1ecc540494 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -1330,6 +1330,7 @@ extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
C(MARKERS, "markers"), \
C(EVENT_FORK, "event-fork"), \
C(PAUSE_ON_TRACE, "pause-on-trace"), \
+ C(FORCE_ABS_TIMESTAMP, "force-abs-timestamp"), \
FUNCTION_FLAGS \
FGRAPH_FLAGS \
STACK_FLAGS \
--
2.27.0.290.gba653c62da-goog
next prev parent reply other threads:[~2020-06-18 22:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-18 22:15 [PATCH 0/2] force absolute timestamp " Korben Rusek
2020-06-18 22:15 ` Korben Rusek [this message]
2020-06-18 22:15 ` [PATCH 2/2] tests for absolute timestamp Korben Rusek
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=20200618221541.247643-2-korben@google.com \
--to=korben@google.com \
--cc=corbet@lwn.net \
--cc=franksie@google.com \
--cc=jbehmer@google.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pshier@google.com \
--cc=rostedt@goodmis.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®