void *location; /* Address of marker in code */
};
-#define GET_MARKER(channel, name) (__mark_##channel##_##name)
+#define GET_MARKER(name) (__mark_ust_##name)
#define _DEFINE_MARKER(channel, name, tp_name_str, tp_cb, format, unique, m) \
struct registers __marker_regs; \
save_registers(&__marker_regs)
-#define DEFINE_MARKER(channel, name, format, unique, m) \
- _DEFINE_MARKER(channel, name, NULL, NULL, format, unique, m)
+#define DEFINE_MARKER(name, format, unique, m) \
+ _DEFINE_MARKER(ust, name, NULL, NULL, format, unique, m)
-#define DEFINE_MARKER_TP(channel, name, tp_name, tp_cb, format) \
- _DEFINE_MARKER_TP(channel, name, #tp_name, tp_cb, format)
+#define DEFINE_MARKER_TP(name, tp_name, tp_cb, format) \
+ _DEFINE_MARKER_TP(ust, name, #tp_name, tp_cb, format)
#define _DEFINE_MARKER_TP(channel, name, tp_name_str, tp_cb, format) \
static const char __mstrtab_##channel##_##name[] \
__attribute__((section("__markers_strings"))) \
= #channel "\0" #name "\0" format; \
- static struct marker GET_MARKER(channel, name) \
+ static struct marker __mark_##channel##_##name \
__attribute__((section("__markers"))) = \
{ __mstrtab_##channel##_##name, \
&__mstrtab_##channel##_##name[sizeof(#channel)], \
NULL, tp_name_str, tp_cb }; \
static struct marker * const __mark_ptr_##channel##_##name \
__attribute__((used, section("__markers_ptrs"))) = \
- &GET_MARKER(channel, name);
+ &__mark_##channel##_##name;
/*
* Make sure the alignment of the structure in the __markers section will
#define __trace_mark_counter(generic, channel, name, unique, call_private, format, args...) \
do { \
struct marker *__marker_counter_ptr; \
- DEFINE_MARKER(channel, name, format, unique, __marker_counter_ptr); \
+ _DEFINE_MARKER(channel, name, NULL, NULL, format, unique, __marker_counter_ptr); \
__mark_check_format(format, ## args); \
if (!generic) { \
if (unlikely(imv_read(__marker_counter_ptr->state))) \
{ \
register_trace_##tp_name(tp_cb, call_private); \
} \
- DEFINE_MARKER_TP(channel, name, tp_name, tp_cb, format);\
+ _DEFINE_MARKER_TP(channel, name, #tp_name, tp_cb, format); \
__mark_check_format(format, ## args); \
- (*GET_MARKER(channel, name).call)(&GET_MARKER(channel, name), \
+ (*__mark_##channel##_##name.call)(&__mark_##channel##_##name, \
call_private, &__marker_regs, ## args); \
} while (0)
/**
* trace_mark - Marker using code patching
- * @channel: marker channel (where to send the data), not quoted.
* @name: marker name, not quoted.
* @format: format string
* @args...: variable argument list
* Places a marker using optimized code patching technique (imv_read())
* to be enabled when immediate values are present.
*/
-#define trace_mark(channel, name, format, args...) \
- __trace_mark(0, channel, name, NULL, format, ## args)
+#define trace_mark(name, format, args...) \
+ __trace_mark(0, ust, name, NULL, format, ## args)
/**
* _trace_mark - Marker using variable read
- * @channel: marker channel (where to send the data), not quoted.
* @name: marker name, not quoted.
* @format: format string
* @args...: variable argument list
* enabled. Should be used for markers in code paths where instruction
* modification based enabling is not welcome.
*/
-#define _trace_mark(channel, name, format, args...) \
- __trace_mark(1, channel, name, NULL, format, ## args)
+#define _trace_mark(name, format, args...) \
+ __trace_mark(1, ust, name, NULL, format, ## args)
/**
* trace_mark_tp - Marker in a tracepoint callback
- * @channel: marker channel (where to send the data), not quoted.
* @name: marker name, not quoted.
* @tp_name: tracepoint name, not quoted.
* @tp_cb: tracepoint callback. Should have an associated global symbol so it
*
* Places a marker in a tracepoint callback.
*/
-#define trace_mark_tp(channel, name, tp_name, tp_cb, format, args...) \
- __trace_mark_tp(channel, name, NULL, tp_name, tp_cb, format, ## args)
+#define trace_mark_tp(name, tp_name, tp_cb, format, args...) \
+ __trace_mark_tp(ust, name, NULL, tp_name, tp_cb, format, ## args)
/**
* MARK_NOARGS - Format string for a marker with no argument.
e->call = marker_probe_cb_noarg;
else
e->call = marker_probe_cb;
- trace_mark(metadata, core_marker_format,
+ __trace_mark(0, metadata, core_marker_format, NULL,
"channel %s name %s format %s",
e->channel, e->name, e->format);
} else {
return -ENOMEM;
entry->format_allocated = 1;
- trace_mark(metadata, core_marker_format,
+ __trace_mark(0, metadata, core_marker_format, NULL,
"channel %s name %s format %s",
entry->channel, entry->name, entry->format);
return 0;
goto error_unregister_channel;
entry->event_id = ret;
ret = 0;
- trace_mark(metadata, core_marker_id,
+ __trace_mark(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",
void ust_potential_exec(void)
{
- trace_mark(ust, potential_exec, MARK_NOARGS);
+ trace_mark(potential_exec, MARK_NOARGS);
DBG("test");
retval = plibc_malloc(size);
- trace_mark(ust, malloc, "size %d ptr %p", (int)size, retval);
+ trace_mark(malloc, "size %d ptr %p", (int)size, retval);
return retval;
}
}
}
- trace_mark(ust, free, "ptr %p", ptr);
+ trace_mark(free, "ptr %p", ptr);
plibc_free(ptr);
}
printf("Basic test program\n");
for(i=0; i<50; i++) {
- trace_mark(ust, bar, "str %s", "FOOBAZ");
- trace_mark(ust, bar2, "number1 %d number2 %d", 53, 9800);
+ trace_mark(bar, "str %s", "FOOBAZ");
+ trace_mark(bar2, "number1 %d number2 %d", 53, 9800);
usleep(100000);
}
printf("Basic test program\n");
for(;;) {
- trace_mark(ust, bar, "str %s", "FOOBAZ");
- trace_mark(ust, bar2, "number1 %d number2 %d", 53, 9800);
+ trace_mark(bar, "str %s", "FOOBAZ");
+ trace_mark(bar2, "number1 %d number2 %d", 53, 9800);
usleep(1000000);
}
time(NULL);
#ifdef MARKER
- trace_mark(ust, event, "event %d", v);
+ trace_mark(event, "event %d", v);
#endif
}
{
int (*fptr)();
- trace_mark(ust, from_main_before_lib, "%s", "Event occured in the main program before"
+ trace_mark(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);
(*fptr)();
dlclose(lib_handle);
- trace_mark(ust, from_main_after_lib,"%s", "Event occured in the main program after "
+ trace_mark(from_main_after_lib,"%s", "Event occured in the main program after "
"the library has been closed\n");
return 0;
void exported_function()
{
- trace_mark(ust, from_library, "%s", "Event occured in library function");
+ trace_mark(from_library, "%s", "Event occured in library function");
}
}
printf("Fork test program, parent pid is %d\n", getpid());
- trace_mark(ust, before_fork, MARK_NOARGS);
+ trace_mark(before_fork, MARK_NOARGS);
/* Sleep here to make sure the consumer is initialized before we fork */
sleep(1);
printf("Child pid is %d\n", getpid());
- trace_mark(ust, after_fork_child, MARK_NOARGS);
+ trace_mark(after_fork_child, MARK_NOARGS);
- trace_mark(ust, before_exec, "pid %d", getpid());
+ trace_mark(before_exec, "pid %d", getpid());
result = execve(argv[1], args, env);
if(result == -1) {
return 1;
}
- trace_mark(ust, after_exec, "pid %d", getpid());
+ trace_mark(after_exec, "pid %d", getpid());
}
else {
- trace_mark(ust, after_fork_parent, MARK_NOARGS);
+ trace_mark(after_fork_parent, MARK_NOARGS);
}
return 0;
{
printf("IN FORK2\n");
- trace_mark(ust, after_exec, MARK_NOARGS);
+ trace_mark(after_exec, MARK_NOARGS);
return 0;
}
sleep(1);
for(i=0; i<50; i++) {
- trace_mark(ust, bar, "str %s", "FOOBAZ");
- trace_mark(ust, bar2, "number1 %d number2 %d", 53, 9800);
+ trace_mark(bar, "str %s", "FOOBAZ");
+ trace_mark(bar2, "number1 %d number2 %d", 53, 9800);
trace_hello_tptest(i);
usleep(100000);
}
printf("Hello, World!\n");
for(i=0; i<500; i++) {
- trace_mark(ust, bar, "str %d", i);
- trace_mark(ust, bar2, "number1 %d number2 %d", (int)53, (int)9800);
+ trace_mark(bar, "str %d", i);
+ trace_mark(bar2, "number1 %d number2 %d", (int)53, (int)9800);
}
// ltt_trace_stop("auto");
child_pid = fork();
if (child_pid) {
for(i=0; i<10; i++) {
- trace_mark(ust, bar, "str %s", "FOOBAZ");
- trace_mark(ust, bar2, "number1 %d number2 %d", 53, 9800);
+ trace_mark(bar, "str %s", "FOOBAZ");
+ trace_mark(bar2, "number1 %d number2 %d", 53, 9800);
usleep(100000);
}
void myfunc(void)
{
- trace_mark(ust, in_lib, MARK_NOARGS);
+ trace_mark(in_lib, MARK_NOARGS);
printf("testfunc\n");
}
int main(void)
{
myfunc();
- trace_mark(ust, in_prog, MARK_NOARGS);
+ trace_mark(in_prog, MARK_NOARGS);
return 0;
}
int main()
{
- trace_mark(ust, same_line_event, "%s","An event occured in the same line"); trace_mark(ust, same_line_event, "%s","An event occured in the same line");
+ 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");
return 0;
}
int i;
for(i=0; i<N_ITER; i++) {
- trace_mark(ust, an_event, "%d", i);
- trace_mark(ust, another_event, "%s", "Hello, World!");
+ trace_mark(an_event, "%d", i);
+ trace_mark(another_event, "%s", "Hello, World!");
}
return 0;
void tp_probe(void *data, unsigned int p1);
-DEFINE_MARKER_TP(ust, event, ust_event, tp_probe, "p1 %u");
+DEFINE_MARKER_TP(event, ust_event, tp_probe, "p1 %u");
/*
* Probe 1 --> ust_event
{
struct marker *marker;
- marker = &GET_MARKER(ust, event);
+ marker = &GET_MARKER(event);
ltt_specialized_trace(marker, data, &p1, sizeof(p1), sizeof(p1));
}
{
int i;
for (i = 0; i < 100; i++) {
- trace_mark_tp(ust, event2, ust_event2, tp_probe4, "probe4 %u", p4);
+ trace_mark_tp(event2, ust_event2, tp_probe4, "probe4 %u", p4);
}
}
{
struct message *msg;
msg = (struct message*) data;
- trace_mark_tp(ust, event_msg, ust_event_msg,
+ trace_mark_tp(event_msg, ust_event_msg,
tp_probe3, "probe %s", msg->payload);
}
{
int i;
for (i = 0; i < 5; i++) {
- trace_mark_tp(ust, event, ust_event, tp_probe2, "probe %u", 13);
+ trace_mark_tp(event, ust_event, tp_probe2, "probe %u", 13);
}
}
{
int i;
for (i = 0; i < 5; i++) {
- trace_mark_tp(ust, event, ust_event, tp_probe, "probe %u", p1);
+ trace_mark_tp(event, ust_event, tp_probe, "probe %u", p1);
}
}