From: Mathieu Desnoyers Date: Sat, 14 May 2011 15:20:52 +0000 (-0400) Subject: Add metadata channel, basic test passes X-Git-Tag: v2.0-pre1~152 X-Git-Url: http://git.liburcu.org/?a=commitdiff_plain;h=cd4bd11fe2d3232089186a5b9b021b7cb504a8fb;p=lttng-modules.git Add metadata channel, basic test passes Signed-off-by: Mathieu Desnoyers --- diff --git a/instrumentation/events/lttng-module/lttng.h b/instrumentation/events/lttng-module/lttng.h new file mode 100644 index 00000000..690b5df7 --- /dev/null +++ b/instrumentation/events/lttng-module/lttng.h @@ -0,0 +1,29 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM lttng + +#if !defined(_TRACE_LTTNG_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_LTTNG_H + +#include + +TRACE_EVENT(lttng_metadata, + + TP_PROTO(const char *str), + + TP_ARGS(str), + + TP_STRUCT__entry( + __string( string, str ) + ), + + TP_fast_assign( + tp_strcpy(string, str) + ), + + TP_printk("") +) + +#endif /* _TRACE_LTTNG_H */ + +/* This part must be outside protection */ +#include "define_trace.h" diff --git a/ltt-debugfs-abi.c b/ltt-debugfs-abi.c index 0f649fc2..7c9f88ab 100644 --- a/ltt-debugfs-abi.c +++ b/ltt-debugfs-abi.c @@ -123,7 +123,7 @@ static void lttng_metadata_create_events(struct file *channel_file) { struct ltt_channel *channel = channel_file->private_data; - char *event_name = "lttng-metadata"; + char *event_name = "lttng_metadata"; const struct lttng_event_desc *event_desc; struct ltt_event *event; int ret; @@ -210,8 +210,10 @@ int lttng_abi_create_channel(struct file *session_file, chan->file = chan_file; chan_file->private_data = chan; fd_install(chan_fd, chan_file); - if (channel_type == METADATA_CHANNEL) + if (channel_type == METADATA_CHANNEL) { lttng_metadata_create_events(chan_file); + session->metadata = chan; + } /* The channel created holds a reference on the session */ atomic_long_inc(&session_file->f_count); diff --git a/ltt-events.c b/ltt-events.c index b0191596..1d729210 100644 --- a/ltt-events.c +++ b/ltt-events.c @@ -515,7 +515,7 @@ int _ltt_session_metadata_statedump(struct ltt_session *session) if (session->metadata_dumped) goto skip_session; if (!session->metadata) { - printk(KERN_WARNING "LTTng: tracing is starting, but metadata channel is not found\n"); + printk(KERN_WARNING "LTTng: attempt to start tracing, but metadata channel is not found. Operation abort.\n"); return -EPERM; } diff --git a/ltt-events.h b/ltt-events.h index cc8e8097..3bacac78 100644 --- a/ltt-events.h +++ b/ltt-events.h @@ -217,5 +217,7 @@ int ltt_probe_register(struct lttng_probe_desc *desc); void ltt_probe_unregister(struct lttng_probe_desc *desc); const struct lttng_event_desc *ltt_event_get(const char *name); void ltt_event_put(const struct lttng_event_desc *desc); +int ltt_probes_init(void); +void ltt_probes_exit(void); #endif /* _LTT_EVENTS_H */ diff --git a/ltt-ring-buffer-metadata-client.h b/ltt-ring-buffer-metadata-client.h index 68ce9587..a0f6f9e1 100644 --- a/ltt-ring-buffer-metadata-client.h +++ b/ltt-ring-buffer-metadata-client.h @@ -172,13 +172,10 @@ static struct lib_ring_buffer *ltt_buffer_read_open(struct channel *chan) { struct lib_ring_buffer *buf; - int cpu; - for_each_channel_cpu(cpu, chan) { - buf = channel_get_ring_buffer(&client_config, chan, cpu); - if (!lib_ring_buffer_open_read(buf)) - return buf; - } + buf = channel_get_ring_buffer(&client_config, chan, 0); + if (!lib_ring_buffer_open_read(buf)) + return buf; return NULL; } @@ -186,7 +183,6 @@ static void ltt_buffer_read_close(struct lib_ring_buffer *buf) { lib_ring_buffer_release_read(buf); - } static diff --git a/probes/Makefile b/probes/Makefile index 7bc3a51c..add4e88f 100644 --- a/probes/Makefile +++ b/probes/Makefile @@ -8,6 +8,8 @@ ifneq ($(CONFIG_TRACEPOINTS),) ccflags-y += -I$(PWD)/probes obj-m += lttng-types.o +obj-m += lttng-probe-lttng.o + obj-m += lttng-probe-sched.o obj-m += lttng-probe-kvm.o obj-m += lttng-probe-irq.o diff --git a/probes/lttng-probe-lttng.c b/probes/lttng-probe-lttng.c new file mode 100644 index 00000000..99a3dd9c --- /dev/null +++ b/probes/lttng-probe-lttng.c @@ -0,0 +1,22 @@ +/* + * probes/lttng-probe-core.c + * + * Copyright 2010 (c) - Mathieu Desnoyers + * + * LTTng core probes. + */ + +#include + +/* + * Create LTTng tracepoint probes. + */ +#define LTTNG_PACKAGE_BUILD +#define CREATE_TRACE_POINTS +#define TRACE_INCLUDE_PATH ../instrumentation/events/lttng-module + +#include "../instrumentation/events/lttng-module/lttng.h" + +MODULE_LICENSE("GPL and additional rights"); +MODULE_AUTHOR("Mathieu Desnoyers "); +MODULE_DESCRIPTION("LTTng core probes");