From: Mathieu Desnoyers Date: Wed, 13 Apr 2011 17:46:23 +0000 (-0400) Subject: Markers: API change: rename trace_mark() to ust_marker() X-Git-Tag: v1.9.1~402 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=686debc34cf055ffcb1f98a06df9fbaf27eeb441;p=lttng-ust.git Markers: API change: rename trace_mark() to ust_marker() Given that the markers will stay as debug-only "quick and dirty" tracing interface, make them UST-specific. Make it clear by turning the API to ust_marker(). Signed-off-by: Mathieu Desnoyers --- diff --git a/doc/info/ust.texi b/doc/info/ust.texi index 83c91e02..60c73c18 100644 --- a/doc/info/ust.texi +++ b/doc/info/ust.texi @@ -162,10 +162,10 @@ int main(int argc, char **argv) /* ... set values of v and st ... */ /* a marker: */ - trace_mark(ust, myevent, "firstarg %d secondarg %s", v, st); + ust_marker(ust, myevent, "firstarg %d secondarg %s", v, st); /* a marker without arguments: */ - trace_mark(ust, myotherevent, MARK_NOARGS); + ust_marker(ust, myotherevent, MARK_NOARGS); return 0; } @@ -240,17 +240,17 @@ int main(int argc, char **argv) /* ... set values of v and st ... */ /* a marker: */ - trace_mark(main, myevent, "firstarg %d secondarg %s", v, st); + ust_marker(main, myevent, "firstarg %d secondarg %s", v, st); /* another marker without arguments: */ - trace_mark(main, myotherevent, MARK_NOARGS); + ust_marker(main, myotherevent, MARK_NOARGS); return 0; } @end verbatim @end example -The invocation of the trace_mark() macro requires at least 3 arguments. The +The invocation of the ust_marker() macro requires at least 3 arguments. The first, here "main", is the name of the event category. It is also the name of the channel the event will go in. The second, here "myevent" is the name of the event. The third is a format string that announces the names and the types of @@ -318,7 +318,7 @@ DEFINE_TRACE(mychannel_myevent); void mychannel_myevent_probe(int v, char *st) { - trace_mark(mychannel, myevent, "v %d st %s", v, st); + ust_marker(mychannel, myevent, "v %d st %s", v, st); } static void __attribute__((constructor)) init() diff --git a/include/ust/marker.h b/include/ust/marker.h index da738d1f..906d78de 100644 --- a/include/ust/marker.h +++ b/include/ust/marker.h @@ -167,10 +167,10 @@ struct marker { * If generic is false, immediate values are used. */ -#define __trace_mark(generic, channel, name, call_private, format, args...) \ - __trace_mark_counter(generic, channel, name, __LINE__, call_private, format, ## args) +#define __ust_marker(generic, channel, name, call_private, format, args...) \ + __ust_marker_counter(generic, channel, name, __LINE__, call_private, format, ## args) -#define __trace_mark_counter(generic, channel, name, unique, call_private, format, args...) \ +#define __ust_marker_counter(generic, channel, name, unique, call_private, format, args...) \ do { \ struct marker *__marker_counter_ptr; \ _DEFINE_MARKER(channel, name, NULL, NULL, format, unique, __marker_counter_ptr); \ @@ -184,10 +184,10 @@ struct marker { } \ } while (0) -#define __trace_mark_tp(channel, name, call_private, tp_name, tp_cb, format, args...) \ - __trace_mark_tp_counter(channel, name, __LINE__, call_private, tp_name, tp_cb, format, ## args) +#define __ust_marker_tp(channel, name, call_private, tp_name, tp_cb, format, args...) \ + __ust_marker_tp_counter(channel, name, __LINE__, call_private, tp_name, tp_cb, format, ## args) -#define __trace_mark_tp_counter(channel, name, unique, call_private, tp_name, tp_cb, format, args...) \ +#define __ust_marker_tp_counter(channel, name, unique, call_private, tp_name, tp_cb, format, args...) \ do { \ struct registers __marker_regs; \ void __check_tp_type(void) \ @@ -204,7 +204,7 @@ extern void marker_update_probe_range(struct marker * const *begin, struct marker * const *end); /** - * trace_mark - Marker using code patching + * ust_marker - Marker using code patching * @name: marker name, not quoted. * @format: format string * @args...: variable argument list @@ -212,11 +212,11 @@ extern void marker_update_probe_range(struct marker * const *begin, * Places a marker using optimized code patching technique (imv_read()) * to be enabled when immediate values are present. */ -#define trace_mark(name, format, args...) \ - __trace_mark(0, ust, name, NULL, format, ## args) +#define ust_marker(name, format, args...) \ + __ust_marker(0, ust, name, NULL, format, ## args) /** - * _trace_mark - Marker using variable read + * _ust_marker - Marker using variable read * @name: marker name, not quoted. * @format: format string * @args...: variable argument list @@ -225,11 +225,11 @@ extern void marker_update_probe_range(struct marker * const *begin, * enabled. Should be used for markers in code paths where instruction * modification based enabling is not welcome. */ -#define _trace_mark(name, format, args...) \ - __trace_mark(1, ust, name, NULL, format, ## args) +#define _ust_marker(name, format, args...) \ + __ust_marker(1, ust, name, NULL, format, ## args) /** - * trace_mark_tp - Marker in a tracepoint callback + * ust_marker_tp - Marker in a tracepoint callback * @name: marker name, not quoted. * @tp_name: tracepoint name, not quoted. * @tp_cb: tracepoint callback. Should have an associated global symbol so it @@ -239,8 +239,8 @@ extern void marker_update_probe_range(struct marker * const *begin, * * Places a marker in a tracepoint callback. */ -#define trace_mark_tp(name, tp_name, tp_cb, format, args...) \ - __trace_mark_tp(ust, name, NULL, tp_name, tp_cb, format, ## args) +#define ust_marker_tp(name, tp_name, tp_cb, format, args...) \ + __ust_marker_tp(ust, name, NULL, tp_name, tp_cb, format, ## args) /** * MARK_NOARGS - Format string for a marker with no argument. diff --git a/java/UST.c b/java/UST.c index 7c807726..7e01e92f 100644 --- a/java/UST.c +++ b/java/UST.c @@ -7,7 +7,7 @@ JNIEXPORT void JNICALL Java_UST_ust_1java_1event (JNIEnv *env, jobject jobj, jst const char *ev_name_cstr = (*env)->GetStringUTFChars(env, ev_name, &iscopy); const char *args_cstr = (*env)->GetStringUTFChars(env, args, &iscopy); - trace_mark(ust, java_event, "name %s args %s", ev_name_cstr, args_cstr); + ust_marker(ust, java_event, "name %s args %s", ev_name_cstr, args_cstr); } MARKER_LIB diff --git a/libust/marker.c b/libust/marker.c index 4b23e53d..0aa3d60e 100644 --- a/libust/marker.c +++ b/libust/marker.c @@ -447,7 +447,7 @@ static struct marker_entry *add_marker(const char *channel, const char *name, e->call = marker_probe_cb_noarg; else e->call = marker_probe_cb; - __trace_mark(0, metadata, core_marker_format, NULL, + __ust_marker(0, metadata, core_marker_format, NULL, "channel %s name %s format %s", e->channel, e->name, e->format); } else { @@ -514,7 +514,7 @@ static int marker_set_format(struct marker_entry *entry, const char *format) return -ENOMEM; entry->format_allocated = 1; - __trace_mark(0, metadata, core_marker_format, NULL, + __ust_marker(0, metadata, core_marker_format, NULL, "channel %s name %s format %s", entry->channel, entry->name, entry->format); return 0; @@ -583,7 +583,7 @@ static int set_marker(struct marker_entry *entry, struct marker *elem, WARN_ON(!elem->tp_cb); /* * It is ok to directly call the probe registration because type - * checking has been done in the __trace_mark_tp() macro. + * checking has been done in the __ust_marker_tp() macro. */ if (active) { @@ -629,7 +629,7 @@ static void disable_marker(struct marker *elem) WARN_ON(!elem->tp_cb); /* * It is ok to directly call the probe registration because type - * checking has been done in the __trace_mark_tp() macro. + * checking has been done in the __ust_marker_tp() macro. */ ret = tracepoint_probe_unregister_noupdate(elem->tp_name, elem->tp_cb, NULL); @@ -781,7 +781,7 @@ int marker_probe_register(const char *channel, const char *name, goto error_unregister_channel; entry->event_id = ret; ret = 0; - __trace_mark(0, metadata, core_marker_id, NULL, + __ust_marker(0, metadata, core_marker_id, NULL, "channel %s name %s event_id %hu " "int #1u%zu long #1u%zu pointer #1u%zu " "size_t #1u%zu alignment #1u%u", @@ -1296,7 +1296,7 @@ void ltt_dump_marker_state(struct ust_trace *trace) for (i = 0; i < MARKER_TABLE_SIZE; i++) { head = &marker_table[i]; cds_hlist_for_each_entry(entry, node, head, hlist) { - __trace_mark(0, metadata, core_marker_id, + __ust_marker(0, metadata, core_marker_id, &call_data, "channel %s name %s event_id %hu " "int #1u%zu long #1u%zu pointer #1u%zu " @@ -1308,7 +1308,7 @@ void ltt_dump_marker_state(struct ust_trace *trace) sizeof(void *), sizeof(size_t), ltt_get_alignment()); if (entry->format) - __trace_mark(0, metadata, + __ust_marker(0, metadata, core_marker_format, &call_data, "channel %s name %s format %s", diff --git a/libust/tracectl.c b/libust/tracectl.c index e84a35ae..4d93cc6f 100644 --- a/libust/tracectl.c +++ b/libust/tracectl.c @@ -1576,7 +1576,7 @@ static void __attribute__((destructor)) keepalive() void ust_potential_exec(void) { - trace_mark(potential_exec, MARK_NOARGS); + ust_marker(potential_exec, MARK_NOARGS); DBG("test"); diff --git a/libustinstr-malloc/mallocwrap.c b/libustinstr-malloc/mallocwrap.c index c473567d..28cd4e32 100644 --- a/libustinstr-malloc/mallocwrap.c +++ b/libustinstr-malloc/mallocwrap.c @@ -53,7 +53,7 @@ __I_FUNC_TYPE __I_FUNC_NAME(__I_FUNC_ARGS) \ } \ } \ \ - trace_mark(ust, __I_FUNC_NAME, __I_TRACE_FMT, __I_TRACE_ARGS); \ + ust_marker(ust, __I_FUNC_NAME, __I_TRACE_FMT, __I_TRACE_ARGS); \ \ return plibc_ ## __I_FUNC_NAME (__I_CALL_ARGS); \ } @@ -75,7 +75,7 @@ void *malloc(size_t size) retval = plibc_malloc(size); - trace_mark(malloc, "size %d ptr %p", (int)size, retval); + ust_marker(malloc, "size %d ptr %p", (int)size, retval); return retval; } @@ -92,7 +92,7 @@ void free(void *ptr) } } - trace_mark(free, "ptr %p", ptr); + ust_marker(free, "ptr %p", ptr); plibc_free(ptr); } diff --git a/tests/basic/basic.c b/tests/basic/basic.c index 293febac..e1832cd0 100644 --- a/tests/basic/basic.c +++ b/tests/basic/basic.c @@ -29,8 +29,8 @@ int main() printf("Basic test program\n"); for(i=0; i<50; i++) { - trace_mark(bar, "str %s", "FOOBAZ"); - trace_mark(bar2, "number1 %d number2 %d", 53, 9800); + ust_marker(bar, "str %s", "FOOBAZ"); + ust_marker(bar2, "number1 %d number2 %d", 53, 9800); usleep(100000); } diff --git a/tests/basic_long/basic_long.c b/tests/basic_long/basic_long.c index 06ee2f58..746e9f51 100644 --- a/tests/basic_long/basic_long.c +++ b/tests/basic_long/basic_long.c @@ -25,8 +25,8 @@ int main() printf("Basic test program\n"); for(;;) { - trace_mark(bar, "str %s", "FOOBAZ"); - trace_mark(bar2, "number1 %d number2 %d", 53, 9800); + ust_marker(bar, "str %s", "FOOBAZ"); + ust_marker(bar2, "number1 %d number2 %d", 53, 9800); usleep(1000000); } diff --git a/tests/benchmark/bench.c b/tests/benchmark/bench.c index 4e9c3551..ce476f9b 100644 --- a/tests/benchmark/bench.c +++ b/tests/benchmark/bench.c @@ -29,7 +29,7 @@ void do_stuff(void) time(NULL); #ifdef MARKER - trace_mark(event, "event %d", v); + ust_marker(event, "event %d", v); #endif } diff --git a/tests/dlopen/dlopen.c b/tests/dlopen/dlopen.c index d367580c..ae209028 100644 --- a/tests/dlopen/dlopen.c +++ b/tests/dlopen/dlopen.c @@ -28,7 +28,7 @@ int main() { int (*fptr)(); - trace_mark(from_main_before_lib, "%s", "Event occured in the main program before" + ust_marker(from_main_before_lib, "%s", "Event occured in the main program before" " the opening of the library\n"); void *lib_handle = dlopen("libdummy.so", RTLD_LAZY); @@ -47,7 +47,7 @@ int main() (*fptr)(); dlclose(lib_handle); - trace_mark(from_main_after_lib,"%s", "Event occured in the main program after " + ust_marker(from_main_after_lib,"%s", "Event occured in the main program after " "the library has been closed\n"); return 0; diff --git a/tests/dlopen/libdummy.c b/tests/dlopen/libdummy.c index 16f7b4dc..dd694c28 100644 --- a/tests/dlopen/libdummy.c +++ b/tests/dlopen/libdummy.c @@ -19,5 +19,5 @@ void exported_function() { - trace_mark(from_library, "%s", "Event occured in library function"); + ust_marker(from_library, "%s", "Event occured in library function"); } diff --git a/tests/fork/fork.c b/tests/fork/fork.c index 3b846443..f2b3f181 100644 --- a/tests/fork/fork.c +++ b/tests/fork/fork.c @@ -32,7 +32,7 @@ int main(int argc, char **argv, char *env[]) } printf("Fork test program, parent pid is %d\n", getpid()); - trace_mark(before_fork, MARK_NOARGS); + ust_marker(before_fork, MARK_NOARGS); /* Sleep here to make sure the consumer is initialized before we fork */ sleep(1); @@ -47,9 +47,9 @@ int main(int argc, char **argv, char *env[]) printf("Child pid is %d\n", getpid()); - trace_mark(after_fork_child, MARK_NOARGS); + ust_marker(after_fork_child, MARK_NOARGS); - trace_mark(before_exec, "pid %d", getpid()); + ust_marker(before_exec, "pid %d", getpid()); result = execve(argv[1], args, env); if(result == -1) { @@ -57,10 +57,10 @@ int main(int argc, char **argv, char *env[]) return 1; } - trace_mark(after_exec, "pid %d", getpid()); + ust_marker(after_exec, "pid %d", getpid()); } else { - trace_mark(after_fork_parent, MARK_NOARGS); + ust_marker(after_fork_parent, MARK_NOARGS); } return 0; diff --git a/tests/fork/fork2.c b/tests/fork/fork2.c index 8a14e1a2..c77a7051 100644 --- a/tests/fork/fork2.c +++ b/tests/fork/fork2.c @@ -24,7 +24,7 @@ int main() { printf("IN FORK2\n"); - trace_mark(after_exec, MARK_NOARGS); + ust_marker(after_exec, MARK_NOARGS); return 0; } diff --git a/tests/hello/hello.c b/tests/hello/hello.c index 6ba2e61e..09a35b98 100644 --- a/tests/hello/hello.c +++ b/tests/hello/hello.c @@ -71,8 +71,8 @@ int main() sleep(1); for(i=0; i<50; i++) { - trace_mark(bar, "str %s", "FOOBAZ"); - trace_mark(bar2, "number1 %d number2 %d", 53, 9800); + ust_marker(bar, "str %s", "FOOBAZ"); + ust_marker(bar2, "number1 %d number2 %d", 53, 9800); trace_hello_tptest(i); usleep(100000); } diff --git a/tests/hello2/hello2.c b/tests/hello2/hello2.c index 175a1400..7308b30d 100644 --- a/tests/hello2/hello2.c +++ b/tests/hello2/hello2.c @@ -37,8 +37,8 @@ int main() printf("Hello, World!\n"); for(i=0; i<500; i++) { - trace_mark(bar, "str %d", i); - trace_mark(bar2, "number1 %d number2 %d", (int)53, (int)9800); + ust_marker(bar, "str %d", i); + ust_marker(bar2, "number1 %d number2 %d", (int)53, (int)9800); } // ltt_trace_stop("auto"); diff --git a/tests/libustctl_function_tests/libustctl_function_tests.c b/tests/libustctl_function_tests/libustctl_function_tests.c index cf184e62..45894208 100644 --- a/tests/libustctl_function_tests/libustctl_function_tests.c +++ b/tests/libustctl_function_tests/libustctl_function_tests.c @@ -179,8 +179,8 @@ int main(int argc, char **argv) child_pid = fork(); if (child_pid) { for(i=0; i<10; i++) { - trace_mark(bar, "str %s", "FOOBAZ"); - trace_mark(bar2, "number1 %d number2 %d", 53, 9800); + ust_marker(bar, "str %s", "FOOBAZ"); + ust_marker(bar2, "number1 %d number2 %d", 53, 9800); usleep(100000); } diff --git a/tests/make_shared_lib/basic_lib.c b/tests/make_shared_lib/basic_lib.c index 97874f32..3feaac1e 100644 --- a/tests/make_shared_lib/basic_lib.c +++ b/tests/make_shared_lib/basic_lib.c @@ -3,7 +3,7 @@ void myfunc(void) { - trace_mark(in_lib, MARK_NOARGS); + ust_marker(in_lib, MARK_NOARGS); printf("testfunc\n"); } diff --git a/tests/make_shared_lib/prog.c b/tests/make_shared_lib/prog.c index 777f4c64..7b7357ad 100644 --- a/tests/make_shared_lib/prog.c +++ b/tests/make_shared_lib/prog.c @@ -5,6 +5,6 @@ extern myfunc(void); int main(void) { myfunc(); - trace_mark(in_prog, MARK_NOARGS); + ust_marker(in_prog, MARK_NOARGS); return 0; } diff --git a/tests/same_line_marker/same_line_marker.c b/tests/same_line_marker/same_line_marker.c index 51cf5c39..ef59a2c9 100644 --- a/tests/same_line_marker/same_line_marker.c +++ b/tests/same_line_marker/same_line_marker.c @@ -19,6 +19,6 @@ int main() { - trace_mark(same_line_event, "%s","An event occured in the same line"); trace_mark(same_line_event, "%s","An event occured in the same line"); + ust_marker(same_line_event, "%s","An event occured in the same line"); ust_marker(same_line_event, "%s","An event occured in the same line"); return 0; } diff --git a/tests/test-nevents/prog.c b/tests/test-nevents/prog.c index 4e709156..21e01f02 100644 --- a/tests/test-nevents/prog.c +++ b/tests/test-nevents/prog.c @@ -30,8 +30,8 @@ int main() int i; for(i=0; ipayload); } @@ -72,7 +72,7 @@ void tp_probe2(void *data, unsigned int p2) { int i; for (i = 0; i < 5; i++) { - trace_mark_tp(event, ust_event, tp_probe2, "probe %u", 13); + ust_marker_tp(event, ust_event, tp_probe2, "probe %u", 13); } } @@ -84,7 +84,7 @@ void tp_probe(void *data, unsigned int p1) { int i; for (i = 0; i < 5; i++) { - trace_mark_tp(event, ust_event, tp_probe, "probe %u", p1); + ust_marker_tp(event, ust_event, tp_probe, "probe %u", p1); } }