From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>,
Beau Belgrave <beaub@linux.microsoft.com>
Cc: linux-kernel@vger.kernel.org,
Masami Hiramatsu <mhiramat@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Tom Zanussi <zanussi@kernel.org>
Subject: [PATCH 3/5] samples/trace_event: Add '__rel_loc' using sample event
Date: Mon, 15 Nov 2021 19:20:28 +0900 [thread overview]
Message-ID: <163697162779.131454.7557237011157136779.stgit@devnote2> (raw)
In-Reply-To: <163697159970.131454.2661507704362599471.stgit@devnote2>
Add '__rel_loc' using sample event for testing.
User can use this for testing purpose. There is
no reason to use this macro from the kernel.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
samples/trace_events/trace-events-sample.c | 2 ++
samples/trace_events/trace-events-sample.h | 28 ++++++++++++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/samples/trace_events/trace-events-sample.c b/samples/trace_events/trace-events-sample.c
index 1a72b7d95cdc..b43415c31da6 100644
--- a/samples/trace_events/trace-events-sample.c
+++ b/samples/trace_events/trace-events-sample.c
@@ -43,6 +43,8 @@ static void simple_thread_func(int cnt)
trace_foo_with_template_cond("prints other times", cnt);
trace_foo_with_template_print("I have to be different", cnt);
+
+ trace_foo_rel_loc("Hello __rel_loc", cnt);
}
static int simple_thread(void *arg)
diff --git a/samples/trace_events/trace-events-sample.h b/samples/trace_events/trace-events-sample.h
index e61471ab7d14..be6321d4b04a 100644
--- a/samples/trace_events/trace-events-sample.h
+++ b/samples/trace_events/trace-events-sample.h
@@ -506,6 +506,34 @@ DEFINE_EVENT_PRINT(foo_template, foo_with_template_print,
TP_ARGS(foo, bar),
TP_printk("bar %s %d", __get_str(foo), __entry->bar));
+/*
+ * There are yet another __rel_loc dynamic data attribute. If you
+ * use __rel_dynamic_array() and __rel_string() etc. macros, you
+ * can use this attribute. There is no difference from the viewpoint
+ * of functionality with/without 'rel' but the encoding is a bit
+ * different. This is expected to be used with user-space event,
+ * there is no reason that the kernel event use this, but only for
+ * testing.
+ */
+
+TRACE_EVENT(foo_rel_loc,
+
+ TP_PROTO(const char *foo, int bar),
+
+ TP_ARGS(foo, bar),
+
+ TP_STRUCT__entry(
+ __rel_string( foo, foo )
+ __field( int, bar )
+ ),
+
+ TP_fast_assign(
+ __assign_rel_str(foo, foo);
+ __entry->bar = bar;
+ ),
+
+ TP_printk("foo_rel_loc %s, %d", __get_rel_str(foo), __entry->bar)
+);
#endif
/***** NOTICE! The #if protection ends here. *****/
next prev parent reply other threads:[~2021-11-15 10:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-15 10:19 [PATCH 0/5] tracing: Add __rel_loc support Masami Hiramatsu
2021-11-15 10:20 ` [PATCH 1/5] tracing: Support __rel_loc relative dynamic data location attribute Masami Hiramatsu
2021-11-15 10:20 ` [PATCH 2/5] tracing: Add '__rel_loc' using trace event macros Masami Hiramatsu
2021-11-15 10:20 ` Masami Hiramatsu [this message]
2021-11-15 10:20 ` [PATCH 4/5] libtraceevent: Add __rel_loc relative location attribute support Masami Hiramatsu
2021-11-16 22:23 ` Steven Rostedt
2021-11-17 14:33 ` Masami Hiramatsu
2021-11-17 15:14 ` Steven Rostedt
2021-11-22 5:05 ` Masami Hiramatsu
2021-11-22 16:25 ` Steven Rostedt
2021-11-23 12:07 ` Masami Hiramatsu
2021-11-15 10:20 ` [PATCH 5/5] tools/perf: Add __rel_loc support Masami Hiramatsu
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=163697162779.131454.7557237011157136779.stgit@devnote2 \
--to=mhiramat@kernel.org \
--cc=beaub@linux.microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=rostedt@goodmis.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox