mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
samples/trace_event: Add '__rel_loc' using sample event
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. Link: https://lkml.kernel.org/r/163757343050.510314.2876529802471645178.stgit@devnote2 Cc: Beau Belgrave <beaub@linux.microsoft.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Tom Zanussi <zanussi@kernel.org> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
committed by
Steven Rostedt (VMware)
parent
55de2c0b56
commit
b466b13321
@@ -21,6 +21,7 @@ static const char *random_strings[] = {
|
|||||||
|
|
||||||
static void simple_thread_func(int cnt)
|
static void simple_thread_func(int cnt)
|
||||||
{
|
{
|
||||||
|
unsigned long bitmask[1] = {0xdeadbeefUL};
|
||||||
int array[6];
|
int array[6];
|
||||||
int len = cnt % 5;
|
int len = cnt % 5;
|
||||||
int i;
|
int i;
|
||||||
@@ -43,6 +44,8 @@ static void simple_thread_func(int cnt)
|
|||||||
trace_foo_with_template_cond("prints other times", cnt);
|
trace_foo_with_template_cond("prints other times", cnt);
|
||||||
|
|
||||||
trace_foo_with_template_print("I have to be different", cnt);
|
trace_foo_with_template_print("I have to be different", cnt);
|
||||||
|
|
||||||
|
trace_foo_rel_loc("Hello __rel_loc", cnt, bitmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int simple_thread(void *arg)
|
static int simple_thread(void *arg)
|
||||||
|
@@ -506,6 +506,39 @@ DEFINE_EVENT_PRINT(foo_template, foo_with_template_print,
|
|||||||
TP_ARGS(foo, bar),
|
TP_ARGS(foo, bar),
|
||||||
TP_printk("bar %s %d", __get_str(foo), __entry->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, unsigned long *mask),
|
||||||
|
|
||||||
|
TP_ARGS(foo, bar, mask),
|
||||||
|
|
||||||
|
TP_STRUCT__entry(
|
||||||
|
__rel_string( foo, foo )
|
||||||
|
__field( int, bar )
|
||||||
|
__rel_bitmask( bitmask,
|
||||||
|
BITS_PER_BYTE * sizeof(unsigned long) )
|
||||||
|
),
|
||||||
|
|
||||||
|
TP_fast_assign(
|
||||||
|
__assign_rel_str(foo, foo);
|
||||||
|
__entry->bar = bar;
|
||||||
|
__assign_rel_bitmask(bitmask, mask,
|
||||||
|
BITS_PER_BYTE * sizeof(unsigned long));
|
||||||
|
),
|
||||||
|
|
||||||
|
TP_printk("foo_rel_loc %s, %d, %s", __get_rel_str(foo), __entry->bar,
|
||||||
|
__get_rel_bitmask(bitmask))
|
||||||
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***** NOTICE! The #if protection ends here. *****/
|
/***** NOTICE! The #if protection ends here. *****/
|
||||||
|
Reference in New Issue
Block a user