enable a dynamic probe and data will be output in the trace along side with
your tracing data.
-# lttng enable-event aname -k --probe symbol+0xffff7260695
+# lttng enable-event aname -k --probe symbol+0x0
or
*/
enum lttng_kernel_instrumentation {
+ LTTNG_KERNEL_ALL = -1, /* Used within lttng-tools */
LTTNG_KERNEL_TRACEPOINT = 0,
LTTNG_KERNEL_KPROBE = 1,
LTTNG_KERNEL_FUNCTION = 2,
* Instrumentation type of tracing event.
*/
enum lttng_event_type {
- LTTNG_EVENT_TRACEPOINT,
- LTTNG_EVENT_PROBE,
- LTTNG_EVENT_FUNCTION,
- LTTNG_EVENT_FUNCTION_ENTRY,
- LTTNG_EVENT_NOOP,
- LTTNG_EVENT_SYSCALL,
+ LTTNG_EVENT_ALL = -1,
+ LTTNG_EVENT_TRACEPOINT = 0,
+ LTTNG_EVENT_PROBE = 1,
+ LTTNG_EVENT_FUNCTION = 2,
+ LTTNG_EVENT_FUNCTION_ENTRY = 3,
+ LTTNG_EVENT_NOOP = 4,
+ LTTNG_EVENT_SYSCALL = 5,
};
/*
}
/*
- * Disable kernel event for a channel from the kernel session.
+ * Disable kernel tracepoint event for a channel from the kernel session.
*/
-int event_kernel_disable(struct ltt_kernel_session *ksession,
+int event_kernel_disable_tracepoint(struct ltt_kernel_session *ksession,
struct ltt_kernel_channel *kchan, char *event_name)
{
int ret;
}
/*
- * Disable all kernel event for a channel from the kernel session.
+ * Disable kernel tracepoint events for a channel from the kernel session.
*/
-int event_kernel_disable_all(struct ltt_kernel_session *ksession,
+int event_kernel_disable_all_tracepoints(struct ltt_kernel_session *ksession,
struct ltt_kernel_channel *kchan)
{
int ret;
continue;
}
}
-
ret = LTTCOMM_OK;
+ return ret;
+}
+
+/*
+ * Disable kernel syscall events for a channel from the kernel session.
+ */
+int event_kernel_disable_all_syscalls(struct ltt_kernel_session *ksession,
+ struct ltt_kernel_channel *kchan)
+{
+ ERR("Cannot disable syscall tracing for existing session. Please destroy session instead.");
+ return LTTCOMM_OK; /* Return OK so disable all succeeds */
+}
+/*
+ * Disable all kernel event for a channel from the kernel session.
+ */
+int event_kernel_disable_all(struct ltt_kernel_session *ksession,
+ struct ltt_kernel_channel *kchan)
+{
+ int ret;
+
+ ret = event_kernel_disable_all_tracepoints(ksession, kchan);
+ if (ret != LTTCOMM_OK)
+ return ret;
+ ret = event_kernel_disable_all_syscalls(ksession, kchan);
return ret;
}
/*
- * Enable kernel event for a channel from the kernel session.
+ * Enable kernel tracepoint event for a channel from the kernel session.
*/
-int event_kernel_enable(struct ltt_kernel_session *ksession,
+int event_kernel_enable_tracepoint(struct ltt_kernel_session *ksession,
struct ltt_kernel_channel *kchan, struct lttng_event *event)
{
int ret;
ret = kernel_create_event(event, kchan);
if (ret < 0) {
ret = LTTCOMM_KERN_ENABLE_FAIL;
- goto error;
+ goto end;
}
} else if (kevent->enabled == 0) {
ret = kernel_enable_event(kevent);
if (ret < 0) {
ret = LTTCOMM_KERN_ENABLE_FAIL;
- goto error;
+ goto end;
}
}
-
ret = LTTCOMM_OK;
-
-error:
+end:
return ret;
}
/*
- * Enable all kernel event of a channel of the kernel session.
+ * Enable all kernel tracepoint events of a channel of the kernel session.
*/
-int event_kernel_enable_all(struct ltt_kernel_session *ksession,
+int event_kernel_enable_all_tracepoints(struct ltt_kernel_session *ksession,
struct ltt_kernel_channel *kchan, int kernel_tracer_fd)
{
int size, i, ret;
size = kernel_list_events(kernel_tracer_fd, &event_list);
if (size < 0) {
ret = LTTCOMM_KERN_LIST_FAIL;
- goto error;
+ goto end;
}
for (i = 0; i < size; i++) {
}
}
}
-
free(event_list);
-
- /* Also enable syscalls when enabling all events */
- ret = event_kernel_enable_syscalls(ksession, kchan, kernel_tracer_fd);
- if (ret < 0) {
- goto error;
- }
-
ret = LTTCOMM_OK;
-
-error:
+end:
return ret;
+
}
/*
- * Enable all kernel syscalls tracing.
+ * Enable all kernel tracepoint events of a channel of the kernel session.
*/
-int event_kernel_enable_syscalls(struct ltt_kernel_session *ksession,
+int event_kernel_enable_all_syscalls(struct ltt_kernel_session *ksession,
struct ltt_kernel_channel *kchan, int kernel_tracer_fd)
{
int ret;
ret = kernel_create_event(&event, kchan);
if (ret < 0) {
- goto error;
+ goto end;
}
-
ret = LTTCOMM_OK;
+end:
+ return ret;
+}
-error:
+/*
+ * Enable all kernel events of a channel of the kernel session.
+ */
+int event_kernel_enable_all(struct ltt_kernel_session *ksession,
+ struct ltt_kernel_channel *kchan, int kernel_tracer_fd)
+{
+ int ret;
+
+ ret = event_kernel_enable_all_tracepoints(ksession, kchan, kernel_tracer_fd);
+ if (ret != LTTCOMM_OK) {
+ goto end;
+ }
+ ret = event_kernel_enable_all_syscalls(ksession, kchan, kernel_tracer_fd);
+end:
return ret;
}
#include "trace-kernel.h"
-int event_kernel_disable(struct ltt_kernel_session *ksession,
+int event_kernel_disable_tracepoint(struct ltt_kernel_session *ksession,
struct ltt_kernel_channel *kchan, char *event_name);
+int event_kernel_disable_all_syscalls(struct ltt_kernel_session *ksession,
+ struct ltt_kernel_channel *kchan);
+int event_kernel_disable_all_tracepoints(struct ltt_kernel_session *ksession,
+ struct ltt_kernel_channel *kchan);
int event_kernel_disable_all(struct ltt_kernel_session *ksession,
struct ltt_kernel_channel *kchan);
-int event_kernel_enable(struct ltt_kernel_session *ksession,
+
+int event_kernel_enable_tracepoint(struct ltt_kernel_session *ksession,
struct ltt_kernel_channel *kchan, struct lttng_event *event);
-int event_kernel_enable_all(struct ltt_kernel_session *ksession,
+int event_kernel_enable_all_tracepoints(struct ltt_kernel_session *ksession,
+ struct ltt_kernel_channel *kchan, int kernel_tracer_fd);
+int event_kernel_enable_all_syscalls(struct ltt_kernel_session *ksession,
struct ltt_kernel_channel *kchan, int kernel_tracer_fd);
-int event_kernel_enable_syscalls(struct ltt_kernel_session *ksession,
+int event_kernel_enable_all(struct ltt_kernel_session *ksession,
struct ltt_kernel_channel *kchan, int kernel_tracer_fd);
#endif /* _LTT_EVENT_H */
case LTTNG_KERNEL_SYSCALL:
events[i].type = LTTNG_EVENT_SYSCALL;
break;
+ case LTTNG_KERNEL_ALL:
+ assert(0);
+ break;
}
i++;
}
goto error;
}
- ret = event_kernel_disable(session->kernel_session, kchan, event_name);
+ ret = event_kernel_disable_tracepoint(session->kernel_session, kchan, event_name);
if (ret != LTTCOMM_OK) {
goto error;
}
goto error;
}
- ret = event_kernel_enable(session->kernel_session, kchan, event);
+ ret = event_kernel_enable_tracepoint(session->kernel_session, kchan, event);
if (ret != LTTCOMM_OK) {
goto error;
}
goto error;
}
- if (event_type == LTTNG_KERNEL_SYSCALL) {
- ret = event_kernel_enable_syscalls(session->kernel_session,
+ switch (event_type) {
+ case LTTNG_KERNEL_SYSCALL:
+ ret = event_kernel_enable_all_syscalls(session->kernel_session,
kchan, kernel_tracer_fd);
- } else {
+ break;
+ case LTTNG_KERNEL_TRACEPOINT:
/*
- * This call enables all LTTNG_KERNEL_TRACEPOINTS and events
- * already registered to the channel.
+ * This call enables all LTTNG_KERNEL_TRACEPOINTS and
+ * events already registered to the channel.
*/
+ ret = event_kernel_enable_all_tracepoints(session->kernel_session,
+ kchan, kernel_tracer_fd);
+ break;
+ case LTTNG_KERNEL_ALL:
+ /* Enable syscalls and tracepoints */
ret = event_kernel_enable_all(session->kernel_session,
kchan, kernel_tracer_fd);
+ break;
+ default:
+ ret = LTTCOMM_KERN_ENABLE_FAIL;
+ goto error;
}
-
if (ret != LTTCOMM_OK) {
goto error;
}
case LTTNG_EVENT_SYSCALL:
attr->instrumentation = LTTNG_KERNEL_SYSCALL;
break;
+ case LTTNG_EVENT_ALL:
+ attr->instrumentation = LTTNG_KERNEL_ALL;
+ break;
default:
ERR("Unknown kernel instrumentation type (%d)", ev->type);
goto error;
switch (opt_event_type) {
case LTTNG_EVENT_TRACEPOINT:
if (opt_kernel) {
- MSG("All kernel events are enabled in channel %s",
+ MSG("All kernel tracepoints are enabled in channel %s",
channel_name);
}
break;
channel_name);
}
break;
+ case LTTNG_EVENT_ALL:
+ if (opt_kernel) {
+ MSG("All kernel events are enabled in channel %s",
+ channel_name);
+ }
+ break;
default:
/*
* We should not be here since lttng_enable_event should had failed
ev.type = opt_event_type;
switch (opt_event_type) {
+ case LTTNG_EVENT_ALL: /* Default behavior is tracepoint */
+ ev.type = LTTNG_EVENT_TRACEPOINT;
+ /* Fall-through */
case LTTNG_EVENT_TRACEPOINT:
break;
case LTTNG_EVENT_PROBE:
poptReadDefaultConfig(pc, 0);
/* Default event type */
- opt_event_type = LTTNG_EVENT_TRACEPOINT;
+ opt_event_type = LTTNG_EVENT_ALL;
while ((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <assert.h>
#include "../cmd.h"
MSG("%s (type: noop) [enabled: %d]", indent6,
events[i].enabled);
break;
+ case LTTNG_EVENT_ALL:
+ /* We should never have "all" events in list. */
+ assert(0);
+ break;
}
}