From francis.giraldeau at gmail.com Mon Jul 2 09:47:27 2012 From: francis.giraldeau at gmail.com (Francis Giraldeau) Date: Mon, 2 Jul 2012 15:47:27 +0200 Subject: [lttng-dev] [PATCH] Expose kernel tracer to user-space (version 5) Message-ID: <1341236847-16300-1-git-send-email-francis.giraldeau@gmail.com> By writing to the file /proc/lttng, a user-space application creates a kernel event. The event's payload is by default UTF-8 text, but any data can be written, up to 1024 bytes. Null-character is optional and is not enforced. The event uses sequence for space efficiency and to store any data as payload. The feature is enabled when both lttng-uevent and lttng-probe-uevent are loaded. The lttng-abi module exports a register function and includes a wrapper for lttng_fops write. This is required since struct file_operations must be const. Module unload must be prevented while lttng-uevent is being used. rcu_synchronized() is call on module unload, and thus rcu_read_lock() can be used to force waiting until the critical section is over. Signed-off-by: Francis Giraldeau --- instrumentation/events/lttng-module/uevent.h | 33 +++++++++++++++ lttng-abi.c | 42 +++++++++++++++++++ lttng-abi.h | 4 ++ probes/Makefile | 2 + probes/lttng-probe-uevent.c | 36 ++++++++++++++++ probes/lttng-uevent.c | 58 ++++++++++++++++++++++++++ 6 files changed, 175 insertions(+) create mode 100644 instrumentation/events/lttng-module/uevent.h create mode 100644 probes/lttng-probe-uevent.c create mode 100644 probes/lttng-uevent.c diff --git a/instrumentation/events/lttng-module/uevent.h b/instrumentation/events/lttng-module/uevent.h new file mode 100644 index 0000000..f67d901 --- /dev/null +++ b/instrumentation/events/lttng-module/uevent.h @@ -0,0 +1,33 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM uevent + +#if !defined(UEVENT_H_) || defined(TRACE_HEADER_MULTI_READ) +#define UEVENT_H_ + +#include + +TRACE_EVENT(lttng_uevent, + + TP_PROTO(const char *str, size_t len), + + TP_ARGS(str, len), + + /* + * Uses sequence to hold variable size data, by default considered + * as text. Null-terminal character is optional and is not enforced. + */ + TP_STRUCT__entry( + __dynamic_array_text(char, text, len) + ), + + TP_fast_assign( + tp_memcpy_dyn_from_user(text, str) + ), + + TP_printk("") +) + +#endif /* UEVENT_H_ */ + +/* This part must be outside protection */ +#include "../../../probes/define_trace.h" diff --git a/lttng-abi.c b/lttng-abi.c index 26a02ed..0de79ab 100644 --- a/lttng-abi.c +++ b/lttng-abi.c @@ -51,6 +51,11 @@ #include "lttng-tracer.h" /* + * Required data structure to support lttng-probe-uevent + */ +static write_ops_t lttng_uevent_handler; + +/* * This is LTTng's own personal way to create a system call as an external * module. We use ioctl() on /proc/lttng. */ @@ -252,9 +257,46 @@ long lttng_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } } +/* + * lttng_uevent_set_handler - set handler functions for uevent + */ + +void lttng_uevent_set_handler(write_ops_t handler) +{ + lttng_uevent_handler = handler; +} +EXPORT_SYMBOL_GPL(lttng_uevent_set_handler); + +/* + * lttng_write_uevent - expose kernel tracer to user-space + * + * The handler function is protected with rcu_read_lock() to prevent the + * module to be unloaded while the tracepoint is being used. It assumes that + * rcu_synchronize() is called on module unload. + */ + +static +ssize_t lttng_write_uevent(struct file *file, const char __user *ubuf, + size_t count, loff_t *fpos) +{ + int ret; + write_ops_t handler; + + rcu_read_lock(); + handler = rcu_dereference(lttng_uevent_handler); + if (unlikely(handler == NULL)) { + rcu_read_unlock(); + return -ENOSYS; + } + ret = handler(file, ubuf, count, fpos); + rcu_read_unlock(); + return ret; +} + static const struct file_operations lttng_fops = { .owner = THIS_MODULE, .unlocked_ioctl = lttng_ioctl, + .write = lttng_write_uevent, #ifdef CONFIG_COMPAT .compat_ioctl = lttng_ioctl, #endif diff --git a/lttng-abi.h b/lttng-abi.h index dc230d8..1f3847c 100644 --- a/lttng-abi.h +++ b/lttng-abi.h @@ -27,6 +27,10 @@ #define LTTNG_KERNEL_SYM_NAME_LEN 256 +typedef ssize_t (*write_ops_t) (struct file *, const char __user *, size_t, + loff_t *); +void lttng_uevent_set_handler(write_ops_t handler); + enum lttng_kernel_instrumentation { LTTNG_KERNEL_TRACEPOINT = 0, LTTNG_KERNEL_KPROBE = 1, diff --git a/probes/Makefile b/probes/Makefile index 698a9c9..a895e60 100644 --- a/probes/Makefile +++ b/probes/Makefile @@ -14,6 +14,8 @@ obj-m += lttng-probe-sched.o obj-m += lttng-probe-irq.o obj-m += lttng-probe-signal.o obj-m += lttng-probe-timer.o +obj-m += lttng-probe-uevent.o +obj-m += lttng-uevent.o obj-m += lttng-probe-statedump.o diff --git a/probes/lttng-probe-uevent.c b/probes/lttng-probe-uevent.c new file mode 100644 index 0000000..90abb5e --- /dev/null +++ b/probes/lttng-probe-uevent.c @@ -0,0 +1,36 @@ +/* + * probes/lttng-probe-uevent.c + * + * Expose kernel tracer to user-space through /proc/lttng + * + * Copyright (C) 2009-2012 Mathieu Desnoyers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; only + * version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +/* + * Create lttng_uevent tracepoint probes. + */ +#define LTTNG_PACKAGE_BUILD +#define CREATE_TRACE_POINTS +#define TRACE_INCLUDE_PATH ../instrumentation/events/lttng-module + +#include "../instrumentation/events/lttng-module/uevent.h" + +MODULE_LICENSE("GPL and additional rights"); +MODULE_AUTHOR("Mathieu Desnoyers "); +MODULE_DESCRIPTION("LTTng uevent probes"); diff --git a/probes/lttng-uevent.c b/probes/lttng-uevent.c new file mode 100644 index 0000000..7b4bffc --- /dev/null +++ b/probes/lttng-uevent.c @@ -0,0 +1,58 @@ +/* + * probes/lttng-uevent.c + * + * Expose kernel tracer to user-space through /proc/lttng + * + * Copyright (C) 2012 Mathieu Desnoyers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; only + * version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include "../lttng-abi.h" + +/* include our own uevent tracepoint */ +#include "../instrumentation/events/lttng-module/uevent.h" +DEFINE_TRACE(lttng_uevent); + +#define LTTNG_UEVENT_SIZE 1024 + +ssize_t uevent_write_handler(struct file *file, const char __user *ubuf, + size_t count, loff_t *fpos) +{ + if (count > LTTNG_UEVENT_SIZE) + count = LTTNG_UEVENT_SIZE; + + trace_lttng_uevent(ubuf, count); + return count; +} + +static int __init lttng_probe_uevent_init(void) +{ + lttng_uevent_set_handler(uevent_write_handler); + return 0; +} + +static void __exit lttng_probe_uevent_exit(void) +{ + lttng_uevent_set_handler(NULL); +} + +module_init(lttng_probe_uevent_init); +module_exit(lttng_probe_uevent_exit); + +MODULE_LICENSE("GPL and additional rights"); +MODULE_AUTHOR("Mathieu Desnoyers "); +MODULE_DESCRIPTION("LTTng kernel event from user-space"); -- 1.7.9.5 From mathieu.desnoyers at efficios.com Mon Jul 2 10:13:54 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 2 Jul 2012 10:13:54 -0400 Subject: [lttng-dev] [PATCH] Expose kernel tracer to user-space (version 5) In-Reply-To: <1341236847-16300-1-git-send-email-francis.giraldeau@gmail.com> References: <1341236847-16300-1-git-send-email-francis.giraldeau@gmail.com> Message-ID: <20120702141353.GA12843@Krystal> * Francis Giraldeau (francis.giraldeau at gmail.com) wrote: > By writing to the file /proc/lttng, a user-space application creates a > kernel event. The event's payload is by default UTF-8 text, but any data > can be written, up to 1024 bytes. Null-character is optional and is not > enforced. The event uses sequence for space efficiency and to store any > data as payload. Why limit to 1024 bytes ? We could use a string_from_user, and write it into a null-terminated string instead. > > The feature is enabled when both lttng-uevent and lttng-probe-uevent are > loaded. Why not combine those two into a single module ? > The lttng-abi module exports a register function and includes a wrapper > for lttng_fops write. This is required since struct file_operations must be > const. > > Module unload must be prevented while lttng-uevent is being used. > rcu_synchronized() is call on module unload, and thus rcu_read_lock() can be is call -> is called, or is invoked Thanks, Mathieu > used to force waiting until the critical section is over. > > Signed-off-by: Francis Giraldeau > --- > instrumentation/events/lttng-module/uevent.h | 33 +++++++++++++++ > lttng-abi.c | 42 +++++++++++++++++++ > lttng-abi.h | 4 ++ > probes/Makefile | 2 + > probes/lttng-probe-uevent.c | 36 ++++++++++++++++ > probes/lttng-uevent.c | 58 ++++++++++++++++++++++++++ > 6 files changed, 175 insertions(+) > create mode 100644 instrumentation/events/lttng-module/uevent.h > create mode 100644 probes/lttng-probe-uevent.c > create mode 100644 probes/lttng-uevent.c > > diff --git a/instrumentation/events/lttng-module/uevent.h b/instrumentation/events/lttng-module/uevent.h > new file mode 100644 > index 0000000..f67d901 > --- /dev/null > +++ b/instrumentation/events/lttng-module/uevent.h > @@ -0,0 +1,33 @@ > +#undef TRACE_SYSTEM > +#define TRACE_SYSTEM uevent > + > +#if !defined(UEVENT_H_) || defined(TRACE_HEADER_MULTI_READ) > +#define UEVENT_H_ > + > +#include > + > +TRACE_EVENT(lttng_uevent, > + > + TP_PROTO(const char *str, size_t len), > + > + TP_ARGS(str, len), > + > + /* > + * Uses sequence to hold variable size data, by default considered > + * as text. Null-terminal character is optional and is not enforced. > + */ > + TP_STRUCT__entry( > + __dynamic_array_text(char, text, len) > + ), > + > + TP_fast_assign( > + tp_memcpy_dyn_from_user(text, str) > + ), > + > + TP_printk("") > +) > + > +#endif /* UEVENT_H_ */ > + > +/* This part must be outside protection */ > +#include "../../../probes/define_trace.h" > diff --git a/lttng-abi.c b/lttng-abi.c > index 26a02ed..0de79ab 100644 > --- a/lttng-abi.c > +++ b/lttng-abi.c > @@ -51,6 +51,11 @@ > #include "lttng-tracer.h" > > /* > + * Required data structure to support lttng-probe-uevent > + */ > +static write_ops_t lttng_uevent_handler; > + > +/* > * This is LTTng's own personal way to create a system call as an external > * module. We use ioctl() on /proc/lttng. > */ > @@ -252,9 +257,46 @@ long lttng_ioctl(struct file *file, unsigned int cmd, unsigned long arg) > } > } > > +/* > + * lttng_uevent_set_handler - set handler functions for uevent > + */ > + > +void lttng_uevent_set_handler(write_ops_t handler) > +{ > + lttng_uevent_handler = handler; > +} > +EXPORT_SYMBOL_GPL(lttng_uevent_set_handler); > + > +/* > + * lttng_write_uevent - expose kernel tracer to user-space > + * > + * The handler function is protected with rcu_read_lock() to prevent the > + * module to be unloaded while the tracepoint is being used. It assumes that > + * rcu_synchronize() is called on module unload. > + */ > + > +static > +ssize_t lttng_write_uevent(struct file *file, const char __user *ubuf, > + size_t count, loff_t *fpos) > +{ > + int ret; > + write_ops_t handler; > + > + rcu_read_lock(); > + handler = rcu_dereference(lttng_uevent_handler); > + if (unlikely(handler == NULL)) { > + rcu_read_unlock(); > + return -ENOSYS; > + } > + ret = handler(file, ubuf, count, fpos); > + rcu_read_unlock(); > + return ret; > +} > + > static const struct file_operations lttng_fops = { > .owner = THIS_MODULE, > .unlocked_ioctl = lttng_ioctl, > + .write = lttng_write_uevent, > #ifdef CONFIG_COMPAT > .compat_ioctl = lttng_ioctl, > #endif > diff --git a/lttng-abi.h b/lttng-abi.h > index dc230d8..1f3847c 100644 > --- a/lttng-abi.h > +++ b/lttng-abi.h > @@ -27,6 +27,10 @@ > > #define LTTNG_KERNEL_SYM_NAME_LEN 256 > > +typedef ssize_t (*write_ops_t) (struct file *, const char __user *, size_t, > + loff_t *); > +void lttng_uevent_set_handler(write_ops_t handler); > + > enum lttng_kernel_instrumentation { > LTTNG_KERNEL_TRACEPOINT = 0, > LTTNG_KERNEL_KPROBE = 1, > diff --git a/probes/Makefile b/probes/Makefile > index 698a9c9..a895e60 100644 > --- a/probes/Makefile > +++ b/probes/Makefile > @@ -14,6 +14,8 @@ obj-m += lttng-probe-sched.o > obj-m += lttng-probe-irq.o > obj-m += lttng-probe-signal.o > obj-m += lttng-probe-timer.o > +obj-m += lttng-probe-uevent.o > +obj-m += lttng-uevent.o > > obj-m += lttng-probe-statedump.o > > diff --git a/probes/lttng-probe-uevent.c b/probes/lttng-probe-uevent.c > new file mode 100644 > index 0000000..90abb5e > --- /dev/null > +++ b/probes/lttng-probe-uevent.c > @@ -0,0 +1,36 @@ > +/* > + * probes/lttng-probe-uevent.c > + * > + * Expose kernel tracer to user-space through /proc/lttng > + * > + * Copyright (C) 2009-2012 Mathieu Desnoyers > + * > + * This library is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; only > + * version 2.1 of the License. > + * > + * This library is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with this library; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA > + */ > + > +#include > + > +/* > + * Create lttng_uevent tracepoint probes. > + */ > +#define LTTNG_PACKAGE_BUILD > +#define CREATE_TRACE_POINTS > +#define TRACE_INCLUDE_PATH ../instrumentation/events/lttng-module > + > +#include "../instrumentation/events/lttng-module/uevent.h" > + > +MODULE_LICENSE("GPL and additional rights"); > +MODULE_AUTHOR("Mathieu Desnoyers "); > +MODULE_DESCRIPTION("LTTng uevent probes"); > diff --git a/probes/lttng-uevent.c b/probes/lttng-uevent.c > new file mode 100644 > index 0000000..7b4bffc > --- /dev/null > +++ b/probes/lttng-uevent.c > @@ -0,0 +1,58 @@ > +/* > + * probes/lttng-uevent.c > + * > + * Expose kernel tracer to user-space through /proc/lttng > + * > + * Copyright (C) 2012 Mathieu Desnoyers > + * > + * This library is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; only > + * version 2.1 of the License. > + * > + * This library is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with this library; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA > + */ > + > +#include > +#include "../lttng-abi.h" > + > +/* include our own uevent tracepoint */ > +#include "../instrumentation/events/lttng-module/uevent.h" > +DEFINE_TRACE(lttng_uevent); > + > +#define LTTNG_UEVENT_SIZE 1024 > + > +ssize_t uevent_write_handler(struct file *file, const char __user *ubuf, > + size_t count, loff_t *fpos) > +{ > + if (count > LTTNG_UEVENT_SIZE) > + count = LTTNG_UEVENT_SIZE; > + > + trace_lttng_uevent(ubuf, count); > + return count; > +} > + > +static int __init lttng_probe_uevent_init(void) > +{ > + lttng_uevent_set_handler(uevent_write_handler); > + return 0; > +} > + > +static void __exit lttng_probe_uevent_exit(void) > +{ > + lttng_uevent_set_handler(NULL); > +} > + > +module_init(lttng_probe_uevent_init); > +module_exit(lttng_probe_uevent_exit); > + > +MODULE_LICENSE("GPL and additional rights"); > +MODULE_AUTHOR("Mathieu Desnoyers "); > +MODULE_DESCRIPTION("LTTng kernel event from user-space"); > -- > 1.7.9.5 > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From pavan.anumula at sasken.com Mon Jul 2 10:35:58 2012 From: pavan.anumula at sasken.com (Pavan Anumula) Date: Mon, 2 Jul 2012 20:05:58 +0530 Subject: [lttng-dev] Adding New Tracepoints Message-ID: <47D610AD9C485E458630BA38C324D3B60113FB9D4D97@EXGMBX01.sasken.com> Hi ALL, I am newbie to Tracing mechanism and LTTng usage ,I want to calculate the overhead of LTTng (without using caliberate command), For that I added some trace points to function "timer_interrupt() " inside kernel "arch/arm/mach-davinci/time.c", So that I can calculate time differences by enabling and disabling them. I followed the Kernel documentation of tracepoints and also declared the tracpoints and defined and registered probefunctions for those trace points. But I can't see my new trace points when I give the command "arm-none-linux-gnueabi-lttng list -k". Can we add our own new trace points so that it will call probe function which I define?? If so please let me know the procedure in order to use them for LTTng overhead measurement. Also let me know the procedure for enabling and disabling newly added tracepoints in LTTng. I am using. Lttng modules 2.0.2 Lttng tools:2.0.1 Kernel:2.6.33.7 with RT-29 patch. Thanks In Advance, Pavan -----Original Message----- From: Pavan Anumula Sent: Thursday, June 21, 2012 8:54 PM To: 'David Goulet' Cc: lttng-dev at lists.lttng.org; Mathieu Desnoyers (mathieu.desnoyers at efficios.com) Subject: RE: [lttng-dev] Empty traces for UST Hi David, We tried to debug lttng commands with gdbserver on the arm target from host gdb remote target session following were obersevations: 1. create Session gdbserver --remote-debug localhost:5560 arm-none-linux-gnueabi-lttng -vvv create sesAA >>passed with out and errors 2. Enable events for session gdbserver --remote-debug localhost:5560 arm-none-linux-gnueabi-lttng -vvv enable-event -u -a >> failed randomly with segment faults and memeory allocation error see >> below trace error >>> (gdb) n >>>312 goto error; >>> (gdb) n >>>318 handle = lttng_create_handle(session_name, &dom); >>> (gdb) s >>>lttng_create_handle (session_name=0x40015154 "", domain=0xbe810bbc) at lttng-ctl.c:395 >>>395 perror("malloc handle"); Some times it used to print: >>>/lib/ld-linux.so.3: No such file or directory Or Segment faults Here is the /proc/meminfo of device: root at arago:~# cat /proc/meminfo MemTotal: 28220 kB MemFree: 12704 kB Buffers: 0 kB Cached: 7520 kB SwapCached: 0 kB Active: 4804 kB Inactive: 4984 kB Active(anon): 2296 kB Inactive(anon): 84 kB Active(file): 2508 kB Inactive(file): 4900 kB Unevictable: 0 kB Mlocked: 0 kB SwapTotal: 0 kB SwapFree: 0 kB Dirty: 0 kB Writeback: 0 kB AnonPages: 2296 kB Mapped: 2000 kB Shmem: 112 kB Slab: 3188 kB SReclaimable: 808 kB SUnreclaim: 2380 kB KernelStack: 576 kB PageTables: 288 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 14108 kB Committed_AS: 47704 kB VmallocTotal: 985088 kB VmallocUsed: 400 kB VmallocChunk: 984612 kB Please suggest how to overcome this issue. Regards, Pavan -----Original Message----- From: David Goulet [mailto:dgoulet at efficios.com] Sent: Friday, June 15, 2012 8:28 PM To: Pavan Anumula Cc: lttng-dev at lists.lttng.org Subject: Re: [lttng-dev] Empty traces for UST -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Pavan, Glad for the kernel! :) For UST, I'll recommend you start a session daemon like so "lttng-sessiond - -vvv". After that, use the lttng-ust/tests/hello program and execute it. You should see on the debug output of the session daemon that the application "hello" has registered and is ready for tracing. Your output below does NOT show those debug messages so it would be a good start to see if there is a problem at that point. Also, make sure that the liblttng-ust is installed upon compiling lttng-tools so that the user space tracer support is enabled in the tools. Thanks! David On 15/06/12 10:50 AM, Pavan Anumula wrote: > Hi David, > > Finally I was able to get kernel traces by referring to one of your > other posts , Actually lttng-consumerd binary was actually not > present at the needed path, Thanks for your help. > > And sorry for bugging you with mails :) . > > > But this time I am facing issues at UST tracing . Please kindly help > me on this. > > When I try to trace for User space it is creating an empty folder with > no traces on ARM target, I tried with all the sample trace programs in > LTTng-UST/tests folder. > > I am using NFS to load binaries and for tracing will that causes problem. > Please also find the debug logs attached, > > Please also let me know if you want some more information. > > > ************************************** fcntl64(12, F_SETFD, FD_CLOEXEC) > = 0 fcntl64(13, F_SETFD, FD_CLOEXEC) = 0 pipe([14, 15]) > = 0 fcntl64(14, F_SETFD, FD_CLOEXEC) = 0 fcntl64(15, F_SETFD, > FD_CLOEXEC) = 0 getrlimit(RLIMIT_NOFILE, {rlim_cur=65535, > rlim_max=65535}) = 0 write(2, "DEBUG1: poll set max size set to"..., > 92DEBUG1: poll set max size set to 65535 [in > compat_poll_set_max_size() at compat-poll.c:196] ) = 92 mmap2(NULL, > 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4024b000 mprotect(0x4024b000, 4096, > PROT_NONE) = 0 clone(child_stack=0x40a49ef8, > flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_S > YSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, > parent_tidptr=0x40a4a3e8, tls=0x40a4a840, child_tidptr=0x40a4a3e8) = > 921 mmap2(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, > 0) = 0x40a4b000 mprotect(0x40a4b000, 4096, PROT_NONE) = 0 > clone(child_stack=0x41249ef8, > flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_S > YSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, > parent_tidptr=0x4124a3e8, tls=0x4124a840, child_tidptr=0x4124a3e8) = > 922 mmap2(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, > 0) = 0x4124b000 mprotect(0x4124b000, 4096, PROT_NONE) = 0 > clone(child_stack=0x41a49ef8, > flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_S > YSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, > parent_tidptr=0x41a4a3e8, tls=0x41a4a840, child_tidptr=0x41a4a3e8) = > 923 mmap2(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, > 0) = 0x41a4b000 mprotect(0x41a4b000, 4096, PROT_NONE) = 0 clone(DEBUG1: > [thread] Dispatch UST command started [in > thread_dispatch_ust_registration() at main.c:1324] DEBUG1: Futex n to > 1 prepare done [in futex_nto1_prepare() at futex.c:73] DEBUG1: Woken > up but nothing in the UST command queue [in > thread_dispatch_ust_registration() at main.c:1334] DEBUG1: [thread] > Manage application registration started [in > thread_registration_apps() at main.c:1392] DEBUG1: fd 3 of 1 added to > pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: fd 11 of 2 > added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: > Notifying applications of session daemon state: 1 [in > notify_ust_apps() at main.c:687] DEBUG1: Got the wait shm fd 16 [in > get_wait_shm() at shm.c:117] DEBUG1: Futex wait update active 1 [in > futex_wait_update() at futex.c:62] DEBUG1: Accepting application > registration [in > thread_registration_apps() at main.c:1423] DEBUG1: [thread] Manage > application started [in thread_manage_apps() at main.c:1179] DEBUG1: > fd 3 of 1 added to pollfd [in compat_poll_add() at compat-poll.c:91] > DEBUG1: fd > 14 of 2 added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: > Apps thread polling on 2 fds [in thread_manage_apps() at main.c:1200] > DEBUG1: [thread] Manage client started [in thread_manage_clients() at > main.c:3794] DEBUG1: fd 3 of 1 added to pollfd [in compat_poll_add() > at compat-poll.c:91] DEBUG1: fd 10 of 2 added to pollfd [in > compat_poll_add() at compat-poll.c:91] DEBUG1: Accepting client > command ... [in > thread_manage_clients() at main.c:3826] child_stack=0x42249ef8, > flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_S > YSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, > parent_tidptr=0x4224a3e8, tls=0x4224a840, child_tidptr=0x4224a3e8) = > 924 mmap2(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, > 0) = 0x4224b000 mprotect(0x4224b000, 4096, PROT_NONE) = 0 > clone(child_stack=0x42a49ef8, > flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_S > YSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, > parent_tidptr=0x42a4a3e8, tls=0x42a4a840, child_tidptr=0x42a4a3e8) = > 925 futex(0x42a4a3e8, FUTEX_WAIT, 925, NULLDEBUG1: Thread manage > kernel started [in thread_manage_kernel() at main.c:876] DEBUG1: fd 3 > of 1 added to pollfd [in compat_poll_add() at compat-poll.c:91] > DEBUG1: fd 12 of 2 added to pollfd [in compat_poll_add() at > compat-poll.c:91] DEBUG1: Updating kernel poll set [in > update_kernel_poll() at main.c:748] DEBUG1: Thread kernel polling on 2 > fds [in thread_manage_kernel() at main.c:905] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: > Receiving data from client ... [in thread_manage_clients() at > main.c:3898] > DEBUG1: Nothing recv() from client... continuing [in > thread_manage_clients() at main.c:3902] DEBUG1: Clean command context > structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting > client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: > Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: > Receiving data from client ... [in thread_manage_clients() at > main.c:3898] > DEBUG1: Processing client command 8 [in process_client_msg() at > main.c:3309] DEBUG2: Trying to find session by name sesCCC [in > session_find_by_name() at session.c:126] DEBUG3: mkdir() recursive > /home/root/lttng-traces/sesCCC-20110327-045731 with mode 504 for uid 0 > and gid 0 [in run_as_mkdir_recursive() at runas.c:338] DEBUG1: Using > run_as_clone [in run_as() at runas.c:322] DEBUG1: Tracing session > sesCCC created in /home/root/lttng-traces/sesCCC-20110327-045731 with > ID 1 by UID > 0 GID 0 [in session_create() at session.c:234] DEBUG1: Sending > response > (size: 16, retcode: Success) [in thread_manage_clients() at > main.c:3936] > DEBUG1: Clean command context structure [in clean_command_ctx() at > main.c:534] DEBUG1: Accepting client command ... [in > thread_manage_clients() at main.c:3826] DEBUG1: Wait for client > response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving > data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Nothing > recv() from client... continuing [in thread_manage_clients() at > main.c:3902] DEBUG1: Clean command context structure [in > clean_command_ctx() at main.c:534] DEBUG1: Accepting client command > ... [in > thread_manage_clients() at main.c:3826] DEBUG1: Wait for client > response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving > data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Processing client command 6 [in process_client_msg() at > main.c:3309] DEBUG1: Getting session sesCCC by name [in process_client_msg() at main.c:3364] DEBUG2: > Trying to find session by name sesCCC [in session_find_by_name() at > session.c:126] DEBUG1: Creating UST session [in create_ust_session() > at main.c:1965] DEBUG3: Created hashtable size 4 at 0x4fa08 of type 1 > [in > lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at > 0x4fb28 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: > Created hashtable size 4 at 0x4fc48 of type 0 [in lttng_ht_new() at > hashtable.c:96] DEBUG2: UST trace session create successful [in > trace_ust_create_session() at trace-ust.c:119] DEBUG3: mkdir() > recursive /home/root/lttng-traces/sesCCC-20110327-045731/ust with mode > 504 for uid 0 and gid 0 [in run_as_mkdir_recursive() at runas.c:338] > DEBUG1: Using run_as_clone [in run_as() at runas.c:322] DEBUG1: > Spawning consumerd [in > spawn_consumerd() at main.c:1659] DEBUG1: Using 32-bit UST consumer at: > /root/armfilesystem/lib/lttng/libexec/lttng-consumerd [in > spawn_consumerd() at main.c:1777] DEBUG2: Consumer pid 934 [in > start_consumerd() at main.c:1830] DEBUG2: Spawning consumer control > thread [in start_consumerd() at main.c:1833] DEBUG1: [thread] Manage > consumer started [in > thread_manage_consumer() at main.c:982] DEBUG1: fd 3 of 1 added to > pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: fd 9 of 2 > added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG2: > Receiving code from consumer err_sock [in thread_manage_consumer() at main.c:1043] DEBUG1: > consumer command socket ready [in thread_manage_consumer() at > main.c:1062] > DEBUG1: fd 17 of 2 added to pollfd [in compat_poll_add() at > compat-poll.c:91] DEBUG2: Trace UST channel channel0 not found by name > [in > trace_ust_find_channel_by_name() at trace-ust.c:52] DEBUG3: Created > hashtable size 4 at 0x51310 of type 0 [in lttng_ht_new() at > hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x51430 of type 1 > [in > lttng_ht_new() at hashtable.c:96] DEBUG2: Trace UST channel channel0 > created [in trace_ust_create_channel() at trace-ust.c:181] DEBUG2: > Channel > channel0 being created in UST global domain [in channel_ust_create() > at channel.c:267] DEBUG2: UST app adding channel channel0 to global > domain for session id 1 [in ust_app_create_channel_glb() at ust-app.c:1792] DEBUG2: > Channel channel0 created successfully [in channel_ust_create() at > channel.c:292] DEBUG2: Trace UST channel channel0 found by name [in > trace_ust_find_channel_by_name() at trace-ust.c:47] DEBUG2: Trace UST > event NOT found by name * [in trace_ust_find_event_by_name() at > trace-ust.c:79] > DEBUG3: Created hashtable size 4 at 0x51550 of type 1 [in > lttng_ht_new() at hashtable.c:96] DEBUG2: Trace UST event *, loglevel > (0,-1) created [in > trace_ust_create_event() at trace-ust.c:260] DEBUG1: UST app creating > event > * for all apps for session id 1 [in ust_app_create_event_glb() at > ust-app.c:1916] DEBUG1: Event UST * created in channel channel0 [in > event_ust_enable_tracepoint() at event.c:446] DEBUG1: Sending response > (size: 16, retcode: Success) [in thread_manage_clients() at > main.c:3936] > DEBUG1: Clean command context structure [in clean_command_ctx() at > main.c:534] DEBUG1: Accepting client command ... [in > thread_manage_clients() at main.c:3826] DEBUG1: Wait for client > response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving > data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Nothing > recv() from client... continuing [in thread_manage_clients() at > main.c:3902] DEBUG1: Clean command context structure [in > clean_command_ctx() at main.c:534] DEBUG1: Accepting client command > ... [in > thread_manage_clients() at main.c:3826] DEBUG1: Wait for client > response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving > data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Processing client command 16 [in process_client_msg() at > main.c:3309] DEBUG1: Getting session sesCCC by name [in process_client_msg() at main.c:3364] DEBUG2: > Trying to find session by name sesCCC [in session_find_by_name() at > session.c:126] DEBUG1: Starting all UST traces [in > ust_app_start_trace_all() at ust-app.c:2207] DEBUG1: Sending response > (size: 16, retcode: Success) [in thread_manage_clients() at > main.c:3936] > DEBUG1: Clean command context structure [in clean_command_ctx() at > main.c:534] DEBUG1: Accepting client command ... [in > thread_manage_clients() at main.c:3826] > ************************************************ > > > > > > Thanks in Advance, Pavan > > > -----Original Message----- From: David Goulet > [mailto:dgoulet at efficios.com] Sent: Tuesday, June 12, 2012 9:05 PM To: > Pavan Anumula Cc: lttng-dev at lists.lttng.org Subject: Re: [lttng-dev] > Lttng start failed > > Hi Pavan, > > The output below is normal and should be working fine. However, the > problem is that you have _NO_ debug message after the "lttng start". > That command should at least produce 10+ lines of messages after this last line: > > "DEBUG1: Accepting application registration [in > thread_registration_apps() at main.c:1423]" > > Can you enlight me and tell me if by doing "lttng create newsessiom" > and "lttng enable-event -a -k", you have output messages coming out of > the session daemon in -vvv mode ? > > If NOT, you are talking to another daemon! A quick "ps faux | grep > lttng-sessiond" could help clear that question. > > If only one daemon is running and stuck at the above debug message, > the next step is to tell me on what the daemon is waiting on using > either "strace -p" or "gdb" also. There is 6 threads so having the > strace -p output for all of them would help me greatly. > > Thanks! David > > On 12/06/12 10:05 AM, Mathieu Desnoyers wrote: >> * Pavan Anumula (pavan.anumula at sasken.com) wrote: >>> Hi Mathieu, Still I am unable to start tracing, And I am facing the >>> same start errors. Please kindly help me on this. This time I >>> loaded the modules by modprobe( not with insmod as I did before), >>> Then I run the command " arm-none-linux-gnueabi-lttng-sessiond >>> -vvv " (before arm-none-linux-gnueabi-lttng-sessiond -d), > >> When using "arm-none-linux-gnueabi-lttng-sessiond -vvv", you should >> _not_ run "arm-none-linux-gnueabi-lttng-sessiond -d". > > >>> The below is the Output, And It got hanged overthere. > >> This is normal: the sessiond is waiting for applications to connect. >> It does not hang, it just waits. > >> David, can you follow up on this issue ? It seems to be >> sessiond-related. > >> Thanks, > >> Mathieu > > >>> Later when I started lttng start I am acing the same erros below: >>> root at arago:~/lttng-traces# arm-none-linux-gnueabi-lttng start LTTng: >>> Failure to write metadata to buffers (timeout) Error: Starting >>> kernel trace failed >>> >>> ******************************************************************** >>> * >>> *************************** >>> >>> > DEBUG3: Creating LTTng run directory: /var/run/lttng [in > create_lttng_rundir() at main.c:4315] >>> DEBUG2: Kernel consumer err path: /var/run/lttng/kconsumerd/error >>> [in >>> main() at main.c:4543] DEBUG2: Kernel consumer cmd path: >>> /var/run/lttng/kconsumerd/command [in main() at main.c:4545] DEBUG1: >>> Client socket path /var/run/lttng/client-lttng-sessiond [in main() >>> at main.c:4592] DEBUG1: Application socket path >>> /var/run/lttng/apps-lttng-sessiond [in main() at main.c:4593] DEBUG1: >>> LTTng run directory path: /var/run/lttng [in main() at main.c:4594] >>> DEBUG2: UST consumer 32 bits err path: >>> /var/run/lttng/ustconsumerd32/error [in main() at main.c:4603] DEBUG2: >>> UST consumer 32 bits cmd path: /var/run/lttng/ustconsumerd32/command >>> [in main() at main.c:4605] DEBUG2: UST consumer 64 bits err path: >>> /var/run/lttng/ustconsumerd64/error [in main() at main.c:4614] DEBUG2: >>> UST consumer 64 bits cmd path: /var/run/lttng/ustconsumerd64/command >>> [in main() at main.c:4616] DEBUG3: Created hashtable size 4 at >>> 0x4a080 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: >>> Created hashtable size 4 at 0x4a168 of type 1 [in lttng_ht_new() at >>> hashtable.c:96] DEBUG2: Creating consumer directory: >>> /var/run/lttng/kconsumerd [in set_consumer_sockets() at main.c:4357] >>> DEBUG1: Modprobe successfully lttng-tracer [in >>> modprobe_lttng_control() at modprobe.c:163] DEBUG2: Kernel tracer >>> version validated (major version 2) [in kernel_validate_version() at kernel.c:675] DEBUG1: >>> Modprobe successfully lttng-ftrace [in modprobe_lttng_data() at >>> modprobe.c:199] DEBUG1: Modprobe successfully lttng-kprobes [in >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe >>> successfully lttng-kretprobes [in modprobe_lttng_data() at modprobe.c:199] DEBUG1: >>> Modprobe successfully lttng-lib-ring-buffer [in >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe >>> successfully lttng-ring-buffer-client-discard [in >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe >>> successfully lttng-ring-buffer-client-overwrite [in >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe >>> successfully lttng-ring-buffer-metadata-client [in >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe >>> successfully lttng-ring-buffer-client-mmap-discard [in >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe >>> successfully lttng-ring-buffer-client-mmap-overwrite [in >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe >>> successfully lttng-ring-buffer-metadata-mmap-client [in >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe >>> successfully lttng-probe-lttng [in >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe >>> successfully lttng-types [in modprobe_lttng_data() at modprobe.c:199] DEBUG1: >>> Modprobe successfully lttng-probe-block [in modprobe_lttng_data() at >>> modprobe.c:199] DEBUG1: Modprobe successfully lttng-probe-irq [in >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe >>> successfully lttng-probe-kvm [in modprobe_lttng_data() at modprobe.c:199] DEBUG1: >>> Modprobe successfully lttng-probe-sched [in modprobe_lttng_data() at >>> modprobe.c:199] DEBUG1: Modprobe successfully lttng-probe-signal [in >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe >>> successfully lttng-probe-statedump [in modprobe_lttng_data() at >>> modprobe.c:199] >>> DEBUG1: Modprobe successfully lttng-probe-timer [in >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Kernel tracer fd 6 >>> [in >>> init_kernel_tracer() at main.c:1887] DEBUG2: Creating consumer >>> directory: /var/run/lttng/ustconsumerd64 [in set_consumer_sockets() >>> at main.c:4357] DEBUG2: Creating consumer directory: >>> /var/run/lttng/ustconsumerd32 [in set_consumer_sockets() at >>> main.c:4357] DEBUG1: Signal handler set for SIGTERM, SIGPIPE and >>> SIGINT [in set_signal_handler() at main.c:4449] DEBUG1: All >>> permissions are set [in set_permissions() at main.c:4250] DEBUG1: >>> poll set max size set to 65535 [in compat_poll_set_max_size() at compat-poll.c:196] DEBUG1: >>> [thread] Manage application started [in thread_manage_apps() at >>> main.c:1179] DEBUG1: fd 3 of 1 added to pollfd [in compat_poll_add() >>> at compat-poll.c:91] DEBUG1: fd 13 of 2 added to pollfd [in >>> compat_poll_add() at compat-poll.c:91] DEBUG1: Apps thread polling >>> on 2 fds [in thread_manage_apps() at main.c:1200] DEBUG1: Thread >>> manage kernel started [in thread_manage_kernel() at main.c:876] >>> DEBUG1: fd 3 of 1 added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: >>> fd 11 of 2 added to pollfd [in compat_poll_add() at >>> compat-poll.c:91] >>> DEBUG1: Updating kernel poll set [in update_kernel_poll() at >>> main.c:748] DEBUG1: Thread kernel polling on 2 fds [in >>> thread_manage_kernel() at main.c:905] DEBUG1: [thread] Manage >>> application registration started [in thread_registration_apps() at >>> main.c:1392] DEBUG1: fd 3 of 1 added to pollfd [in compat_poll_add() >>> at compat-poll.c:91] DEBUG1: fd 10 of 2 added to pollfd [in >>> compat_poll_add() at compat-poll.c:91] DEBUG1: Notifying >>> applications of session daemon state: 1 [in notify_ust_apps() at >>> main.c:687] >>> DEBUG1: [thread] Dispatch UST command started [in >>> thread_dispatch_ust_registration() at main.c:1324] DEBUG1: Futex n >>> to 1 prepare done [in futex_nto1_prepare() at futex.c:73] DEBUG1: >>> Woken up but nothing in the UST command queue [in >>> thread_dispatch_ust_registration() at main.c:1334] DEBUG1: [thread] >>> Manage client started [in thread_manage_clients() at main.c:3794] >>> DEBUG1: fd 3 of 1 added to pollfd [in compat_poll_add() at >>> compat-poll.c:91] DEBUG1: fd 9 of 2 added to pollfd [in >>> compat_poll_add() at compat-poll.c:91] DEBUG1: Accepting client >>> command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Got >>> the wait shm fd 15 [in get_wait_shm() at shm.c:117] DEBUG1: Futex >>> wait update active 1 [in futex_wait_update() at futex.c:62] DEBUG1: >>> Accepting application registration [in thread_registration_apps() at >>> main.c:1423] >>> ******************************************************************** >>> * >>> *********************************** >>> >>> > Am I missing anything?? >>> >>> Thanks in Advance, Pavan >>> >>> >>> ________________________________________ From: Mathieu Desnoyers >>> [mathieu.desnoyers at efficios.com] Sent: Monday, June 11, 2012 7:24 PM >>> To: Pavan Anumula Cc: lttng-dev at lists.lttng.org Subject: Re: >>> [lttng-dev] Lttng start failed >>> >>> * Pavan Anumula (pavan.anumula at sasken.com) wrote: >>>> Hi Mathieu, >>>> >>>> Please find the info below as per your comments >>>> >>>> >>>> ########## Output of command >>>> "arm-none-linux-gnueabi-lttng-sessiond >>>> -vvv " , After loading the modules ####### >>>> >>>> DEBUG3: Creating LTTng run directory: /var/run/lttng [in >>>> create_lttng_rundir() at main.c:4315] DEBUG2: Kernel consumer err >>>> path: /var/run/lttng/kconsumerd/error [in main() at main.c:4543] >>>> DEBUG2: Kernel consumer cmd path: /var/run/lttng/kconsumerd/command >>>> [in main() at main.c:4545] DEBUG1: Client socket path >>>> /var/run/lttng/client-lttng-sessiond [in main() at main.c:4592] >>>> DEBUG1: Application socket path /var/run/lttng/apps-lttng-sessiond >>>> [in main() at main.c:4593] DEBUG1: LTTng run directory path: >>>> /var/run/lttng [in main() at main.c:4594] DEBUG2: UST consumer 32 >>>> bits err path: /var/run/lttng/ustconsumerd32/error [in main() at >>>> main.c:4603] DEBUG2: UST consumer 32 bits cmd path: >>>> /var/run/lttng/ustconsumerd32/command [in main() at main.c:4605] >>>> DEBUG2: UST consumer 64 bits err path: >>>> /var/run/lttng/ustconsumerd64/error [in main() at main.c:4614] >>>> DEBUG2: UST consumer 64 bits cmd path: >>>> /var/run/lttng/ustconsumerd64/command [in main() at main.c:4616] >>>> DEBUG3: Created hashtable size 4 at 0x4a080 of type 1 [in >>>> lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 >>>> at >>>> 0x4a168 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG2: >>>> Creating consumer directory: /var/run/lttng/kconsumerd [in >>>> set_consumer_sockets() at main.c:4357] FATAL: Module lttng_tracer >>>> not found. Error: Unable to load module lttng-tracer >>> >>> Hrm. You want to do kernel tracing, but modprobe cannot find the >>> lttng kernel tracer modules. You might want to run depmod -a or >>> something like that on your target, and ensure that modprobe works properly. >>> >>> Thanks, >>> >>> Mathieu >>> >>>> DEBUG2: Kernel tracer version validated (major version 2) [in >>>> kernel_validate_version() at kernel.c:675] DEBUG1: Modprobe >>>> successfully lttng-ftrace [in modprobe_lttng_data() at >>>> modprobe.c:199] DEBUG1: Modprobe successfully lttng-kprobes [in >>>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe >>>> successfully lttng-kretprobes [in modprobe_lttng_data() at >>>> modprobe.c:199] FATAL: Module lttng_lib_ring_buffer not found. Error: >>>> Unable to load module lttng-lib-ring-buffer FATAL: Module >>>> lttng_ring_buffer_client_discard not found. Error: Unable to load >>>> module lttng-ring-buffer-client-discard FATAL: Module >>>> lttng_ring_buffer_client_overwrite not found. Error: Unable to load >>>> module lttng-ring-buffer-client-overwrite FATAL: Module >>>> lttng_ring_buffer_metadata_client not found. Error: Unable to load >>>> module lttng-ring-buffer-metadata-client FATAL: Module >>>> lttng_ring_buffer_client_mmap_discard not found. Error: Unable to >>>> load module lttng-ring-buffer-client-mmap-discard FATAL: Module >>>> lttng_ring_buffer_client_mmap_overwrite not found. Error: Unable to >>>> load module lttng-ring-buffer-client-mmap-overwrite FATAL: Module >>>> lttng_ring_buffer_metadata_mmap_client not found. Error: Unable to >>>> load module lttng-ring-buffer-metadata-mmap-client FATAL: Module >>>> lttng_probe_lttng not found. Error: Unable to load module >>>> lttng-probe-lttng DEBUG1: Modprobe successfully lttng-types [in >>>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe >>>> successfully lttng-probe-block [in modprobe_lttng_data() at >>>> modprobe.c:199] DEBUG1: Modprobe successfully lttng-probe-irq [in >>>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe >>>> successfully lttng-probe-kvm [in modprobe_lttng_data() at >>>> modprobe.c:199] DEBUG1: Modprobe successfully lttng-probe-sched [in >>>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe >>>> successfully lttng-probe-signal [in modprobe_lttng_data() at >>>> modprobe.c:199] DEBUG1: Modprobe successfully lttng-probe-statedump >>>> [in modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe >>>> successfully lttng-probe-timer [in modprobe_lttng_data() at >>>> modprobe.c:199] DEBUG1: Kernel tracer fd 6 [in init_kernel_tracer() >>>> at main.c:1887] DEBUG2: Creating consumer directory: >>>> /var/run/lttng/ustconsumerd64 [in set_consumer_sockets() at >>>> main.c:4357] DEBUG2: Creating consumer directory: >>>> /var/run/lttng/ustconsumerd32 [in set_consumer_sockets() at >>>> main.c:4357] DEBUG1: Signal handler set for SIGTERM, SIGPIPE and >>>> SIGINT [in set_signal_handler() at main.c:4449] DEBUG1: All >>>> permissions are set [in set_permissions() at main.c:4250] DEBUG1: >>>> poll set max size set to 65535 [in compat_poll_set_max_size() at >>>> compat-poll.c:196] DEBUG1: [thread] Manage client started [in >>>> thread_manage_clients() at main.c:3794] DEBUG1: fd 3 of 1 added to >>>> pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: fd 9 of 2 >>>> added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: >>>> Accepting client command ... [in thread_manage_clients() at >>>> main.c:3826] DEBUG1: [thread] Dispatch UST command started [in >>>> thread_dispatch_ust_registration() at main.c:1324] DEBUG1: Futex n >>>> to >>>> 1 prepare done [in futex_nto1_prepare() at futex.c:73] DEBUG1: >>>> Woken up but nothing in the UST command queue [in >>>> thread_dispatch_ust_registration() at main.c:1334] DEBUG1: Thread >>>> manage kernel started [in thread_manage_kernel() at main.c:876] >>>> DEBUG1: fd 3 of 1 added to pollfd [in compat_poll_add() at >>>> compat-poll.c:91] DEBUG1: fd 11 of 2 added to pollfd [in >>>> compat_poll_add() at compat-poll.c:91] DEBUG1: Updating kernel poll >>>> set [in update_kernel_poll() at main.c:748] DEBUG1: Thread kernel >>>> polling on 2 fds [in thread_manage_kernel() at main.c:905] DEBUG1: >>>> [thread] Manage application started [in thread_manage_apps() at >>>> main.c:1179] DEBUG1: fd 3 of 1 added to pollfd [in >>>> compat_poll_add() at compat-poll.c:91] DEBUG1: fd 13 of 2 added to >>>> pollfd [in >>>> compat_poll_add() at compat-poll.c:91] DEBUG1: Apps thread polling >>>> on >>>> 2 fds [in thread_manage_apps() at main.c:1200] DEBUG1: [thread] >>>> Manage application registration started [in >>>> thread_registration_apps() at main.c:1392] DEBUG1: fd 3 of 1 added >>>> to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: fd 10 >>>> of 2 added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: >>>> Notifying applications of session daemon state: 1 [in >>>> notify_ust_apps() at main.c:687] DEBUG1: Got the wait shm fd 15 [in >>>> get_wait_shm() at shm.c:117] DEBUG1: Futex wait update active 1 [in >>>> futex_wait_update() at futex.c:62] DEBUG1: Accepting application >>>> registration [in thread_registration_apps() at main.c:1423] >>>> >>>> >>>> >>>> #### Output of command "arm-none-linux-gnueabi-lttng-sessiond -vvv >>>> " before loading the modules ############# >>>> >>>> DEBUG3: Creating LTTng run directory: /var/run/lttng [in >>>> create_lttng_rundir() at main.c:4315] DEBUG2: Kernel consumer err >>>> path: /var/run/lttng/kconsumerd/error [in main() at main.c:4543] >>>> DEBUG2: Kernel consumer cmd path: /var/run/lttng/kconsumerd/command >>>> [in main() at main.c:4545] DEBUG1: Client socket path >>>> /var/run/lttng/client-lttng-sessiond [in main() at main.c:4592] >>>> DEBUG1: Application socket path /var/run/lttng/apps-lttng-sessiond >>>> [in main() at main.c:4593] DEBUG1: LTTng run directory path: >>>> /var/run/lttng [in main() at main.c:4594] DEBUG2: UST consumer 32 >>>> bits err path: /var/run/lttng/ustconsumerd32/error [in main() at >>>> main.c:4603] DEBUG2: UST consumer 32 bits cmd path: >>>> /var/run/lttng/ustconsumerd32/command [in main() at main.c:4605] >>>> DEBUG2: UST consumer 64 bits err path: >>>> /var/run/lttng/ustconsumerd64/error [in main() at main.c:4614] >>>> DEBUG2: UST consumer 64 bits cmd path: >>>> /var/run/lttng/ustconsumerd64/command [in main() at main.c:4616] >>>> DEBUG3: Created hashtable size 4 at 0x4a080 of type 1 [in >>>> lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 >>>> at >>>> 0x4a168 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG2: >>>> Creating consumer directory: /var/run/lttng/kconsumerd [in >>>> set_consumer_sockets() at main.c:4357] FATAL: Module lttng_tracer >>>> not found. Error: Unable to load module lttng-tracer DEBUG1: Failed >>>> to open /proc/lttng [in init_kernel_tracer() at main.c:1871] Error: >>>> Unable to remove module lttng-tracer Warning: No kernel tracer >>>> available DEBUG2: Creating consumer directory: >>>> /var/run/lttng/ustconsumerd64 [in set_consumer_sockets() at >>>> main.c:4357] DEBUG2: Creating consumer directory: >>>> /var/run/lttng/ustconsumerd32 [in set_consumer_sockets() at >>>> main.c:4357] DEBUG1: Signal handler set for SIGTERM, SIGPIPE and >>>> SIGINT [in set_signal_handler() at main.c:4449] DEBUG1: All >>>> permissions are set [in set_permissions() at main.c:4250] DEBUG1: >>>> poll set max size set to 65535 [in compat_poll_set_max_size() at >>>> compat-poll.c:196] DEBUG1: [thread] Manage application started [in >>>> thread_manage_apps() at main.c:1179] DEBUG1: fd 3 of 1 added to >>>> pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: fd 12 of >>>> 2 added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: >>>> Apps thread polling on 2 fds [in thread_manage_apps() at >>>> main.c:1200] >>>> DEBUG1: Thread manage kernel started [in thread_manage_kernel() at >>>> main.c:876] DEBUG1: fd 3 of 1 added to pollfd [in compat_poll_add() >>>> at compat-poll.c:91] DEBUG1: fd 10 of 2 added to pollfd [in >>>> compat_poll_add() at compat-poll.c:91] DEBUG1: Updating kernel poll >>>> set [in update_kernel_poll() at main.c:748] DEBUG1: Thread kernel >>>> polling on 2 fds [in thread_manage_kernel() at main.c:905] DEBUG1: >>>> [thread] Manage application registration started [in >>>> thread_registration_apps() at main.c:1392] DEBUG1: fd 3 of 1 added >>>> to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: fd 9 >>>> of 2 added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: >>>> Notifying applications of session daemon state: 1 [in >>>> notify_ust_apps() at main.c:687] DEBUG1: [thread] Dispatch UST >>>> command started [in thread_dispatch_ust_registration() at >>>> main.c:1324] DEBUG1: Futex n to 1 prepare done [in >>>> futex_nto1_prepare() at futex.c:73] DEBUG1: Woken up but nothing in >>>> the UST command queue [in thread_dispatch_ust_registration() at >>>> main.c:1334] DEBUG1: [thread] Manage client started [in >>>> thread_manage_clients() at main.c:3794] DEBUG1: fd 3 of 1 added to >>>> pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: fd 8 of 2 >>>> added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: >>>> Accepting client command ... [in thread_manage_clients() at >>>> main.c:3826] DEBUG1: Got the wait shm fd 14 [in get_wait_shm() at >>>> shm.c:117] DEBUG1: Futex wait update active 1 [in >>>> futex_wait_update() at futex.c:62] DEBUG1: Accepting application >>>> registration [in >>>> thread_registration_apps() at main.c:1423] >>>> >>>> >>>> Regards, Pavan >>>> >>>> -----Original Message----- From: Mathieu Desnoyers >>>> [mailto:mathieu.desnoyers at efficios.com] Sent: Saturday, June 09, >>>> 2012 6:03 PM To: Pavan Anumula Cc: lttng-dev at lists.lttng.org Subject: >>>> Re: [lttng-dev] Lttng start failed >>>> >>>> * Pavan Anumula (pavan.anumula at sasken.com) wrote: >>>>> Hi Mathue, >>>>> >>>>> Thanks for the quick reply, >>>>> >>>>> After inserting lttng modules , I had given the command >>>>> "arm-none-linux-gnueabi-lttng-sessiond -vvv" as you said, Below >>>>> is the output where there are error messages. Please help me in >>>>> resolving the issue, SO that I can catch kernel and user traces. >>>>> >>>>> >>>>> root at arago:/usr/lttng/modules# >>>>> arm-none-linux-gnueabi-lttng-sessiond -d >>>>> root at arago:/usr/lttng/modules# >>>>> arm-none-linux-gnueabi-lttng-sessiond -vvv DEBUG3: Creating LTTng >>>>> run directory: /var/run/lttng [in create_lttng_rundir() at >>>>> main.c:4315] DEBUG2: Kernel consumer err path: >>>>> /var/run/lttng/kconsumerd/error [in main() at main.c:4543] DEBUG2: >>>>> Kernel consumer cmd path: /var/run/lttng/kconsumerd/command [in >>>>> main() at main.c:4545] DEBUG1: Client socket path >>>>> /var/run/lttng/client-lttng-sessiond [in main() at main.c:4592] >>>>> DEBUG1: Application socket path /var/run/lttng/apps-lttng-sessiond >>>>> [in main() at main.c:4593] DEBUG1: LTTng run directory path: >>>>> /var/run/lttng [in main() at main.c:4594] DEBUG2: UST consumer 32 >>>>> bits err path: /var/run/lttng/ustconsumerd32/error [in main() at >>>>> main.c:4603] DEBUG2: UST consumer 32 bits cmd path: >>>>> /var/run/lttng/ustconsumerd32/command [in main() at main.c:4605] >>>>> DEBUG2: UST consumer 64 bits err path: >>>>> /var/run/lttng/ustconsumerd64/error [in main() at main.c:4614] >>>>> DEBUG2: UST consumer 64 bits cmd path: >>>>> /var/run/lttng/ustconsumerd64/command [in main() at main.c:4616] >>>>> Error: Already running daemon. >>>> >>>> Please kill the lttng-sessiond that is already started (the one >>>> with -d). Instead of that one, run the sessiond with: >>>> >>>> lttng-sessiond -vvv >>>> >>>> (don't run lttng-sessiond -d before) >>>> >>>> Thanks, >>>> >>>> Mathieu >>>> >>>>> >>>>> >>>>> >>>>> >>>>> Thanks in advance, Pavan >>>>> >>>>> -----Original Message----- From: Mathieu Desnoyers >>>>> [mailto:mathieu.desnoyers at efficios.com] Sent: Friday, June 08, >>>>> 2012 11:12 PM To: Pavan Anumula Cc: lttng-dev at lists.lttng.org >>>>> Subject: Re: [lttng-dev] Lttng start failed >>>>> >>>>> * Pavan Anumula (pavan.anumula at sasken.com) wrote: >>>>>> Hi , >>>>>> >>>>>> I am new to LTTng usage, I am trying to use LTTng 2.0.1 and >>>>>> LTTng-modules-2.0.2 for ARM(omapL138), with Linux kernel 2.6.33 >>>>>> wit RT-29 patch on it. >>>>>> >>>>>> After enabling all the kernel events I am facing the below >>>>>> errors. I loaded all the modules manually by insmod. >>>>>> >>>>>> >>>>>> >>>>>> root at arago:~/lttng-traces# arm-none-linux-gnueabi-lttng create >>>>>> newsessiom Session newsessiom created. Traces will be written in >>>>>> /home/root/lttng-traces/newsessiom-20110325-154922 >>>>>> >>>>>> root at arago:~/lttng-traces# arm-none-linux-gnueabi-lttng >>>>>> enable-event -a --kernel All kernel events are enabled in channel >>>>>> channel0 >>>>>> >>>>>> root at arago:~/lttng-traces# arm-none-linux-gnueabi-lttng start >>>>>> LTTng: Failure to write metadata to buffers (timeout) Error: >>>>>> Starting kernel trace failed >>>>>> >>>>>> Please kindly help me on this. >>>>> >>>>> I think you should look into the lttng-sessiond --help : >>>>> >>>>> --consumerd32-path PATH Specify path for the 32-bit UST >>>>> consumer daemon binary --consumerd32-libdir PATH Specify path for >>>>> the 32-bit UST consumer daemon libraries --consumerd64-path PATH >>>>> Specify path for the 64-bit UST consumer daemon binary >>>>> --consumerd64-libdir PATH Specify path for the 64-bit UST >>>>> consumer daemon libraries >>>>> >>>>> options. My guess is that lttng-sessiond is not able to find the >>>>> consumerd binary files, maybe due to a rename or because they have >>>>> been moved after install. >>>>> >>>>> One more thing that might help is to launch the lttng-sessiond >>>>> with "-vvv" : it will provide verbose output and let us know where >>>>> things fall apart. >>>>> >>>>> Thanks, >>>>> >>>>> Mathieu >>>>> >>>>> >>>>>> >>>>>> >>>>>> Thanks in advance, Pavan >>>>>> >>>>>> ________________________________ SASKEN BUSINESS DISCLAIMER: >>>>>> This message may contain confidential, proprietary or legally >>>>>> privileged information. In case you are not the original intended >>>>>> Recipient of the message, you must not, directly or indirectly, >>>>>> use, disclose, distribute, print, or copy any part of this >>>>>> message and you are requested to delete it and inform the sender. >>>>>> Any views expressed in this message are those of the individual >>>>>> sender unless otherwise stated. Nothing contained in this message >>>>>> shall be construed as an offer or acceptance of any offer by >>>>>> Sasken Communication Technologies Limited ("Sasken") unless sent >>>>>> with that express intent and with due authority of Sasken. Sasken >>>>>> has taken enough precautions to prevent the spread of viruses. >>>>>> However the company accepts no liability for any damage caused by >>>>>> any virus transmitted by this email. Read Disclaimer at >>>>>> http://www.sasken.com/extras/mail_disclaimer.html >>>>> >>>>>> _______________________________________________ lttng-dev mailing >>>>>> list lttng-dev at lists.lttng.org >>>>>> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev >>>>> >>>>> >>>>> -- Mathieu Desnoyers Operating System Efficiency R&D Consultant >>>>> EfficiOS Inc. http://www.efficios.com >>>> >>>> -- Mathieu Desnoyers Operating System Efficiency R&D Consultant >>>> EfficiOS Inc. http://www.efficios.com >>> >>> -- Mathieu Desnoyers Operating System Efficiency R&D Consultant >>> EfficiOS Inc. http://www.efficios.com > > > _______________________________________________ lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAEBAgAGBQJP201YAAoJEELoaioR9I02a7AH/3sTHsbxRJ3z+//6+wPQu7GC 6KIZxfBhhq4WSSZRJGHvD9O6QCHPgUmrYjR4leONB9//FfoWdzzRZb0IDErpJ3+L B8I49nd7X2UHp1jf7CpbJUzrs1AQZa3K32D/nRlF3LceOGnvIpkKstur5msXvN5B msGap8UQ8NsxkyCRW8cmPNt/Qm7lMsrg9zeP5VGEncj7dywIqaPfjz7MGFwNp4Vz uxxBusAjnI50Kmx+ETYZmTiqEIPCV9rnpVK4T2LtZgX/+rh06gDkkvW6xy0wO7pf ymZ0MytfvuKaHXmQnXyGvWhrodmn+D9E32DwyrcuhZa6K0ZPE5eDRbxUT5WGbuQ= =VYvD -----END PGP SIGNATURE----- From mathieu.desnoyers at efficios.com Mon Jul 2 10:48:46 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 2 Jul 2012 10:48:46 -0400 Subject: [lttng-dev] Adding New Tracepoints In-Reply-To: <47D610AD9C485E458630BA38C324D3B60113FB9D4D97@EXGMBX01.sasken.com> References: <47D610AD9C485E458630BA38C324D3B60113FB9D4D97@EXGMBX01.sasken.com> Message-ID: <20120702144846.GA13162@Krystal> * Pavan Anumula (pavan.anumula at sasken.com) wrote: > Hi ALL, > > I am newbie to Tracing mechanism and LTTng usage ,I want to calculate the overhead of LTTng (without using caliberate command), For that I added some trace points to function "timer_interrupt() " inside kernel "arch/arm/mach-davinci/time.c", So that I can calculate time differences by enabling and disabling them. > > I followed the Kernel documentation of tracepoints and also declared the tracpoints and defined and registered probefunctions for those trace points. > > But I can't see my new trace points when I give the command "arm-none-linux-gnueabi-lttng list -k". Can we add our own new trace points so that it will call probe function which I define?? If so please let me know the procedure in order to use them for LTTng overhead measurement. > > Also let me know the procedure for enabling and disabling newly added tracepoints in LTTng. you'll first need to add a copy of your tracepoint event file into lttng-modules instrumentation/ directory (see README file, and diff existing mainline vs lttng-modules files to figure out the modifications needed). you'll have to add new probes into lttng-modules probes/ directory. Load those new modules. Then start lttng-sessiond. The list -k command should show the new tracepoints. Use enable-event -k tracepoint_name to enable it. Thanks, Mathieu > > > I am using. > Lttng modules 2.0.2 > Lttng tools:2.0.1 > Kernel:2.6.33.7 with RT-29 patch. > > Thanks In Advance, > Pavan > > -----Original Message----- > From: Pavan Anumula > Sent: Thursday, June 21, 2012 8:54 PM > To: 'David Goulet' > Cc: lttng-dev at lists.lttng.org; Mathieu Desnoyers (mathieu.desnoyers at efficios.com) > Subject: RE: [lttng-dev] Empty traces for UST > > Hi David, > > We tried to debug lttng commands with gdbserver on the arm target from host gdb remote target session following were obersevations: > 1. create Session > gdbserver --remote-debug localhost:5560 arm-none-linux-gnueabi-lttng -vvv create sesAA > >>passed with out and errors > > 2. Enable events for session > gdbserver --remote-debug localhost:5560 arm-none-linux-gnueabi-lttng -vvv enable-event -u -a > >> failed randomly with segment faults and memeory allocation error see > >> below trace error > > >>> (gdb) n > >>>312 goto error; > >>> (gdb) n > >>>318 handle = lttng_create_handle(session_name, &dom); > >>> (gdb) s > >>>lttng_create_handle (session_name=0x40015154 "", domain=0xbe810bbc) at lttng-ctl.c:395 > >>>395 perror("malloc handle"); > > > Some times it used to print: > >>>/lib/ld-linux.so.3: No such file or directory > Or > Segment faults > > Here is the /proc/meminfo of device: > root at arago:~# cat /proc/meminfo > MemTotal: 28220 kB > MemFree: 12704 kB > Buffers: 0 kB > Cached: 7520 kB > SwapCached: 0 kB > Active: 4804 kB > Inactive: 4984 kB > Active(anon): 2296 kB > Inactive(anon): 84 kB > Active(file): 2508 kB > Inactive(file): 4900 kB > Unevictable: 0 kB > Mlocked: 0 kB > SwapTotal: 0 kB > SwapFree: 0 kB > Dirty: 0 kB > Writeback: 0 kB > AnonPages: 2296 kB > Mapped: 2000 kB > Shmem: 112 kB > Slab: 3188 kB > SReclaimable: 808 kB > SUnreclaim: 2380 kB > KernelStack: 576 kB > PageTables: 288 kB > NFS_Unstable: 0 kB > Bounce: 0 kB > WritebackTmp: 0 kB > CommitLimit: 14108 kB > Committed_AS: 47704 kB > VmallocTotal: 985088 kB > VmallocUsed: 400 kB > VmallocChunk: 984612 kB > > Please suggest how to overcome this issue. > > Regards, > Pavan > > -----Original Message----- > From: David Goulet [mailto:dgoulet at efficios.com] > Sent: Friday, June 15, 2012 8:28 PM > To: Pavan Anumula > Cc: lttng-dev at lists.lttng.org > Subject: Re: [lttng-dev] Empty traces for UST > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi Pavan, > > Glad for the kernel! :) > > For UST, I'll recommend you start a session daemon like so "lttng-sessiond > - -vvv". After that, use the lttng-ust/tests/hello program and execute it. You should see on the debug output of the session daemon that the application "hello" has registered and is ready for tracing. > > Your output below does NOT show those debug messages so it would be a good start to see if there is a problem at that point. Also, make sure that the liblttng-ust is installed upon compiling lttng-tools so that the user space tracer support is enabled in the tools. > > Thanks! > David > > On 15/06/12 10:50 AM, Pavan Anumula wrote: > > Hi David, > > > > Finally I was able to get kernel traces by referring to one of your > > other posts , Actually lttng-consumerd binary was actually not > > present at the needed path, Thanks for your help. > > > > And sorry for bugging you with mails :) . > > > > > > But this time I am facing issues at UST tracing . Please kindly help > > me on this. > > > > When I try to trace for User space it is creating an empty folder with > > no traces on ARM target, I tried with all the sample trace programs in > > LTTng-UST/tests folder. > > > > I am using NFS to load binaries and for tracing will that causes problem. > > Please also find the debug logs attached, > > > > Please also let me know if you want some more information. > > > > > > ************************************** fcntl64(12, F_SETFD, FD_CLOEXEC) > > = 0 fcntl64(13, F_SETFD, FD_CLOEXEC) = 0 pipe([14, 15]) > > = 0 fcntl64(14, F_SETFD, FD_CLOEXEC) = 0 fcntl64(15, F_SETFD, > > FD_CLOEXEC) = 0 getrlimit(RLIMIT_NOFILE, {rlim_cur=65535, > > rlim_max=65535}) = 0 write(2, "DEBUG1: poll set max size set to"..., > > 92DEBUG1: poll set max size set to 65535 [in > > compat_poll_set_max_size() at compat-poll.c:196] ) = 92 mmap2(NULL, > > 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4024b000 mprotect(0x4024b000, 4096, > > PROT_NONE) = 0 clone(child_stack=0x40a49ef8, > > flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_S > > YSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, > > parent_tidptr=0x40a4a3e8, tls=0x40a4a840, child_tidptr=0x40a4a3e8) = > > 921 mmap2(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, > > 0) = 0x40a4b000 mprotect(0x40a4b000, 4096, PROT_NONE) = 0 > > clone(child_stack=0x41249ef8, > > flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_S > > YSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, > > parent_tidptr=0x4124a3e8, tls=0x4124a840, child_tidptr=0x4124a3e8) = > > 922 mmap2(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, > > 0) = 0x4124b000 mprotect(0x4124b000, 4096, PROT_NONE) = 0 > > clone(child_stack=0x41a49ef8, > > flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_S > > YSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, > > parent_tidptr=0x41a4a3e8, tls=0x41a4a840, child_tidptr=0x41a4a3e8) = > > 923 mmap2(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, > > 0) = 0x41a4b000 mprotect(0x41a4b000, 4096, PROT_NONE) = 0 clone(DEBUG1: > > [thread] Dispatch UST command started [in > > thread_dispatch_ust_registration() at main.c:1324] DEBUG1: Futex n to > > 1 prepare done [in futex_nto1_prepare() at futex.c:73] DEBUG1: Woken > > up but nothing in the UST command queue [in > > thread_dispatch_ust_registration() at main.c:1334] DEBUG1: [thread] > > Manage application registration started [in > > thread_registration_apps() at main.c:1392] DEBUG1: fd 3 of 1 added to > > pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: fd 11 of 2 > > added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: > > Notifying applications of session daemon state: 1 [in > > notify_ust_apps() at main.c:687] DEBUG1: Got the wait shm fd 16 [in > > get_wait_shm() at shm.c:117] DEBUG1: Futex wait update active 1 [in > > futex_wait_update() at futex.c:62] DEBUG1: Accepting application > > registration [in > > thread_registration_apps() at main.c:1423] DEBUG1: [thread] Manage > > application started [in thread_manage_apps() at main.c:1179] DEBUG1: > > fd 3 of 1 added to pollfd [in compat_poll_add() at compat-poll.c:91] > > DEBUG1: fd > > 14 of 2 added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: > > Apps thread polling on 2 fds [in thread_manage_apps() at main.c:1200] > > DEBUG1: [thread] Manage client started [in thread_manage_clients() at > > main.c:3794] DEBUG1: fd 3 of 1 added to pollfd [in compat_poll_add() > > at compat-poll.c:91] DEBUG1: fd 10 of 2 added to pollfd [in > > compat_poll_add() at compat-poll.c:91] DEBUG1: Accepting client > > command ... [in > > thread_manage_clients() at main.c:3826] child_stack=0x42249ef8, > > flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_S > > YSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, > > parent_tidptr=0x4224a3e8, tls=0x4224a840, child_tidptr=0x4224a3e8) = > > 924 mmap2(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, > > 0) = 0x4224b000 mprotect(0x4224b000, 4096, PROT_NONE) = 0 > > clone(child_stack=0x42a49ef8, > > flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_S > > YSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, > > parent_tidptr=0x42a4a3e8, tls=0x42a4a840, child_tidptr=0x42a4a3e8) = > > 925 futex(0x42a4a3e8, FUTEX_WAIT, 925, NULLDEBUG1: Thread manage > > kernel started [in thread_manage_kernel() at main.c:876] DEBUG1: fd 3 > > of 1 added to pollfd [in compat_poll_add() at compat-poll.c:91] > > DEBUG1: fd 12 of 2 added to pollfd [in compat_poll_add() at > > compat-poll.c:91] DEBUG1: Updating kernel poll set [in > > update_kernel_poll() at main.c:748] DEBUG1: Thread kernel polling on 2 > > fds [in thread_manage_kernel() at main.c:905] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: > > Receiving data from client ... [in thread_manage_clients() at > > main.c:3898] > > DEBUG1: Nothing recv() from client... continuing [in > > thread_manage_clients() at main.c:3902] DEBUG1: Clean command context > > structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting > > client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: > > Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: > > Receiving data from client ... [in thread_manage_clients() at > > main.c:3898] > > DEBUG1: Processing client command 8 [in process_client_msg() at > > main.c:3309] DEBUG2: Trying to find session by name sesCCC [in > > session_find_by_name() at session.c:126] DEBUG3: mkdir() recursive > > /home/root/lttng-traces/sesCCC-20110327-045731 with mode 504 for uid 0 > > and gid 0 [in run_as_mkdir_recursive() at runas.c:338] DEBUG1: Using > > run_as_clone [in run_as() at runas.c:322] DEBUG1: Tracing session > > sesCCC created in /home/root/lttng-traces/sesCCC-20110327-045731 with > > ID 1 by UID > > 0 GID 0 [in session_create() at session.c:234] DEBUG1: Sending > > response > > (size: 16, retcode: Success) [in thread_manage_clients() at > > main.c:3936] > > DEBUG1: Clean command context structure [in clean_command_ctx() at > > main.c:534] DEBUG1: Accepting client command ... [in > > thread_manage_clients() at main.c:3826] DEBUG1: Wait for client > > response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving > > data from client ... [in thread_manage_clients() at main.c:3898] > > DEBUG1: Nothing > > recv() from client... continuing [in thread_manage_clients() at > > main.c:3902] DEBUG1: Clean command context structure [in > > clean_command_ctx() at main.c:534] DEBUG1: Accepting client command > > ... [in > > thread_manage_clients() at main.c:3826] DEBUG1: Wait for client > > response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving > > data from client ... [in thread_manage_clients() at main.c:3898] > > DEBUG1: Processing client command 6 [in process_client_msg() at > > main.c:3309] DEBUG1: Getting session sesCCC by name [in process_client_msg() at main.c:3364] DEBUG2: > > Trying to find session by name sesCCC [in session_find_by_name() at > > session.c:126] DEBUG1: Creating UST session [in create_ust_session() > > at main.c:1965] DEBUG3: Created hashtable size 4 at 0x4fa08 of type 1 > > [in > > lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at > > 0x4fb28 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: > > Created hashtable size 4 at 0x4fc48 of type 0 [in lttng_ht_new() at > > hashtable.c:96] DEBUG2: UST trace session create successful [in > > trace_ust_create_session() at trace-ust.c:119] DEBUG3: mkdir() > > recursive /home/root/lttng-traces/sesCCC-20110327-045731/ust with mode > > 504 for uid 0 and gid 0 [in run_as_mkdir_recursive() at runas.c:338] > > DEBUG1: Using run_as_clone [in run_as() at runas.c:322] DEBUG1: > > Spawning consumerd [in > > spawn_consumerd() at main.c:1659] DEBUG1: Using 32-bit UST consumer at: > > /root/armfilesystem/lib/lttng/libexec/lttng-consumerd [in > > spawn_consumerd() at main.c:1777] DEBUG2: Consumer pid 934 [in > > start_consumerd() at main.c:1830] DEBUG2: Spawning consumer control > > thread [in start_consumerd() at main.c:1833] DEBUG1: [thread] Manage > > consumer started [in > > thread_manage_consumer() at main.c:982] DEBUG1: fd 3 of 1 added to > > pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: fd 9 of 2 > > added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG2: > > Receiving code from consumer err_sock [in thread_manage_consumer() at main.c:1043] DEBUG1: > > consumer command socket ready [in thread_manage_consumer() at > > main.c:1062] > > DEBUG1: fd 17 of 2 added to pollfd [in compat_poll_add() at > > compat-poll.c:91] DEBUG2: Trace UST channel channel0 not found by name > > [in > > trace_ust_find_channel_by_name() at trace-ust.c:52] DEBUG3: Created > > hashtable size 4 at 0x51310 of type 0 [in lttng_ht_new() at > > hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x51430 of type 1 > > [in > > lttng_ht_new() at hashtable.c:96] DEBUG2: Trace UST channel channel0 > > created [in trace_ust_create_channel() at trace-ust.c:181] DEBUG2: > > Channel > > channel0 being created in UST global domain [in channel_ust_create() > > at channel.c:267] DEBUG2: UST app adding channel channel0 to global > > domain for session id 1 [in ust_app_create_channel_glb() at ust-app.c:1792] DEBUG2: > > Channel channel0 created successfully [in channel_ust_create() at > > channel.c:292] DEBUG2: Trace UST channel channel0 found by name [in > > trace_ust_find_channel_by_name() at trace-ust.c:47] DEBUG2: Trace UST > > event NOT found by name * [in trace_ust_find_event_by_name() at > > trace-ust.c:79] > > DEBUG3: Created hashtable size 4 at 0x51550 of type 1 [in > > lttng_ht_new() at hashtable.c:96] DEBUG2: Trace UST event *, loglevel > > (0,-1) created [in > > trace_ust_create_event() at trace-ust.c:260] DEBUG1: UST app creating > > event > > * for all apps for session id 1 [in ust_app_create_event_glb() at > > ust-app.c:1916] DEBUG1: Event UST * created in channel channel0 [in > > event_ust_enable_tracepoint() at event.c:446] DEBUG1: Sending response > > (size: 16, retcode: Success) [in thread_manage_clients() at > > main.c:3936] > > DEBUG1: Clean command context structure [in clean_command_ctx() at > > main.c:534] DEBUG1: Accepting client command ... [in > > thread_manage_clients() at main.c:3826] DEBUG1: Wait for client > > response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving > > data from client ... [in thread_manage_clients() at main.c:3898] > > DEBUG1: Nothing > > recv() from client... continuing [in thread_manage_clients() at > > main.c:3902] DEBUG1: Clean command context structure [in > > clean_command_ctx() at main.c:534] DEBUG1: Accepting client command > > ... [in > > thread_manage_clients() at main.c:3826] DEBUG1: Wait for client > > response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving > > data from client ... [in thread_manage_clients() at main.c:3898] > > DEBUG1: Processing client command 16 [in process_client_msg() at > > main.c:3309] DEBUG1: Getting session sesCCC by name [in process_client_msg() at main.c:3364] DEBUG2: > > Trying to find session by name sesCCC [in session_find_by_name() at > > session.c:126] DEBUG1: Starting all UST traces [in > > ust_app_start_trace_all() at ust-app.c:2207] DEBUG1: Sending response > > (size: 16, retcode: Success) [in thread_manage_clients() at > > main.c:3936] > > DEBUG1: Clean command context structure [in clean_command_ctx() at > > main.c:534] DEBUG1: Accepting client command ... [in > > thread_manage_clients() at main.c:3826] > > ************************************************ > > > > > > > > > > > > Thanks in Advance, Pavan > > > > > > -----Original Message----- From: David Goulet > > [mailto:dgoulet at efficios.com] Sent: Tuesday, June 12, 2012 9:05 PM To: > > Pavan Anumula Cc: lttng-dev at lists.lttng.org Subject: Re: [lttng-dev] > > Lttng start failed > > > > Hi Pavan, > > > > The output below is normal and should be working fine. However, the > > problem is that you have _NO_ debug message after the "lttng start". > > That command should at least produce 10+ lines of messages after this last line: > > > > "DEBUG1: Accepting application registration [in > > thread_registration_apps() at main.c:1423]" > > > > Can you enlight me and tell me if by doing "lttng create newsessiom" > > and "lttng enable-event -a -k", you have output messages coming out of > > the session daemon in -vvv mode ? > > > > If NOT, you are talking to another daemon! A quick "ps faux | grep > > lttng-sessiond" could help clear that question. > > > > If only one daemon is running and stuck at the above debug message, > > the next step is to tell me on what the daemon is waiting on using > > either "strace -p" or "gdb" also. There is 6 threads so having the > > strace -p output for all of them would help me greatly. > > > > Thanks! David > > > > On 12/06/12 10:05 AM, Mathieu Desnoyers wrote: > >> * Pavan Anumula (pavan.anumula at sasken.com) wrote: > >>> Hi Mathieu, Still I am unable to start tracing, And I am facing the > >>> same start errors. Please kindly help me on this. This time I > >>> loaded the modules by modprobe( not with insmod as I did before), > >>> Then I run the command " arm-none-linux-gnueabi-lttng-sessiond > >>> -vvv " (before arm-none-linux-gnueabi-lttng-sessiond -d), > > > >> When using "arm-none-linux-gnueabi-lttng-sessiond -vvv", you should > >> _not_ run "arm-none-linux-gnueabi-lttng-sessiond -d". > > > > > >>> The below is the Output, And It got hanged overthere. > > > >> This is normal: the sessiond is waiting for applications to connect. > >> It does not hang, it just waits. > > > >> David, can you follow up on this issue ? It seems to be > >> sessiond-related. > > > >> Thanks, > > > >> Mathieu > > > > > >>> Later when I started lttng start I am acing the same erros below: > >>> root at arago:~/lttng-traces# arm-none-linux-gnueabi-lttng start LTTng: > >>> Failure to write metadata to buffers (timeout) Error: Starting > >>> kernel trace failed > >>> > >>> ******************************************************************** > >>> * > >>> *************************** > >>> > >>> > > DEBUG3: Creating LTTng run directory: /var/run/lttng [in > > create_lttng_rundir() at main.c:4315] > >>> DEBUG2: Kernel consumer err path: /var/run/lttng/kconsumerd/error > >>> [in > >>> main() at main.c:4543] DEBUG2: Kernel consumer cmd path: > >>> /var/run/lttng/kconsumerd/command [in main() at main.c:4545] DEBUG1: > >>> Client socket path /var/run/lttng/client-lttng-sessiond [in main() > >>> at main.c:4592] DEBUG1: Application socket path > >>> /var/run/lttng/apps-lttng-sessiond [in main() at main.c:4593] DEBUG1: > >>> LTTng run directory path: /var/run/lttng [in main() at main.c:4594] > >>> DEBUG2: UST consumer 32 bits err path: > >>> /var/run/lttng/ustconsumerd32/error [in main() at main.c:4603] DEBUG2: > >>> UST consumer 32 bits cmd path: /var/run/lttng/ustconsumerd32/command > >>> [in main() at main.c:4605] DEBUG2: UST consumer 64 bits err path: > >>> /var/run/lttng/ustconsumerd64/error [in main() at main.c:4614] DEBUG2: > >>> UST consumer 64 bits cmd path: /var/run/lttng/ustconsumerd64/command > >>> [in main() at main.c:4616] DEBUG3: Created hashtable size 4 at > >>> 0x4a080 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: > >>> Created hashtable size 4 at 0x4a168 of type 1 [in lttng_ht_new() at > >>> hashtable.c:96] DEBUG2: Creating consumer directory: > >>> /var/run/lttng/kconsumerd [in set_consumer_sockets() at main.c:4357] > >>> DEBUG1: Modprobe successfully lttng-tracer [in > >>> modprobe_lttng_control() at modprobe.c:163] DEBUG2: Kernel tracer > >>> version validated (major version 2) [in kernel_validate_version() at kernel.c:675] DEBUG1: > >>> Modprobe successfully lttng-ftrace [in modprobe_lttng_data() at > >>> modprobe.c:199] DEBUG1: Modprobe successfully lttng-kprobes [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-kretprobes [in modprobe_lttng_data() at modprobe.c:199] DEBUG1: > >>> Modprobe successfully lttng-lib-ring-buffer [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-ring-buffer-client-discard [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-ring-buffer-client-overwrite [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-ring-buffer-metadata-client [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-ring-buffer-client-mmap-discard [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-ring-buffer-client-mmap-overwrite [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-ring-buffer-metadata-mmap-client [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-probe-lttng [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-types [in modprobe_lttng_data() at modprobe.c:199] DEBUG1: > >>> Modprobe successfully lttng-probe-block [in modprobe_lttng_data() at > >>> modprobe.c:199] DEBUG1: Modprobe successfully lttng-probe-irq [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-probe-kvm [in modprobe_lttng_data() at modprobe.c:199] DEBUG1: > >>> Modprobe successfully lttng-probe-sched [in modprobe_lttng_data() at > >>> modprobe.c:199] DEBUG1: Modprobe successfully lttng-probe-signal [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-probe-statedump [in modprobe_lttng_data() at > >>> modprobe.c:199] > >>> DEBUG1: Modprobe successfully lttng-probe-timer [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Kernel tracer fd 6 > >>> [in > >>> init_kernel_tracer() at main.c:1887] DEBUG2: Creating consumer > >>> directory: /var/run/lttng/ustconsumerd64 [in set_consumer_sockets() > >>> at main.c:4357] DEBUG2: Creating consumer directory: > >>> /var/run/lttng/ustconsumerd32 [in set_consumer_sockets() at > >>> main.c:4357] DEBUG1: Signal handler set for SIGTERM, SIGPIPE and > >>> SIGINT [in set_signal_handler() at main.c:4449] DEBUG1: All > >>> permissions are set [in set_permissions() at main.c:4250] DEBUG1: > >>> poll set max size set to 65535 [in compat_poll_set_max_size() at compat-poll.c:196] DEBUG1: > >>> [thread] Manage application started [in thread_manage_apps() at > >>> main.c:1179] DEBUG1: fd 3 of 1 added to pollfd [in compat_poll_add() > >>> at compat-poll.c:91] DEBUG1: fd 13 of 2 added to pollfd [in > >>> compat_poll_add() at compat-poll.c:91] DEBUG1: Apps thread polling > >>> on 2 fds [in thread_manage_apps() at main.c:1200] DEBUG1: Thread > >>> manage kernel started [in thread_manage_kernel() at main.c:876] > >>> DEBUG1: fd 3 of 1 added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: > >>> fd 11 of 2 added to pollfd [in compat_poll_add() at > >>> compat-poll.c:91] > >>> DEBUG1: Updating kernel poll set [in update_kernel_poll() at > >>> main.c:748] DEBUG1: Thread kernel polling on 2 fds [in > >>> thread_manage_kernel() at main.c:905] DEBUG1: [thread] Manage > >>> application registration started [in thread_registration_apps() at > >>> main.c:1392] DEBUG1: fd 3 of 1 added to pollfd [in compat_poll_add() > >>> at compat-poll.c:91] DEBUG1: fd 10 of 2 added to pollfd [in > >>> compat_poll_add() at compat-poll.c:91] DEBUG1: Notifying > >>> applications of session daemon state: 1 [in notify_ust_apps() at > >>> main.c:687] > >>> DEBUG1: [thread] Dispatch UST command started [in > >>> thread_dispatch_ust_registration() at main.c:1324] DEBUG1: Futex n > >>> to 1 prepare done [in futex_nto1_prepare() at futex.c:73] DEBUG1: > >>> Woken up but nothing in the UST command queue [in > >>> thread_dispatch_ust_registration() at main.c:1334] DEBUG1: [thread] > >>> Manage client started [in thread_manage_clients() at main.c:3794] > >>> DEBUG1: fd 3 of 1 added to pollfd [in compat_poll_add() at > >>> compat-poll.c:91] DEBUG1: fd 9 of 2 added to pollfd [in > >>> compat_poll_add() at compat-poll.c:91] DEBUG1: Accepting client > >>> command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Got > >>> the wait shm fd 15 [in get_wait_shm() at shm.c:117] DEBUG1: Futex > >>> wait update active 1 [in futex_wait_update() at futex.c:62] DEBUG1: > >>> Accepting application registration [in thread_registration_apps() at > >>> main.c:1423] > >>> ******************************************************************** > >>> * > >>> *********************************** > >>> > >>> > > Am I missing anything?? > >>> > >>> Thanks in Advance, Pavan > >>> > >>> > >>> ________________________________________ From: Mathieu Desnoyers > >>> [mathieu.desnoyers at efficios.com] Sent: Monday, June 11, 2012 7:24 PM > >>> To: Pavan Anumula Cc: lttng-dev at lists.lttng.org Subject: Re: > >>> [lttng-dev] Lttng start failed > >>> > >>> * Pavan Anumula (pavan.anumula at sasken.com) wrote: > >>>> Hi Mathieu, > >>>> > >>>> Please find the info below as per your comments > >>>> > >>>> > >>>> ########## Output of command > >>>> "arm-none-linux-gnueabi-lttng-sessiond > >>>> -vvv " , After loading the modules ####### > >>>> > >>>> DEBUG3: Creating LTTng run directory: /var/run/lttng [in > >>>> create_lttng_rundir() at main.c:4315] DEBUG2: Kernel consumer err > >>>> path: /var/run/lttng/kconsumerd/error [in main() at main.c:4543] > >>>> DEBUG2: Kernel consumer cmd path: /var/run/lttng/kconsumerd/command > >>>> [in main() at main.c:4545] DEBUG1: Client socket path > >>>> /var/run/lttng/client-lttng-sessiond [in main() at main.c:4592] > >>>> DEBUG1: Application socket path /var/run/lttng/apps-lttng-sessiond > >>>> [in main() at main.c:4593] DEBUG1: LTTng run directory path: > >>>> /var/run/lttng [in main() at main.c:4594] DEBUG2: UST consumer 32 > >>>> bits err path: /var/run/lttng/ustconsumerd32/error [in main() at > >>>> main.c:4603] DEBUG2: UST consumer 32 bits cmd path: > >>>> /var/run/lttng/ustconsumerd32/command [in main() at main.c:4605] > >>>> DEBUG2: UST consumer 64 bits err path: > >>>> /var/run/lttng/ustconsumerd64/error [in main() at main.c:4614] > >>>> DEBUG2: UST consumer 64 bits cmd path: > >>>> /var/run/lttng/ustconsumerd64/command [in main() at main.c:4616] > >>>> DEBUG3: Created hashtable size 4 at 0x4a080 of type 1 [in > >>>> lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 > >>>> at > >>>> 0x4a168 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG2: > >>>> Creating consumer directory: /var/run/lttng/kconsumerd [in > >>>> set_consumer_sockets() at main.c:4357] FATAL: Module lttng_tracer > >>>> not found. Error: Unable to load module lttng-tracer > >>> > >>> Hrm. You want to do kernel tracing, but modprobe cannot find the > >>> lttng kernel tracer modules. You might want to run depmod -a or > >>> something like that on your target, and ensure that modprobe works properly. > >>> > >>> Thanks, > >>> > >>> Mathieu > >>> > >>>> DEBUG2: Kernel tracer version validated (major version 2) [in > >>>> kernel_validate_version() at kernel.c:675] DEBUG1: Modprobe > >>>> successfully lttng-ftrace [in modprobe_lttng_data() at > >>>> modprobe.c:199] DEBUG1: Modprobe successfully lttng-kprobes [in > >>>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>>> successfully lttng-kretprobes [in modprobe_lttng_data() at > >>>> modprobe.c:199] FATAL: Module lttng_lib_ring_buffer not found. Error: > >>>> Unable to load module lttng-lib-ring-buffer FATAL: Module > >>>> lttng_ring_buffer_client_discard not found. Error: Unable to load > >>>> module lttng-ring-buffer-client-discard FATAL: Module > >>>> lttng_ring_buffer_client_overwrite not found. Error: Unable to load > >>>> module lttng-ring-buffer-client-overwrite FATAL: Module > >>>> lttng_ring_buffer_metadata_client not found. Error: Unable to load > >>>> module lttng-ring-buffer-metadata-client FATAL: Module > >>>> lttng_ring_buffer_client_mmap_discard not found. Error: Unable to > >>>> load module lttng-ring-buffer-client-mmap-discard FATAL: Module > >>>> lttng_ring_buffer_client_mmap_overwrite not found. Error: Unable to > >>>> load module lttng-ring-buffer-client-mmap-overwrite FATAL: Module > >>>> lttng_ring_buffer_metadata_mmap_client not found. Error: Unable to > >>>> load module lttng-ring-buffer-metadata-mmap-client FATAL: Module > >>>> lttng_probe_lttng not found. Error: Unable to load module > >>>> lttng-probe-lttng DEBUG1: Modprobe successfully lttng-types [in > >>>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>>> successfully lttng-probe-block [in modprobe_lttng_data() at > >>>> modprobe.c:199] DEBUG1: Modprobe successfully lttng-probe-irq [in > >>>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>>> successfully lttng-probe-kvm [in modprobe_lttng_data() at > >>>> modprobe.c:199] DEBUG1: Modprobe successfully lttng-probe-sched [in > >>>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>>> successfully lttng-probe-signal [in modprobe_lttng_data() at > >>>> modprobe.c:199] DEBUG1: Modprobe successfully lttng-probe-statedump > >>>> [in modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>>> successfully lttng-probe-timer [in modprobe_lttng_data() at > >>>> modprobe.c:199] DEBUG1: Kernel tracer fd 6 [in init_kernel_tracer() > >>>> at main.c:1887] DEBUG2: Creating consumer directory: > >>>> /var/run/lttng/ustconsumerd64 [in set_consumer_sockets() at > >>>> main.c:4357] DEBUG2: Creating consumer directory: > >>>> /var/run/lttng/ustconsumerd32 [in set_consumer_sockets() at > >>>> main.c:4357] DEBUG1: Signal handler set for SIGTERM, SIGPIPE and > >>>> SIGINT [in set_signal_handler() at main.c:4449] DEBUG1: All > >>>> permissions are set [in set_permissions() at main.c:4250] DEBUG1: > >>>> poll set max size set to 65535 [in compat_poll_set_max_size() at > >>>> compat-poll.c:196] DEBUG1: [thread] Manage client started [in > >>>> thread_manage_clients() at main.c:3794] DEBUG1: fd 3 of 1 added to > >>>> pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: fd 9 of 2 > >>>> added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: > >>>> Accepting client command ... [in thread_manage_clients() at > >>>> main.c:3826] DEBUG1: [thread] Dispatch UST command started [in > >>>> thread_dispatch_ust_registration() at main.c:1324] DEBUG1: Futex n > >>>> to > >>>> 1 prepare done [in futex_nto1_prepare() at futex.c:73] DEBUG1: > >>>> Woken up but nothing in the UST command queue [in > >>>> thread_dispatch_ust_registration() at main.c:1334] DEBUG1: Thread > >>>> manage kernel started [in thread_manage_kernel() at main.c:876] > >>>> DEBUG1: fd 3 of 1 added to pollfd [in compat_poll_add() at > >>>> compat-poll.c:91] DEBUG1: fd 11 of 2 added to pollfd [in > >>>> compat_poll_add() at compat-poll.c:91] DEBUG1: Updating kernel poll > >>>> set [in update_kernel_poll() at main.c:748] DEBUG1: Thread kernel > >>>> polling on 2 fds [in thread_manage_kernel() at main.c:905] DEBUG1: > >>>> [thread] Manage application started [in thread_manage_apps() at > >>>> main.c:1179] DEBUG1: fd 3 of 1 added to pollfd [in > >>>> compat_poll_add() at compat-poll.c:91] DEBUG1: fd 13 of 2 added to > >>>> pollfd [in > >>>> compat_poll_add() at compat-poll.c:91] DEBUG1: Apps thread polling > >>>> on > >>>> 2 fds [in thread_manage_apps() at main.c:1200] DEBUG1: [thread] > >>>> Manage application registration started [in > >>>> thread_registration_apps() at main.c:1392] DEBUG1: fd 3 of 1 added > >>>> to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: fd 10 > >>>> of 2 added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: > >>>> Notifying applications of session daemon state: 1 [in > >>>> notify_ust_apps() at main.c:687] DEBUG1: Got the wait shm fd 15 [in > >>>> get_wait_shm() at shm.c:117] DEBUG1: Futex wait update active 1 [in > >>>> futex_wait_update() at futex.c:62] DEBUG1: Accepting application > >>>> registration [in thread_registration_apps() at main.c:1423] > >>>> > >>>> > >>>> > >>>> #### Output of command "arm-none-linux-gnueabi-lttng-sessiond -vvv > >>>> " before loading the modules ############# > >>>> > >>>> DEBUG3: Creating LTTng run directory: /var/run/lttng [in > >>>> create_lttng_rundir() at main.c:4315] DEBUG2: Kernel consumer err > >>>> path: /var/run/lttng/kconsumerd/error [in main() at main.c:4543] > >>>> DEBUG2: Kernel consumer cmd path: /var/run/lttng/kconsumerd/command > >>>> [in main() at main.c:4545] DEBUG1: Client socket path > >>>> /var/run/lttng/client-lttng-sessiond [in main() at main.c:4592] > >>>> DEBUG1: Application socket path /var/run/lttng/apps-lttng-sessiond > >>>> [in main() at main.c:4593] DEBUG1: LTTng run directory path: > >>>> /var/run/lttng [in main() at main.c:4594] DEBUG2: UST consumer 32 > >>>> bits err path: /var/run/lttng/ustconsumerd32/error [in main() at > >>>> main.c:4603] DEBUG2: UST consumer 32 bits cmd path: > >>>> /var/run/lttng/ustconsumerd32/command [in main() at main.c:4605] > >>>> DEBUG2: UST consumer 64 bits err path: > >>>> /var/run/lttng/ustconsumerd64/error [in main() at main.c:4614] > >>>> DEBUG2: UST consumer 64 bits cmd path: > >>>> /var/run/lttng/ustconsumerd64/command [in main() at main.c:4616] > >>>> DEBUG3: Created hashtable size 4 at 0x4a080 of type 1 [in > >>>> lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 > >>>> at > >>>> 0x4a168 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG2: > >>>> Creating consumer directory: /var/run/lttng/kconsumerd [in > >>>> set_consumer_sockets() at main.c:4357] FATAL: Module lttng_tracer > >>>> not found. Error: Unable to load module lttng-tracer DEBUG1: Failed > >>>> to open /proc/lttng [in init_kernel_tracer() at main.c:1871] Error: > >>>> Unable to remove module lttng-tracer Warning: No kernel tracer > >>>> available DEBUG2: Creating consumer directory: > >>>> /var/run/lttng/ustconsumerd64 [in set_consumer_sockets() at > >>>> main.c:4357] DEBUG2: Creating consumer directory: > >>>> /var/run/lttng/ustconsumerd32 [in set_consumer_sockets() at > >>>> main.c:4357] DEBUG1: Signal handler set for SIGTERM, SIGPIPE and > >>>> SIGINT [in set_signal_handler() at main.c:4449] DEBUG1: All > >>>> permissions are set [in set_permissions() at main.c:4250] DEBUG1: > >>>> poll set max size set to 65535 [in compat_poll_set_max_size() at > >>>> compat-poll.c:196] DEBUG1: [thread] Manage application started [in > >>>> thread_manage_apps() at main.c:1179] DEBUG1: fd 3 of 1 added to > >>>> pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: fd 12 of > >>>> 2 added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: > >>>> Apps thread polling on 2 fds [in thread_manage_apps() at > >>>> main.c:1200] > >>>> DEBUG1: Thread manage kernel started [in thread_manage_kernel() at > >>>> main.c:876] DEBUG1: fd 3 of 1 added to pollfd [in compat_poll_add() > >>>> at compat-poll.c:91] DEBUG1: fd 10 of 2 added to pollfd [in > >>>> compat_poll_add() at compat-poll.c:91] DEBUG1: Updating kernel poll > >>>> set [in update_kernel_poll() at main.c:748] DEBUG1: Thread kernel > >>>> polling on 2 fds [in thread_manage_kernel() at main.c:905] DEBUG1: > >>>> [thread] Manage application registration started [in > >>>> thread_registration_apps() at main.c:1392] DEBUG1: fd 3 of 1 added > >>>> to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: fd 9 > >>>> of 2 added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: > >>>> Notifying applications of session daemon state: 1 [in > >>>> notify_ust_apps() at main.c:687] DEBUG1: [thread] Dispatch UST > >>>> command started [in thread_dispatch_ust_registration() at > >>>> main.c:1324] DEBUG1: Futex n to 1 prepare done [in > >>>> futex_nto1_prepare() at futex.c:73] DEBUG1: Woken up but nothing in > >>>> the UST command queue [in thread_dispatch_ust_registration() at > >>>> main.c:1334] DEBUG1: [thread] Manage client started [in > >>>> thread_manage_clients() at main.c:3794] DEBUG1: fd 3 of 1 added to > >>>> pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: fd 8 of 2 > >>>> added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: > >>>> Accepting client command ... [in thread_manage_clients() at > >>>> main.c:3826] DEBUG1: Got the wait shm fd 14 [in get_wait_shm() at > >>>> shm.c:117] DEBUG1: Futex wait update active 1 [in > >>>> futex_wait_update() at futex.c:62] DEBUG1: Accepting application > >>>> registration [in > >>>> thread_registration_apps() at main.c:1423] > >>>> > >>>> > >>>> Regards, Pavan > >>>> > >>>> -----Original Message----- From: Mathieu Desnoyers > >>>> [mailto:mathieu.desnoyers at efficios.com] Sent: Saturday, June 09, > >>>> 2012 6:03 PM To: Pavan Anumula Cc: lttng-dev at lists.lttng.org Subject: > >>>> Re: [lttng-dev] Lttng start failed > >>>> > >>>> * Pavan Anumula (pavan.anumula at sasken.com) wrote: > >>>>> Hi Mathue, > >>>>> > >>>>> Thanks for the quick reply, > >>>>> > >>>>> After inserting lttng modules , I had given the command > >>>>> "arm-none-linux-gnueabi-lttng-sessiond -vvv" as you said, Below > >>>>> is the output where there are error messages. Please help me in > >>>>> resolving the issue, SO that I can catch kernel and user traces. > >>>>> > >>>>> > >>>>> root at arago:/usr/lttng/modules# > >>>>> arm-none-linux-gnueabi-lttng-sessiond -d > >>>>> root at arago:/usr/lttng/modules# > >>>>> arm-none-linux-gnueabi-lttng-sessiond -vvv DEBUG3: Creating LTTng > >>>>> run directory: /var/run/lttng [in create_lttng_rundir() at > >>>>> main.c:4315] DEBUG2: Kernel consumer err path: > >>>>> /var/run/lttng/kconsumerd/error [in main() at main.c:4543] DEBUG2: > >>>>> Kernel consumer cmd path: /var/run/lttng/kconsumerd/command [in > >>>>> main() at main.c:4545] DEBUG1: Client socket path > >>>>> /var/run/lttng/client-lttng-sessiond [in main() at main.c:4592] > >>>>> DEBUG1: Application socket path /var/run/lttng/apps-lttng-sessiond > >>>>> [in main() at main.c:4593] DEBUG1: LTTng run directory path: > >>>>> /var/run/lttng [in main() at main.c:4594] DEBUG2: UST consumer 32 > >>>>> bits err path: /var/run/lttng/ustconsumerd32/error [in main() at > >>>>> main.c:4603] DEBUG2: UST consumer 32 bits cmd path: > >>>>> /var/run/lttng/ustconsumerd32/command [in main() at main.c:4605] > >>>>> DEBUG2: UST consumer 64 bits err path: > >>>>> /var/run/lttng/ustconsumerd64/error [in main() at main.c:4614] > >>>>> DEBUG2: UST consumer 64 bits cmd path: > >>>>> /var/run/lttng/ustconsumerd64/command [in main() at main.c:4616] > >>>>> Error: Already running daemon. > >>>> > >>>> Please kill the lttng-sessiond that is already started (the one > >>>> with -d). Instead of that one, run the sessiond with: > >>>> > >>>> lttng-sessiond -vvv > >>>> > >>>> (don't run lttng-sessiond -d before) > >>>> > >>>> Thanks, > >>>> > >>>> Mathieu > >>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> Thanks in advance, Pavan > >>>>> > >>>>> -----Original Message----- From: Mathieu Desnoyers > >>>>> [mailto:mathieu.desnoyers at efficios.com] Sent: Friday, June 08, > >>>>> 2012 11:12 PM To: Pavan Anumula Cc: lttng-dev at lists.lttng.org > >>>>> Subject: Re: [lttng-dev] Lttng start failed > >>>>> > >>>>> * Pavan Anumula (pavan.anumula at sasken.com) wrote: > >>>>>> Hi , > >>>>>> > >>>>>> I am new to LTTng usage, I am trying to use LTTng 2.0.1 and > >>>>>> LTTng-modules-2.0.2 for ARM(omapL138), with Linux kernel 2.6.33 > >>>>>> wit RT-29 patch on it. > >>>>>> > >>>>>> After enabling all the kernel events I am facing the below > >>>>>> errors. I loaded all the modules manually by insmod. > >>>>>> > >>>>>> > >>>>>> > >>>>>> root at arago:~/lttng-traces# arm-none-linux-gnueabi-lttng create > >>>>>> newsessiom Session newsessiom created. Traces will be written in > >>>>>> /home/root/lttng-traces/newsessiom-20110325-154922 > >>>>>> > >>>>>> root at arago:~/lttng-traces# arm-none-linux-gnueabi-lttng > >>>>>> enable-event -a --kernel All kernel events are enabled in channel > >>>>>> channel0 > >>>>>> > >>>>>> root at arago:~/lttng-traces# arm-none-linux-gnueabi-lttng start > >>>>>> LTTng: Failure to write metadata to buffers (timeout) Error: > >>>>>> Starting kernel trace failed > >>>>>> > >>>>>> Please kindly help me on this. > >>>>> > >>>>> I think you should look into the lttng-sessiond --help : > >>>>> > >>>>> --consumerd32-path PATH Specify path for the 32-bit UST > >>>>> consumer daemon binary --consumerd32-libdir PATH Specify path for > >>>>> the 32-bit UST consumer daemon libraries --consumerd64-path PATH > >>>>> Specify path for the 64-bit UST consumer daemon binary > >>>>> --consumerd64-libdir PATH Specify path for the 64-bit UST > >>>>> consumer daemon libraries > >>>>> > >>>>> options. My guess is that lttng-sessiond is not able to find the > >>>>> consumerd binary files, maybe due to a rename or because they have > >>>>> been moved after install. > >>>>> > >>>>> One more thing that might help is to launch the lttng-sessiond > >>>>> with "-vvv" : it will provide verbose output and let us know where > >>>>> things fall apart. > >>>>> > >>>>> Thanks, > >>>>> > >>>>> Mathieu > >>>>> > >>>>> > >>>>>> > >>>>>> > >>>>>> Thanks in advance, Pavan > >>>>>> > >>>>>> ________________________________ SASKEN BUSINESS DISCLAIMER: > >>>>>> This message may contain confidential, proprietary or legally > >>>>>> privileged information. In case you are not the original intended > >>>>>> Recipient of the message, you must not, directly or indirectly, > >>>>>> use, disclose, distribute, print, or copy any part of this > >>>>>> message and you are requested to delete it and inform the sender. > >>>>>> Any views expressed in this message are those of the individual > >>>>>> sender unless otherwise stated. Nothing contained in this message > >>>>>> shall be construed as an offer or acceptance of any offer by > >>>>>> Sasken Communication Technologies Limited ("Sasken") unless sent > >>>>>> with that express intent and with due authority of Sasken. Sasken > >>>>>> has taken enough precautions to prevent the spread of viruses. > >>>>>> However the company accepts no liability for any damage caused by > >>>>>> any virus transmitted by this email. Read Disclaimer at > >>>>>> http://www.sasken.com/extras/mail_disclaimer.html > >>>>> > >>>>>> _______________________________________________ lttng-dev mailing > >>>>>> list lttng-dev at lists.lttng.org > >>>>>> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > >>>>> > >>>>> > >>>>> -- Mathieu Desnoyers Operating System Efficiency R&D Consultant > >>>>> EfficiOS Inc. http://www.efficios.com > >>>> > >>>> -- Mathieu Desnoyers Operating System Efficiency R&D Consultant > >>>> EfficiOS Inc. http://www.efficios.com > >>> > >>> -- Mathieu Desnoyers Operating System Efficiency R&D Consultant > >>> EfficiOS Inc. http://www.efficios.com > > > > > > _______________________________________________ lttng-dev mailing list > > lttng-dev at lists.lttng.org > > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.12 (GNU/Linux) > > iQEcBAEBAgAGBQJP201YAAoJEELoaioR9I02a7AH/3sTHsbxRJ3z+//6+wPQu7GC > 6KIZxfBhhq4WSSZRJGHvD9O6QCHPgUmrYjR4leONB9//FfoWdzzRZb0IDErpJ3+L > B8I49nd7X2UHp1jf7CpbJUzrs1AQZa3K32D/nRlF3LceOGnvIpkKstur5msXvN5B > msGap8UQ8NsxkyCRW8cmPNt/Qm7lMsrg9zeP5VGEncj7dywIqaPfjz7MGFwNp4Vz > uxxBusAjnI50Kmx+ETYZmTiqEIPCV9rnpVK4T2LtZgX/+rh06gDkkvW6xy0wO7pf > ymZ0MytfvuKaHXmQnXyGvWhrodmn+D9E32DwyrcuhZa6K0ZPE5eDRbxUT5WGbuQ= > =VYvD > -----END PGP SIGNATURE----- > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From francis.giraldeau at gmail.com Mon Jul 2 10:52:39 2012 From: francis.giraldeau at gmail.com (Francis Giraldeau) Date: Mon, 02 Jul 2012 16:52:39 +0200 Subject: [lttng-dev] [PATCH] Expose kernel tracer to user-space (version 5) In-Reply-To: <20120702141353.GA12843@Krystal> References: <1341236847-16300-1-git-send-email-francis.giraldeau@gmail.com> <20120702141353.GA12843@Krystal> Message-ID: <4FF1B5B7.50102@gmail.com> Le 2012-07-02 16:13, Mathieu Desnoyers a ?crit : > * Francis Giraldeau (francis.giraldeau at gmail.com) wrote: >> By writing to the file /proc/lttng, a user-space application creates a >> kernel event. The event's payload is by default UTF-8 text, but any data >> can be written, up to 1024 bytes. Null-character is optional and is not >> enforced. The event uses sequence for space efficiency and to store any >> data as payload. > > Why limit to 1024 bytes ? We could use a string_from_user, and write it > into a null-terminated string instead. This is the same limit as printk: #define LOG_LINE_MAX 1024 We can't use string_from_user because it's not possible to assume that the string from user-space is null terminated and we can't changed it in order to avoid double copy. Thus, I think the current mechanism is appropriate. Anyway, if the application really wants all the data to be written, then it can create another event with the remaining data, since the number of bytes written is returned. >> The feature is enabled when both lttng-uevent and lttng-probe-uevent are >> loaded. > > Why not combine those two into a single module ? The problem is that the probe code creates it's own module_init and module_exit functions, and I didn't found a way to override properly and still call the probe registration. The easy way was to create two modules, but yes I would prefer it to be combined. What can be done for that? >> Module unload must be prevented while lttng-uevent is being used. >> rcu_synchronized() is call on module unload, and thus rcu_read_lock() can be > > is call -> is called, or is invoked fixed. Thanks! Francis -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4489 bytes Desc: Signature cryptographique S/MIME URL: From mathieu.desnoyers at efficios.com Mon Jul 2 11:14:58 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 2 Jul 2012 11:14:58 -0400 Subject: [lttng-dev] [PATCH] Expose kernel tracer to user-space (version 5) In-Reply-To: <4FF1B5B7.50102@gmail.com> References: <1341236847-16300-1-git-send-email-francis.giraldeau@gmail.com> <20120702141353.GA12843@Krystal> <4FF1B5B7.50102@gmail.com> Message-ID: <20120702151458.GA14036@Krystal> * Francis Giraldeau (francis.giraldeau at gmail.com) wrote: > Le 2012-07-02 16:13, Mathieu Desnoyers a ?crit : > > * Francis Giraldeau (francis.giraldeau at gmail.com) wrote: > >> By writing to the file /proc/lttng, a user-space application creates a > >> kernel event. The event's payload is by default UTF-8 text, but any data > >> can be written, up to 1024 bytes. Null-character is optional and is not > >> enforced. The event uses sequence for space efficiency and to store any > >> data as payload. > > > > Why limit to 1024 bytes ? We could use a string_from_user, and write it > > into a null-terminated string instead. > > This is the same limit as printk: > > #define LOG_LINE_MAX 1024 > > We can't use string_from_user because it's not possible to assume that > the string from user-space is null terminated and we can't changed it in > order to avoid double copy. Thus, I think the current mechanism is > appropriate. Agreed that the sequence is appropriate in that case. However, why the 1024 byte limit ? What is the technical reason for having this limit ? By understanding why we have it, we can find a way to remove it... > > Anyway, if the application really wants all the data to be written, then > it can create another event with the remaining data, since the number of > bytes written is returned. I'd like to avoid that. Ideally, I'd let the maximum event size be limited by the packet size, which is configurable by the user. > > >> The feature is enabled when both lttng-uevent and lttng-probe-uevent are > >> loaded. > > > > Why not combine those two into a single module ? > > The problem is that the probe code creates it's own module_init and > module_exit functions, and I didn't found a way to override properly and > still call the probe registration. The easy way was to create two > modules, but yes I would prefer it to be combined. What can be done for > that? #define TP_MODULE_OVERRIDE before including the trace header. see probes/lttng-events.h. Thanks, Mathieu > > >> Module unload must be prevented while lttng-uevent is being used. > >> rcu_synchronized() is call on module unload, and thus rcu_read_lock() can be > > > > is call -> is called, or is invoked > > fixed. > > Thanks! > > Francis > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From montarcyber at gmail.com Mon Jul 2 14:42:16 2012 From: montarcyber at gmail.com (tchak adim) Date: Mon, 2 Jul 2012 14:42:16 -0400 Subject: [lttng-dev] Displaying graphical results In-Reply-To: References: <4FC3CBF6.1060608@polymtl.ca> Message-ID: Hi all , does any new release of a viewer (supporting CTF format) of LTTng 2.0 has been delivered ? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From francis.giraldeau at gmail.com Mon Jul 2 18:06:18 2012 From: francis.giraldeau at gmail.com (Francis Giraldeau) Date: Tue, 3 Jul 2012 00:06:18 +0200 Subject: [lttng-dev] [PATCH] Expose kernel tracer to user-space (version 6) Message-ID: <1341266778-13735-1-git-send-email-francis.giraldeau@gmail.com> By writing to the file /proc/lttng_uevent, a user-space application creates a kernel event. The event's payload is by default UTF-8 text, but any data can be written, up to 1024 bytes. Null-character is optional and is not enforced. The event uses sequence for space efficiency and to store any data as payload. The feature is enabled when the module lttng-uevent is loaded. The module can be removed if no tracing sessions with lttng_uevent enabled is active. Signed-off-by: Francis Giraldeau --- instrumentation/events/lttng-module/uevent.h | 33 +++++++++ probes/Makefile | 1 + probes/lttng-uevent.c | 97 ++++++++++++++++++++++++++ 3 files changed, 131 insertions(+) create mode 100644 instrumentation/events/lttng-module/uevent.h create mode 100644 probes/lttng-uevent.c diff --git a/instrumentation/events/lttng-module/uevent.h b/instrumentation/events/lttng-module/uevent.h new file mode 100644 index 0000000..f67d901 --- /dev/null +++ b/instrumentation/events/lttng-module/uevent.h @@ -0,0 +1,33 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM uevent + +#if !defined(UEVENT_H_) || defined(TRACE_HEADER_MULTI_READ) +#define UEVENT_H_ + +#include + +TRACE_EVENT(lttng_uevent, + + TP_PROTO(const char *str, size_t len), + + TP_ARGS(str, len), + + /* + * Uses sequence to hold variable size data, by default considered + * as text. Null-terminal character is optional and is not enforced. + */ + TP_STRUCT__entry( + __dynamic_array_text(char, text, len) + ), + + TP_fast_assign( + tp_memcpy_dyn_from_user(text, str) + ), + + TP_printk("") +) + +#endif /* UEVENT_H_ */ + +/* This part must be outside protection */ +#include "../../../probes/define_trace.h" diff --git a/probes/Makefile b/probes/Makefile index 698a9c9..3003535 100644 --- a/probes/Makefile +++ b/probes/Makefile @@ -14,6 +14,7 @@ obj-m += lttng-probe-sched.o obj-m += lttng-probe-irq.o obj-m += lttng-probe-signal.o obj-m += lttng-probe-timer.o +obj-m += lttng-uevent.o obj-m += lttng-probe-statedump.o diff --git a/probes/lttng-uevent.c b/probes/lttng-uevent.c new file mode 100644 index 0000000..96fb233 --- /dev/null +++ b/probes/lttng-uevent.c @@ -0,0 +1,97 @@ +/* + * probes/lttng-uevent.c + * + * Expose kernel tracer to user-space through /proc/lttng + * + * Copyright (C) 2009-2012 Mathieu Desnoyers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; only + * version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include + +/* + * Create lttng_uevent tracepoint probes. + */ + +#define TP_MODULE_NOAUTOLOAD +#define LTTNG_PACKAGE_BUILD +#define CREATE_TRACE_POINTS +#define TRACE_INCLUDE_PATH ../instrumentation/events/lttng-module +#include "../instrumentation/events/lttng-module/uevent.h" + +#define LTTNG_UEVENT_FILE "lttng_uevent" + +/** + * lttng_uevent_write - write user-space data into kernel trace + * @file: file pointer + * @user_buf: user string + * @count: length to copy + * @ppos: unused + * + * Copy count bytes into a trace event "lttng_uevent". + * + * Returns the number of bytes copied from the source. + * Notice that there is no guarantee that the event is + * actually written in a trace. This can occur in 3 + * situations: + * + * * Buffer overrun + * * No trace session are active + * * The data size is greater than a sub-buffer + */ + +ssize_t lttng_uevent_write(struct file *file, const char __user *ubuf, + size_t count, loff_t *fpos) +{ + trace_lttng_uevent(ubuf, count); + return count; +} + +static const struct file_operations uev_ops = { + .owner = THIS_MODULE, + .write = lttng_uevent_write +}; + +static int __init lttng_uevent_init(void) +{ + struct proc_dir_entry *uev_file; + + uev_file = create_proc_entry(LTTNG_UEVENT_FILE, 0444, NULL); + if (!uev_file) + return -ENOENT; + uev_file->proc_fops = &uev_ops; + uev_file->mode = S_IFREG | S_IWUGO; + uev_file->uid = 0; + uev_file->gid = 0; + /* register manually the probe */ + __lttng_events_init__uevent(); + return 0; +} + +static void __exit lttng_uevent_exit(void) +{ + /* unregister manually the probe */ + __lttng_events_exit__uevent(); + remove_proc_entry(LTTNG_UEVENT_FILE, NULL); +} + +module_init(lttng_uevent_init); +module_exit(lttng_uevent_exit); + +MODULE_LICENSE("GPL and additional rights"); +MODULE_AUTHOR("Francis Giraldeau "); +MODULE_DESCRIPTION("Append custom events to kernel trace from user-space"); -- 1.7.9.5 From mathieu.desnoyers at efficios.com Mon Jul 2 18:23:40 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 2 Jul 2012 18:23:40 -0400 Subject: [lttng-dev] [PATCH] Expose kernel tracer to user-space (version 6) In-Reply-To: <1341266778-13735-1-git-send-email-francis.giraldeau@gmail.com> References: <1341266778-13735-1-git-send-email-francis.giraldeau@gmail.com> Message-ID: <20120702222340.GA1702@Krystal> * Francis Giraldeau (francis.giraldeau at gmail.com) wrote: > By writing to the file /proc/lttng_uevent, a user-space application creates a > kernel event. The event's payload is by default UTF-8 text, but any data can be > written, up to 1024 bytes. Null-character is optional and is not enforced. The 1024 byte limit is removed now, right ? > The > event uses sequence for space efficiency and to store any data as payload. > > The feature is enabled when the module lttng-uevent is loaded. The module can > be removed if no tracing sessions with lttng_uevent enabled is active. > > Signed-off-by: Francis Giraldeau > --- > instrumentation/events/lttng-module/uevent.h | 33 +++++++++ > probes/Makefile | 1 + > probes/lttng-uevent.c | 97 ++++++++++++++++++++++++++ > 3 files changed, 131 insertions(+) > create mode 100644 instrumentation/events/lttng-module/uevent.h > create mode 100644 probes/lttng-uevent.c > > diff --git a/instrumentation/events/lttng-module/uevent.h b/instrumentation/events/lttng-module/uevent.h > new file mode 100644 > index 0000000..f67d901 > --- /dev/null > +++ b/instrumentation/events/lttng-module/uevent.h > @@ -0,0 +1,33 @@ > +#undef TRACE_SYSTEM > +#define TRACE_SYSTEM uevent > + > +#if !defined(UEVENT_H_) || defined(TRACE_HEADER_MULTI_READ) > +#define UEVENT_H_ > + > +#include > + > +TRACE_EVENT(lttng_uevent, > + > + TP_PROTO(const char *str, size_t len), > + > + TP_ARGS(str, len), > + > + /* > + * Uses sequence to hold variable size data, by default considered > + * as text. Null-terminal character is optional and is not enforced. > + */ > + TP_STRUCT__entry( > + __dynamic_array_text(char, text, len) > + ), > + > + TP_fast_assign( > + tp_memcpy_dyn_from_user(text, str) > + ), > + > + TP_printk("") > +) > + > +#endif /* UEVENT_H_ */ > + > +/* This part must be outside protection */ > +#include "../../../probes/define_trace.h" > diff --git a/probes/Makefile b/probes/Makefile > index 698a9c9..3003535 100644 > --- a/probes/Makefile > +++ b/probes/Makefile > @@ -14,6 +14,7 @@ obj-m += lttng-probe-sched.o > obj-m += lttng-probe-irq.o > obj-m += lttng-probe-signal.o > obj-m += lttng-probe-timer.o > +obj-m += lttng-uevent.o > > obj-m += lttng-probe-statedump.o > > diff --git a/probes/lttng-uevent.c b/probes/lttng-uevent.c > new file mode 100644 > index 0000000..96fb233 > --- /dev/null > +++ b/probes/lttng-uevent.c > @@ -0,0 +1,97 @@ > +/* > + * probes/lttng-uevent.c > + * > + * Expose kernel tracer to user-space through /proc/lttng > + * > + * Copyright (C) 2009-2012 Mathieu Desnoyers you might want to add your own copyright in here too. the rest looks good. I look forward to see the updated version. Thanks, Mathieu > + * > + * This library is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; only > + * version 2.1 of the License. > + * > + * This library is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with this library; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA > + */ > + > +#include > +#include > + > +/* > + * Create lttng_uevent tracepoint probes. > + */ > + > +#define TP_MODULE_NOAUTOLOAD > +#define LTTNG_PACKAGE_BUILD > +#define CREATE_TRACE_POINTS > +#define TRACE_INCLUDE_PATH ../instrumentation/events/lttng-module > +#include "../instrumentation/events/lttng-module/uevent.h" > + > +#define LTTNG_UEVENT_FILE "lttng_uevent" > + > +/** > + * lttng_uevent_write - write user-space data into kernel trace > + * @file: file pointer > + * @user_buf: user string > + * @count: length to copy > + * @ppos: unused > + * > + * Copy count bytes into a trace event "lttng_uevent". > + * > + * Returns the number of bytes copied from the source. > + * Notice that there is no guarantee that the event is > + * actually written in a trace. This can occur in 3 > + * situations: > + * > + * * Buffer overrun > + * * No trace session are active > + * * The data size is greater than a sub-buffer > + */ > + > +ssize_t lttng_uevent_write(struct file *file, const char __user *ubuf, > + size_t count, loff_t *fpos) > +{ > + trace_lttng_uevent(ubuf, count); > + return count; > +} > + > +static const struct file_operations uev_ops = { > + .owner = THIS_MODULE, > + .write = lttng_uevent_write > +}; > + > +static int __init lttng_uevent_init(void) > +{ > + struct proc_dir_entry *uev_file; > + > + uev_file = create_proc_entry(LTTNG_UEVENT_FILE, 0444, NULL); > + if (!uev_file) > + return -ENOENT; > + uev_file->proc_fops = &uev_ops; > + uev_file->mode = S_IFREG | S_IWUGO; > + uev_file->uid = 0; > + uev_file->gid = 0; > + /* register manually the probe */ > + __lttng_events_init__uevent(); > + return 0; > +} > + > +static void __exit lttng_uevent_exit(void) > +{ > + /* unregister manually the probe */ > + __lttng_events_exit__uevent(); > + remove_proc_entry(LTTNG_UEVENT_FILE, NULL); > +} > + > +module_init(lttng_uevent_init); > +module_exit(lttng_uevent_exit); > + > +MODULE_LICENSE("GPL and additional rights"); > +MODULE_AUTHOR("Francis Giraldeau "); > +MODULE_DESCRIPTION("Append custom events to kernel trace from user-space"); > -- > 1.7.9.5 > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From francis.giraldeau at gmail.com Tue Jul 3 02:19:51 2012 From: francis.giraldeau at gmail.com (Francis Giraldeau) Date: Tue, 03 Jul 2012 08:19:51 +0200 Subject: [lttng-dev] [PATCH] Expose kernel tracer to user-space (version 6) In-Reply-To: <20120702222340.GA1702@Krystal> References: <1341266778-13735-1-git-send-email-francis.giraldeau@gmail.com> <20120702222340.GA1702@Krystal> Message-ID: <4FF28F07.6000901@gmail.com> Le 2012-07-03 00:23, Mathieu Desnoyers a ?crit : > * Francis Giraldeau (francis.giraldeau at gmail.com) wrote: >> By writing to the file /proc/lttng_uevent, a user-space application creates a >> kernel event. The event's payload is by default UTF-8 text, but any data can be >> written, up to 1024 bytes. Null-character is optional and is not enforced. > > The 1024 byte limit is removed now, right ? Exactly. >> + * Expose kernel tracer to user-space through /proc/lttng I just saw a typo here, we should read "through /proc/lttng_uevent" >> + * Copyright (C) 2009-2012 Mathieu Desnoyers > > you might want to add your own copyright in here too. I transfer you the copyright. Thanks! Francis -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4489 bytes Desc: Signature cryptographique S/MIME URL: From Paul_Woegerer at mentor.com Tue Jul 3 03:45:33 2012 From: Paul_Woegerer at mentor.com (Woegerer, Paul) Date: Tue, 3 Jul 2012 09:45:33 +0200 Subject: [lttng-dev] notrace missing in lttng-ust In-Reply-To: <20120630181600.GB30747@Krystal> References: <4FED6718.1000205@mentor.com> <20120630181600.GB30747@Krystal> Message-ID: <4FF2A31D.9020100@mentor.com> Hi Mathieu, here is the revised patch that makes tracepoint.h and ust-tracepoint-event.h robust against -finstrument-functions. I tested it against our small ackermann sample (3 custom tracepoints + -finstrument-functions). See screenshots. Btw, nice macro metaprogramming in ust-tracepoint-event.h :) Thanks, Paul On 06/30/2012 08:16 PM, Mathieu Desnoyers wrote: > * Woegerer, Paul (Paul_Woegerer at mentor.com) wrote: >> Hi Mathieu, >> >> libust 0.x uses notrace (__attribute__((no_instrument_function)) for all >> functions that are involved in event emitting. >> >> For example: >> ./libust/marker.c:122:notrace void __ust_marker_empty_function(const >> struct ust_marker *mdata, >> ./libust/marker.c:137:notrace void ust_marker_probe_cb(const struct >> ust_marker *mdata, >> ./libust/marker.c:197:static notrace void >> ust_marker_probe_cb_noarg(const struct ust_marker *mdata, >> >> I just realized that this is no more the case for lttng-ust. >> Was it a conscious decision not to use notrace for LTTng 2.0 lttng-ust, >> or is it just missing ? > just missing. only needed for -finstrument-functions. > >> I would like to have notrace also in lttng-ust, at least for the >> _DECLARE_TRACEPOINT macro in tracepoint.h. > I guess the probes generated by ust-tracepoint-event.h would need that > too. A patch that adds those noinline everywhere where it's needed > (hint: all functions called on the tracing patch within public headers > of lttng-ust 2.0 would be a good start). Please test the patch by > tracing a program automatically instrumented by -finstrument-functions > and see if things blow up. > > Thanks, > > Mathieu > >> Like this for example: >> >> diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h >> index 5bab476..71665dc 100644 >> --- a/include/lttng/tracepoint.h >> +++ b/include/lttng/tracepoint.h >> @@ -137,6 +137,7 @@ extern "C" { >> >> #define _DECLARE_TRACEPOINT(_provider, _name, ...) \ >> extern struct tracepoint __tracepoint_##_provider##___##_name; >> \ >> +static inline void >> __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) >> __attribute__ ((no_instrument_function)); \ >> static inline void >> __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) \ >> { \ >> struct tracepoint_probe *__tp_probe; \ >> @@ -158,12 +159,16 @@ end: \ >> tp_rcu_read_unlock_bp(); \ >> } \ >> static inline void __tracepoint_register_##_provider##___##_name(char >> *name, \ >> + void (*func)(void), void *data) __attribute__ >> ((no_instrument_function)); \ >> +static inline void __tracepoint_register_##_provider##___##_name(char >> *name, \ >> void (*func)(void), void *data) \ >> { \ >> __tracepoint_probe_register(name, func, data, \ >> __tracepoint_##_provider##___##_name.signature); \ >> } \ >> static inline void __tracepoint_unregister_##_provider##___##_name(char >> *name, \ >> + void (*func)(void), void *data) __attribute__ >> ((no_instrument_function)); \ >> +static inline void __tracepoint_unregister_##_provider##___##_name(char >> *name, \ >> void (*func)(void), void *data) \ >> { \ >> __tracepoint_probe_unregister(name, func, data); \ >> >> Greetings, >> Paul >> >> -- >> Paul Woegerer | SW Development Engineer >> Mentor Embedded(tm) | Prinz Eugen Stra?e 72/2/4, Vienna, 1040 Austria >> P 43.1.535991320 >> Nucleus? | Linux? | Android(tm) | Services | UI | Multi-OS >> >> Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions. >> Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. >> >> >> _______________________________________________ >> lttng-dev mailing list >> lttng-dev at lists.lttng.org >> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Paul Woegerer | SW Development Engineer Mentor Embedded(tm) | Prinz Eugen Stra?e 72/2/4, Vienna, 1040 Austria P 43.1.535991320 Nucleus? | Linux? | Android(tm) | Services | UI | Multi-OS Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Make-lttng-ust-robust-against-finstrument-functions.patch Type: text/x-patch Size: 9607 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ackermann_before.png Type: image/png Size: 32262 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ackermann_after.png Type: image/png Size: 14661 bytes Desc: not available URL: From mathieu.desnoyers at efficios.com Tue Jul 3 07:39:47 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 3 Jul 2012 07:39:47 -0400 Subject: [lttng-dev] [PATCH] Expose kernel tracer to user-space (version 6) In-Reply-To: <4FF28F07.6000901@gmail.com> References: <1341266778-13735-1-git-send-email-francis.giraldeau@gmail.com> <20120702222340.GA1702@Krystal> <4FF28F07.6000901@gmail.com> Message-ID: <20120703113947.GA24563@Krystal> * Francis Giraldeau (francis.giraldeau at gmail.com) wrote: > Le 2012-07-03 00:23, Mathieu Desnoyers a ?crit : > > * Francis Giraldeau (francis.giraldeau at gmail.com) wrote: > >> By writing to the file /proc/lttng_uevent, a user-space application creates a > >> kernel event. The event's payload is by default UTF-8 text, but any data can be > >> written, up to 1024 bytes. Null-character is optional and is not enforced. > > > > The 1024 byte limit is removed now, right ? > > Exactly. OK, please provide an updated version with the updated changelog. > > >> + * Expose kernel tracer to user-space through /proc/lttng > > I just saw a typo here, we should read "through /proc/lttng_uevent" Same here. > > >> + * Copyright (C) 2009-2012 Mathieu Desnoyers > > > > you might want to add your own copyright in here too. > > I transfer you the copyright. Thanks! One more thing: In the testing you did, did you try running, in parallel: for a in $(seq 1 10000); do modprobe nameofuevent_module rmmod nameofevent_module done and in 4 another terminals: echo "blahblahblah" > /proc/lttng_uevent ? I understand that you tested only the write path in parallel, but I'm not sure, from your changelog, that you stress-tested load/unload vs write. Thanks, Mathieu > > Thanks! > > Francis > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From francis.giraldeau at gmail.com Tue Jul 3 09:29:12 2012 From: francis.giraldeau at gmail.com (Francis Giraldeau) Date: Tue, 3 Jul 2012 15:29:12 +0200 Subject: [lttng-dev] [PATCH] Expose kernel tracer to user-space (version 7) Message-ID: <1341322152-4380-1-git-send-email-francis.giraldeau@gmail.com> By writing to the file /proc/lttng_uevent, a user-space application creates a kernel event. The event's payload is by default UTF-8 text, but any data can be written. The maximum size of the data is at most the size of a packet defined for the trace session. Null-character is optional and is not enforced. The event uses sequence for space efficiency and to store any data as payload. The feature is enabled when the module lttng-uevent is loaded. The module can be removed if no tracing sessions with lttng_uevent enabled is active. Signed-off-by: Francis Giraldeau --- instrumentation/events/lttng-module/uevent.h | 33 +++++++++ probes/Makefile | 1 + probes/lttng-uevent.c | 97 ++++++++++++++++++++++++++ 3 files changed, 131 insertions(+) create mode 100644 instrumentation/events/lttng-module/uevent.h create mode 100644 probes/lttng-uevent.c diff --git a/instrumentation/events/lttng-module/uevent.h b/instrumentation/events/lttng-module/uevent.h new file mode 100644 index 0000000..f67d901 --- /dev/null +++ b/instrumentation/events/lttng-module/uevent.h @@ -0,0 +1,33 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM uevent + +#if !defined(UEVENT_H_) || defined(TRACE_HEADER_MULTI_READ) +#define UEVENT_H_ + +#include + +TRACE_EVENT(lttng_uevent, + + TP_PROTO(const char *str, size_t len), + + TP_ARGS(str, len), + + /* + * Uses sequence to hold variable size data, by default considered + * as text. Null-terminal character is optional and is not enforced. + */ + TP_STRUCT__entry( + __dynamic_array_text(char, text, len) + ), + + TP_fast_assign( + tp_memcpy_dyn_from_user(text, str) + ), + + TP_printk("") +) + +#endif /* UEVENT_H_ */ + +/* This part must be outside protection */ +#include "../../../probes/define_trace.h" diff --git a/probes/Makefile b/probes/Makefile index 698a9c9..3003535 100644 --- a/probes/Makefile +++ b/probes/Makefile @@ -14,6 +14,7 @@ obj-m += lttng-probe-sched.o obj-m += lttng-probe-irq.o obj-m += lttng-probe-signal.o obj-m += lttng-probe-timer.o +obj-m += lttng-uevent.o obj-m += lttng-probe-statedump.o diff --git a/probes/lttng-uevent.c b/probes/lttng-uevent.c new file mode 100644 index 0000000..65bac2a --- /dev/null +++ b/probes/lttng-uevent.c @@ -0,0 +1,97 @@ +/* + * probes/lttng-uevent.c + * + * Expose kernel tracer to user-space through /proc/lttng_uevent + * + * Copyright (C) 2009-2012 Mathieu Desnoyers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; only + * version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include + +/* + * Create lttng_uevent tracepoint probes. + */ + +#define TP_MODULE_NOAUTOLOAD +#define LTTNG_PACKAGE_BUILD +#define CREATE_TRACE_POINTS +#define TRACE_INCLUDE_PATH ../instrumentation/events/lttng-module +#include "../instrumentation/events/lttng-module/uevent.h" + +#define LTTNG_UEVENT_FILE "lttng_uevent" + +/** + * lttng_uevent_write - write user-space data into kernel trace + * @file: file pointer + * @user_buf: user string + * @count: length to copy + * @ppos: unused + * + * Copy count bytes into a trace event "lttng_uevent". + * + * Returns the number of bytes copied from the source. + * Notice that there is no guarantee that the event is + * actually written in a trace. This can occur in 3 + * situations: + * + * * Buffer overrun + * * No trace session are active + * * The data size is greater than a sub-buffer + */ + +ssize_t lttng_uevent_write(struct file *file, const char __user *ubuf, + size_t count, loff_t *fpos) +{ + trace_lttng_uevent(ubuf, count); + return count; +} + +static const struct file_operations uev_ops = { + .owner = THIS_MODULE, + .write = lttng_uevent_write +}; + +static int __init lttng_uevent_init(void) +{ + struct proc_dir_entry *uev_file; + + uev_file = create_proc_entry(LTTNG_UEVENT_FILE, 0444, NULL); + if (!uev_file) + return -ENOENT; + uev_file->proc_fops = &uev_ops; + uev_file->mode = S_IFREG | S_IWUGO; + uev_file->uid = 0; + uev_file->gid = 0; + /* register manually the probe */ + __lttng_events_init__uevent(); + return 0; +} + +static void __exit lttng_uevent_exit(void) +{ + /* unregister manually the probe */ + __lttng_events_exit__uevent(); + remove_proc_entry(LTTNG_UEVENT_FILE, NULL); +} + +module_init(lttng_uevent_init); +module_exit(lttng_uevent_exit); + +MODULE_LICENSE("GPL and additional rights"); +MODULE_AUTHOR("Francis Giraldeau "); +MODULE_DESCRIPTION("Append custom events to kernel trace from user-space"); -- 1.7.9.5 From francis.giraldeau at gmail.com Tue Jul 3 09:34:23 2012 From: francis.giraldeau at gmail.com (Francis Giraldeau) Date: Tue, 03 Jul 2012 15:34:23 +0200 Subject: [lttng-dev] [PATCH] Expose kernel tracer to user-space (version 6) In-Reply-To: <20120703113947.GA24563@Krystal> References: <1341266778-13735-1-git-send-email-francis.giraldeau@gmail.com> <20120702222340.GA1702@Krystal> <4FF28F07.6000901@gmail.com> <20120703113947.GA24563@Krystal> Message-ID: <4FF2F4DF.9030904@gmail.com> Le 2012-07-03 13:39, Mathieu Desnoyers a ?crit : > * Francis Giraldeau (francis.giraldeau at gmail.com) wrote: >> Le 2012-07-03 00:23, Mathieu Desnoyers a ?crit : >>> * Francis Giraldeau (francis.giraldeau at gmail.com) wrote: >>>> By writing to the file /proc/lttng_uevent, a user-space application creates a >>>> kernel event. The event's payload is by default UTF-8 text, but any data can be >>>> written, up to 1024 bytes. Null-character is optional and is not enforced. >>> >>> The 1024 byte limit is removed now, right ? >> >> Exactly. > > OK, please provide an updated version with the updated changelog. Fixed. > >> >>>> + * Expose kernel tracer to user-space through /proc/lttng >> >> I just saw a typo here, we should read "through /proc/lttng_uevent" > > Same here. Fixed. > >> >>>> + * Copyright (C) 2009-2012 Mathieu Desnoyers >>> >>> you might want to add your own copyright in here too. >> >> I transfer you the copyright. > > Thanks! > > One more thing: > > In the testing you did, did you try running, in parallel: > > for a in $(seq 1 10000); do > modprobe nameofuevent_module > rmmod nameofevent_module > done > > and in 4 another terminals: > > echo "blahblahblah" > /proc/lttng_uevent > > ? > > I understand that you tested only the write path in parallel, but I'm > not sure, from your changelog, that you stress-tested load/unload vs > write. The test I did was to write in parallel to /proc/lttng_uevent and see the behavior. It takes about 15us on my i5 2.5Ghz to log an event this way in a tight loop, so yeah, it's quite slow. It's not possible to remove the module while an active tracing session references the event lttng_uevent. I tested insertion/removal of the module while tracing with the previous version that was using RCU and it was working well. Cheers, Francis -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4489 bytes Desc: Signature cryptographique S/MIME URL: From mathieu.desnoyers at efficios.com Tue Jul 3 09:40:32 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 3 Jul 2012 09:40:32 -0400 Subject: [lttng-dev] [PATCH] Expose kernel tracer to user-space (version 6) In-Reply-To: <4FF2F4DF.9030904@gmail.com> References: <1341266778-13735-1-git-send-email-francis.giraldeau@gmail.com> <20120702222340.GA1702@Krystal> <4FF28F07.6000901@gmail.com> <20120703113947.GA24563@Krystal> <4FF2F4DF.9030904@gmail.com> Message-ID: <20120703134031.GB32190@Krystal> * Francis Giraldeau (francis.giraldeau at gmail.com) wrote: > Le 2012-07-03 13:39, Mathieu Desnoyers a ?crit : > > * Francis Giraldeau (francis.giraldeau at gmail.com) wrote: > >> Le 2012-07-03 00:23, Mathieu Desnoyers a ?crit : > >>> * Francis Giraldeau (francis.giraldeau at gmail.com) wrote: > >>>> By writing to the file /proc/lttng_uevent, a user-space application creates a > >>>> kernel event. The event's payload is by default UTF-8 text, but any data can be > >>>> written, up to 1024 bytes. Null-character is optional and is not enforced. > >>> > >>> The 1024 byte limit is removed now, right ? > >> > >> Exactly. > > > > OK, please provide an updated version with the updated changelog. > > Fixed. > > > > >> > >>>> + * Expose kernel tracer to user-space through /proc/lttng > >> > >> I just saw a typo here, we should read "through /proc/lttng_uevent" > > > > Same here. > > Fixed. > > > > >> > >>>> + * Copyright (C) 2009-2012 Mathieu Desnoyers > >>> > >>> you might want to add your own copyright in here too. > >> > >> I transfer you the copyright. > > > > Thanks! > > > > One more thing: > > > > In the testing you did, did you try running, in parallel: > > > > for a in $(seq 1 10000); do > > modprobe nameofuevent_module > > rmmod nameofevent_module > > done > > > > and in 4 another terminals: > > > > echo "blahblahblah" > /proc/lttng_uevent > > > > ? > > > > I understand that you tested only the write path in parallel, but I'm > > not sure, from your changelog, that you stress-tested load/unload vs > > write. > > The test I did was to write in parallel to /proc/lttng_uevent and see > the behavior. It takes about 15us on my i5 2.5Ghz to log an event this > way in a tight loop, so yeah, it's quite slow. Yep, that's benchmarking. I'm more concerned about correctness. > It's not possible to remove the module while an active tracing session > references the event lttng_uevent. I tested insertion/removal of the > module while tracing with the previous version that was using RCU and it > was working well. But you don't need to have an active tracing session to perform the test I point to above. Could you run it on this latest version ? Thanks, Mathieu > > Cheers, > > Francis > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From francis.giraldeau at gmail.com Tue Jul 3 10:23:40 2012 From: francis.giraldeau at gmail.com (Francis Giraldeau) Date: Tue, 03 Jul 2012 16:23:40 +0200 Subject: [lttng-dev] [PATCH] Expose kernel tracer to user-space (version 6) In-Reply-To: <20120703134031.GB32190@Krystal> References: <1341266778-13735-1-git-send-email-francis.giraldeau@gmail.com> <20120702222340.GA1702@Krystal> <4FF28F07.6000901@gmail.com> <20120703113947.GA24563@Krystal> <4FF2F4DF.9030904@gmail.com> <20120703134031.GB32190@Krystal> Message-ID: <4FF3006C.5000308@gmail.com> Le 2012-07-03 15:40, Mathieu Desnoyers a ?crit : >> It's not possible to remove the module while an active tracing session >> references the event lttng_uevent. I tested insertion/removal of the >> module while tracing with the previous version that was using RCU and it >> was working well. > > But you don't need to have an active tracing session to perform the test > I point to above. Could you run it on this latest version ? Ok. I updated the test to run in a loop rmmod/modprobe, while writing with 20 threads into /proc/lttng_uevent. The result is that the module can be unloaded properly, the test shows no race that prevent the module to be unloaded or other problems. If somebody wants to test it for themselves, I added the code for this test under workload-kit/tests. * test-uevent : runs 4 times 20 threads each producing 64k events * module-reload-forever.sh : rmmod/modprobe of lttng_uevent * test-uevent.sh : quick wrapper for testing functionnality Thanks! Francis -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4489 bytes Desc: Signature cryptographique S/MIME URL: From pavan.anumula at sasken.com Tue Jul 3 10:47:48 2012 From: pavan.anumula at sasken.com (Pavan Anumula) Date: Tue, 3 Jul 2012 20:17:48 +0530 Subject: [lttng-dev] Adding New Tracepoints In-Reply-To: <20120702144846.GA13162@Krystal> References: <47D610AD9C485E458630BA38C324D3B60113FB9D4D97@EXGMBX01.sasken.com> <20120702144846.GA13162@Krystal> Message-ID: <47D610AD9C485E458630BA38C324D3B60113FB9D4E0B@EXGMBX01.sasken.com> Hi Mathieu, Thanks for the quick reply... I tried the way you suggested , For a trial I used kernel's sample tracepoint. I added the "tp-samples-trace.h" to lttng-modules's path "instrumentation/events/lttng-module/". I added the "tracepoint-probe-sample.c" to lttng-modules probes/ directory , Compiled and loaded on the target. But still I am unable to see my sample trcaepoints in the lttng-list -k(After starting the lttng-sessiond). Is this the way you are suggesting Please help me further on this as I am very new to tracing and lttng. Thanks in advance, Pavan -----Original Message----- From: Mathieu Desnoyers [mailto:mathieu.desnoyers at efficios.com] Sent: Monday, July 02, 2012 8:19 PM To: Pavan Anumula Cc: lttng-dev at lists.lttng.org Subject: Re: [lttng-dev] Adding New Tracepoints * Pavan Anumula (pavan.anumula at sasken.com) wrote: > Hi ALL, > > I am newbie to Tracing mechanism and LTTng usage ,I want to calculate the overhead of LTTng (without using caliberate command), For that I added some trace points to function "timer_interrupt() " inside kernel "arch/arm/mach-davinci/time.c", So that I can calculate time differences by enabling and disabling them. > > I followed the Kernel documentation of tracepoints and also declared the tracpoints and defined and registered probefunctions for those trace points. > > But I can't see my new trace points when I give the command "arm-none-linux-gnueabi-lttng list -k". Can we add our own new trace points so that it will call probe function which I define?? If so please let me know the procedure in order to use them for LTTng overhead measurement. > > Also let me know the procedure for enabling and disabling newly added tracepoints in LTTng. you'll first need to add a copy of your tracepoint event file into lttng-modules instrumentation/ directory (see README file, and diff existing mainline vs lttng-modules files to figure out the modifications needed). you'll have to add new probes into lttng-modules probes/ directory. Load those new modules. Then start lttng-sessiond. The list -k command should show the new tracepoints. Use enable-event -k tracepoint_name to enable it. Thanks, Mathieu > > > I am using. > Lttng modules 2.0.2 > Lttng tools:2.0.1 > Kernel:2.6.33.7 with RT-29 patch. > > Thanks In Advance, > Pavan > > -----Original Message----- > From: Pavan Anumula > Sent: Thursday, June 21, 2012 8:54 PM > To: 'David Goulet' > Cc: lttng-dev at lists.lttng.org; Mathieu Desnoyers > (mathieu.desnoyers at efficios.com) > Subject: RE: [lttng-dev] Empty traces for UST > > Hi David, > > We tried to debug lttng commands with gdbserver on the arm target from host gdb remote target session following were obersevations: > 1. create Session > gdbserver --remote-debug localhost:5560 arm-none-linux-gnueabi-lttng > -vvv create sesAA > >>passed with out and errors > > 2. Enable events for session > gdbserver --remote-debug localhost:5560 arm-none-linux-gnueabi-lttng > -vvv enable-event -u -a > >> failed randomly with segment faults and memeory allocation error > >> see below trace error > > >>> (gdb) n > >>>312 goto error; > >>> (gdb) n > >>>318 handle = lttng_create_handle(session_name, &dom); > >>> (gdb) s > >>>lttng_create_handle (session_name=0x40015154 "", domain=0xbe810bbc) at lttng-ctl.c:395 > >>>395 perror("malloc handle"); > > > Some times it used to print: > >>>/lib/ld-linux.so.3: No such file or directory > Or > Segment faults > > Here is the /proc/meminfo of device: > root at arago:~# cat /proc/meminfo > MemTotal: 28220 kB > MemFree: 12704 kB > Buffers: 0 kB > Cached: 7520 kB > SwapCached: 0 kB > Active: 4804 kB > Inactive: 4984 kB > Active(anon): 2296 kB > Inactive(anon): 84 kB > Active(file): 2508 kB > Inactive(file): 4900 kB > Unevictable: 0 kB > Mlocked: 0 kB > SwapTotal: 0 kB > SwapFree: 0 kB > Dirty: 0 kB > Writeback: 0 kB > AnonPages: 2296 kB > Mapped: 2000 kB > Shmem: 112 kB > Slab: 3188 kB > SReclaimable: 808 kB > SUnreclaim: 2380 kB > KernelStack: 576 kB > PageTables: 288 kB > NFS_Unstable: 0 kB > Bounce: 0 kB > WritebackTmp: 0 kB > CommitLimit: 14108 kB > Committed_AS: 47704 kB > VmallocTotal: 985088 kB > VmallocUsed: 400 kB > VmallocChunk: 984612 kB > > Please suggest how to overcome this issue. > > Regards, > Pavan > > -----Original Message----- > From: David Goulet [mailto:dgoulet at efficios.com] > Sent: Friday, June 15, 2012 8:28 PM > To: Pavan Anumula > Cc: lttng-dev at lists.lttng.org > Subject: Re: [lttng-dev] Empty traces for UST > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi Pavan, > > Glad for the kernel! :) > > For UST, I'll recommend you start a session daemon like so > "lttng-sessiond > - -vvv". After that, use the lttng-ust/tests/hello program and execute it. You should see on the debug output of the session daemon that the application "hello" has registered and is ready for tracing. > > Your output below does NOT show those debug messages so it would be a good start to see if there is a problem at that point. Also, make sure that the liblttng-ust is installed upon compiling lttng-tools so that the user space tracer support is enabled in the tools. > > Thanks! > David > > On 15/06/12 10:50 AM, Pavan Anumula wrote: > > Hi David, > > > > Finally I was able to get kernel traces by referring to one of your > > other posts , Actually lttng-consumerd binary was actually not > > present at the needed path, Thanks for your help. > > > > And sorry for bugging you with mails :) . > > > > > > But this time I am facing issues at UST tracing . Please kindly help > > me on this. > > > > When I try to trace for User space it is creating an empty folder > > with no traces on ARM target, I tried with all the sample trace > > programs in LTTng-UST/tests folder. > > > > I am using NFS to load binaries and for tracing will that causes problem. > > Please also find the debug logs attached, > > > > Please also let me know if you want some more information. > > > > > > ************************************** fcntl64(12, F_SETFD, FD_CLOEXEC) > > = 0 fcntl64(13, F_SETFD, FD_CLOEXEC) = 0 pipe([14, 15]) > > = 0 fcntl64(14, F_SETFD, FD_CLOEXEC) = 0 fcntl64(15, F_SETFD, > > FD_CLOEXEC) = 0 getrlimit(RLIMIT_NOFILE, {rlim_cur=65535, > > rlim_max=65535}) = 0 write(2, "DEBUG1: poll set max size set to"..., > > 92DEBUG1: poll set max size set to 65535 [in > > compat_poll_set_max_size() at compat-poll.c:196] ) = 92 mmap2(NULL, > > 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4024b000 mprotect(0x4024b000, 4096, > > PROT_NONE) = 0 clone(child_stack=0x40a49ef8, > > flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE > > _S > > YSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, > > parent_tidptr=0x40a4a3e8, tls=0x40a4a840, child_tidptr=0x40a4a3e8) = > > 921 mmap2(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, > > 0) = 0x40a4b000 mprotect(0x40a4b000, 4096, PROT_NONE) = 0 > > clone(child_stack=0x41249ef8, > > flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE > > _S > > YSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, > > parent_tidptr=0x4124a3e8, tls=0x4124a840, child_tidptr=0x4124a3e8) = > > 922 mmap2(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, > > 0) = 0x4124b000 mprotect(0x4124b000, 4096, PROT_NONE) = 0 > > clone(child_stack=0x41a49ef8, > > flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE > > _S > > YSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, > > parent_tidptr=0x41a4a3e8, tls=0x41a4a840, child_tidptr=0x41a4a3e8) = > > 923 mmap2(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, > > 0) = 0x41a4b000 mprotect(0x41a4b000, 4096, PROT_NONE) = 0 clone(DEBUG1: > > [thread] Dispatch UST command started [in > > thread_dispatch_ust_registration() at main.c:1324] DEBUG1: Futex n > > to > > 1 prepare done [in futex_nto1_prepare() at futex.c:73] DEBUG1: Woken > > up but nothing in the UST command queue [in > > thread_dispatch_ust_registration() at main.c:1334] DEBUG1: [thread] > > Manage application registration started [in > > thread_registration_apps() at main.c:1392] DEBUG1: fd 3 of 1 added > > to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: fd 11 > > of 2 added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: > > Notifying applications of session daemon state: 1 [in > > notify_ust_apps() at main.c:687] DEBUG1: Got the wait shm fd 16 [in > > get_wait_shm() at shm.c:117] DEBUG1: Futex wait update active 1 [in > > futex_wait_update() at futex.c:62] DEBUG1: Accepting application > > registration [in > > thread_registration_apps() at main.c:1423] DEBUG1: [thread] Manage > > application started [in thread_manage_apps() at main.c:1179] DEBUG1: > > fd 3 of 1 added to pollfd [in compat_poll_add() at compat-poll.c:91] > > DEBUG1: fd > > 14 of 2 added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: > > Apps thread polling on 2 fds [in thread_manage_apps() at > > main.c:1200] > > DEBUG1: [thread] Manage client started [in thread_manage_clients() > > at main.c:3794] DEBUG1: fd 3 of 1 added to pollfd [in > > compat_poll_add() at compat-poll.c:91] DEBUG1: fd 10 of 2 added to > > pollfd [in > > compat_poll_add() at compat-poll.c:91] DEBUG1: Accepting client > > command ... [in > > thread_manage_clients() at main.c:3826] child_stack=0x42249ef8, > > flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE > > _S > > YSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, > > parent_tidptr=0x4224a3e8, tls=0x4224a840, child_tidptr=0x4224a3e8) = > > 924 mmap2(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, > > 0) = 0x4224b000 mprotect(0x4224b000, 4096, PROT_NONE) = 0 > > clone(child_stack=0x42a49ef8, > > flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE > > _S > > YSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, > > parent_tidptr=0x42a4a3e8, tls=0x42a4a840, child_tidptr=0x42a4a3e8) = > > 925 futex(0x42a4a3e8, FUTEX_WAIT, 925, NULLDEBUG1: Thread manage > > kernel started [in thread_manage_kernel() at main.c:876] DEBUG1: fd > > 3 of 1 added to pollfd [in compat_poll_add() at compat-poll.c:91] > > DEBUG1: fd 12 of 2 added to pollfd [in compat_poll_add() at > > compat-poll.c:91] DEBUG1: Updating kernel poll set [in > > update_kernel_poll() at main.c:748] DEBUG1: Thread kernel polling on > > 2 fds [in thread_manage_kernel() at main.c:905] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: > > Receiving data from client ... [in thread_manage_clients() at > > main.c:3898] > > DEBUG1: Nothing recv() from client... continuing [in > > thread_manage_clients() at main.c:3902] DEBUG1: Clean command > > context structure [in clean_command_ctx() at main.c:534] DEBUG1: > > Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: > > Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: > > Receiving data from client ... [in thread_manage_clients() at > > main.c:3898] > > DEBUG1: Processing client command 8 [in process_client_msg() at > > main.c:3309] DEBUG2: Trying to find session by name sesCCC [in > > session_find_by_name() at session.c:126] DEBUG3: mkdir() recursive > > /home/root/lttng-traces/sesCCC-20110327-045731 with mode 504 for uid > > 0 and gid 0 [in run_as_mkdir_recursive() at runas.c:338] DEBUG1: > > Using run_as_clone [in run_as() at runas.c:322] DEBUG1: Tracing > > session sesCCC created in > > /home/root/lttng-traces/sesCCC-20110327-045731 with ID 1 by UID > > 0 GID 0 [in session_create() at session.c:234] DEBUG1: Sending > > response > > (size: 16, retcode: Success) [in thread_manage_clients() at > > main.c:3936] > > DEBUG1: Clean command context structure [in clean_command_ctx() at > > main.c:534] DEBUG1: Accepting client command ... [in > > thread_manage_clients() at main.c:3826] DEBUG1: Wait for client > > response [in thread_manage_clients() at main.c:3863] DEBUG1: > > Receiving data from client ... [in thread_manage_clients() at > > main.c:3898] > > DEBUG1: Nothing > > recv() from client... continuing [in thread_manage_clients() at > > main.c:3902] DEBUG1: Clean command context structure [in > > clean_command_ctx() at main.c:534] DEBUG1: Accepting client command > > ... [in > > thread_manage_clients() at main.c:3826] DEBUG1: Wait for client > > response [in thread_manage_clients() at main.c:3863] DEBUG1: > > Receiving data from client ... [in thread_manage_clients() at > > main.c:3898] > > DEBUG1: Processing client command 6 [in process_client_msg() at > > main.c:3309] DEBUG1: Getting session sesCCC by name [in process_client_msg() at main.c:3364] DEBUG2: > > Trying to find session by name sesCCC [in session_find_by_name() at > > session.c:126] DEBUG1: Creating UST session [in create_ust_session() > > at main.c:1965] DEBUG3: Created hashtable size 4 at 0x4fa08 of type > > 1 [in > > lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 > > at > > 0x4fb28 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: > > Created hashtable size 4 at 0x4fc48 of type 0 [in lttng_ht_new() at > > hashtable.c:96] DEBUG2: UST trace session create successful [in > > trace_ust_create_session() at trace-ust.c:119] DEBUG3: mkdir() > > recursive /home/root/lttng-traces/sesCCC-20110327-045731/ust with > > mode > > 504 for uid 0 and gid 0 [in run_as_mkdir_recursive() at runas.c:338] > > DEBUG1: Using run_as_clone [in run_as() at runas.c:322] DEBUG1: > > Spawning consumerd [in > > spawn_consumerd() at main.c:1659] DEBUG1: Using 32-bit UST consumer at: > > /root/armfilesystem/lib/lttng/libexec/lttng-consumerd [in > > spawn_consumerd() at main.c:1777] DEBUG2: Consumer pid 934 [in > > start_consumerd() at main.c:1830] DEBUG2: Spawning consumer control > > thread [in start_consumerd() at main.c:1833] DEBUG1: [thread] Manage > > consumer started [in > > thread_manage_consumer() at main.c:982] DEBUG1: fd 3 of 1 added to > > pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: fd 9 of 2 > > added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG2: > > Receiving code from consumer err_sock [in thread_manage_consumer() at main.c:1043] DEBUG1: > > consumer command socket ready [in thread_manage_consumer() at > > main.c:1062] > > DEBUG1: fd 17 of 2 added to pollfd [in compat_poll_add() at > > compat-poll.c:91] DEBUG2: Trace UST channel channel0 not found by > > name [in > > trace_ust_find_channel_by_name() at trace-ust.c:52] DEBUG3: Created > > hashtable size 4 at 0x51310 of type 0 [in lttng_ht_new() at > > hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x51430 of type > > 1 [in > > lttng_ht_new() at hashtable.c:96] DEBUG2: Trace UST channel channel0 > > created [in trace_ust_create_channel() at trace-ust.c:181] DEBUG2: > > Channel > > channel0 being created in UST global domain [in channel_ust_create() > > at channel.c:267] DEBUG2: UST app adding channel channel0 to global > > domain for session id 1 [in ust_app_create_channel_glb() at ust-app.c:1792] DEBUG2: > > Channel channel0 created successfully [in channel_ust_create() at > > channel.c:292] DEBUG2: Trace UST channel channel0 found by name [in > > trace_ust_find_channel_by_name() at trace-ust.c:47] DEBUG2: Trace > > UST event NOT found by name * [in trace_ust_find_event_by_name() at > > trace-ust.c:79] > > DEBUG3: Created hashtable size 4 at 0x51550 of type 1 [in > > lttng_ht_new() at hashtable.c:96] DEBUG2: Trace UST event *, > > loglevel > > (0,-1) created [in > > trace_ust_create_event() at trace-ust.c:260] DEBUG1: UST app > > creating event > > * for all apps for session id 1 [in ust_app_create_event_glb() at > > ust-app.c:1916] DEBUG1: Event UST * created in channel channel0 [in > > event_ust_enable_tracepoint() at event.c:446] DEBUG1: Sending > > response > > (size: 16, retcode: Success) [in thread_manage_clients() at > > main.c:3936] > > DEBUG1: Clean command context structure [in clean_command_ctx() at > > main.c:534] DEBUG1: Accepting client command ... [in > > thread_manage_clients() at main.c:3826] DEBUG1: Wait for client > > response [in thread_manage_clients() at main.c:3863] DEBUG1: > > Receiving data from client ... [in thread_manage_clients() at > > main.c:3898] > > DEBUG1: Nothing > > recv() from client... continuing [in thread_manage_clients() at > > main.c:3902] DEBUG1: Clean command context structure [in > > clean_command_ctx() at main.c:534] DEBUG1: Accepting client command > > ... [in > > thread_manage_clients() at main.c:3826] DEBUG1: Wait for client > > response [in thread_manage_clients() at main.c:3863] DEBUG1: > > Receiving data from client ... [in thread_manage_clients() at > > main.c:3898] > > DEBUG1: Processing client command 16 [in process_client_msg() at > > main.c:3309] DEBUG1: Getting session sesCCC by name [in process_client_msg() at main.c:3364] DEBUG2: > > Trying to find session by name sesCCC [in session_find_by_name() at > > session.c:126] DEBUG1: Starting all UST traces [in > > ust_app_start_trace_all() at ust-app.c:2207] DEBUG1: Sending > > response > > (size: 16, retcode: Success) [in thread_manage_clients() at > > main.c:3936] > > DEBUG1: Clean command context structure [in clean_command_ctx() at > > main.c:534] DEBUG1: Accepting client command ... [in > > thread_manage_clients() at main.c:3826] > > ************************************************ > > > > > > > > > > > > Thanks in Advance, Pavan > > > > > > -----Original Message----- From: David Goulet > > [mailto:dgoulet at efficios.com] Sent: Tuesday, June 12, 2012 9:05 PM To: > > Pavan Anumula Cc: lttng-dev at lists.lttng.org Subject: Re: [lttng-dev] > > Lttng start failed > > > > Hi Pavan, > > > > The output below is normal and should be working fine. However, the > > problem is that you have _NO_ debug message after the "lttng start". > > That command should at least produce 10+ lines of messages after this last line: > > > > "DEBUG1: Accepting application registration [in > > thread_registration_apps() at main.c:1423]" > > > > Can you enlight me and tell me if by doing "lttng create newsessiom" > > and "lttng enable-event -a -k", you have output messages coming out > > of the session daemon in -vvv mode ? > > > > If NOT, you are talking to another daemon! A quick "ps faux | grep > > lttng-sessiond" could help clear that question. > > > > If only one daemon is running and stuck at the above debug message, > > the next step is to tell me on what the daemon is waiting on using > > either "strace -p" or "gdb" also. There is 6 threads so having the > > strace -p output for all of them would help me greatly. > > > > Thanks! David > > > > On 12/06/12 10:05 AM, Mathieu Desnoyers wrote: > >> * Pavan Anumula (pavan.anumula at sasken.com) wrote: > >>> Hi Mathieu, Still I am unable to start tracing, And I am facing > >>> the same start errors. Please kindly help me on this. This time I > >>> loaded the modules by modprobe( not with insmod as I did before), > >>> Then I run the command " arm-none-linux-gnueabi-lttng-sessiond > >>> -vvv " (before arm-none-linux-gnueabi-lttng-sessiond -d), > > > >> When using "arm-none-linux-gnueabi-lttng-sessiond -vvv", you > >> should _not_ run "arm-none-linux-gnueabi-lttng-sessiond -d". > > > > > >>> The below is the Output, And It got hanged overthere. > > > >> This is normal: the sessiond is waiting for applications to connect. > >> It does not hang, it just waits. > > > >> David, can you follow up on this issue ? It seems to be > >> sessiond-related. > > > >> Thanks, > > > >> Mathieu > > > > > >>> Later when I started lttng start I am acing the same erros below: > >>> root at arago:~/lttng-traces# arm-none-linux-gnueabi-lttng start LTTng: > >>> Failure to write metadata to buffers (timeout) Error: Starting > >>> kernel trace failed > >>> > >>> ****************************************************************** > >>> ** > >>> * > >>> *************************** > >>> > >>> > > DEBUG3: Creating LTTng run directory: /var/run/lttng [in > > create_lttng_rundir() at main.c:4315] > >>> DEBUG2: Kernel consumer err path: /var/run/lttng/kconsumerd/error > >>> [in > >>> main() at main.c:4543] DEBUG2: Kernel consumer cmd path: > >>> /var/run/lttng/kconsumerd/command [in main() at main.c:4545] DEBUG1: > >>> Client socket path /var/run/lttng/client-lttng-sessiond [in main() > >>> at main.c:4592] DEBUG1: Application socket path > >>> /var/run/lttng/apps-lttng-sessiond [in main() at main.c:4593] DEBUG1: > >>> LTTng run directory path: /var/run/lttng [in main() at > >>> main.c:4594] > >>> DEBUG2: UST consumer 32 bits err path: > >>> /var/run/lttng/ustconsumerd32/error [in main() at main.c:4603] DEBUG2: > >>> UST consumer 32 bits cmd path: > >>> /var/run/lttng/ustconsumerd32/command > >>> [in main() at main.c:4605] DEBUG2: UST consumer 64 bits err path: > >>> /var/run/lttng/ustconsumerd64/error [in main() at main.c:4614] DEBUG2: > >>> UST consumer 64 bits cmd path: > >>> /var/run/lttng/ustconsumerd64/command > >>> [in main() at main.c:4616] DEBUG3: Created hashtable size 4 at > >>> 0x4a080 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: > >>> Created hashtable size 4 at 0x4a168 of type 1 [in lttng_ht_new() > >>> at hashtable.c:96] DEBUG2: Creating consumer directory: > >>> /var/run/lttng/kconsumerd [in set_consumer_sockets() at > >>> main.c:4357] > >>> DEBUG1: Modprobe successfully lttng-tracer [in > >>> modprobe_lttng_control() at modprobe.c:163] DEBUG2: Kernel tracer > >>> version validated (major version 2) [in kernel_validate_version() at kernel.c:675] DEBUG1: > >>> Modprobe successfully lttng-ftrace [in modprobe_lttng_data() at > >>> modprobe.c:199] DEBUG1: Modprobe successfully lttng-kprobes [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-kretprobes [in modprobe_lttng_data() at modprobe.c:199] DEBUG1: > >>> Modprobe successfully lttng-lib-ring-buffer [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-ring-buffer-client-discard [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-ring-buffer-client-overwrite [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-ring-buffer-metadata-client [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-ring-buffer-client-mmap-discard [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-ring-buffer-client-mmap-overwrite [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-ring-buffer-metadata-mmap-client [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-probe-lttng [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-types [in modprobe_lttng_data() at modprobe.c:199] DEBUG1: > >>> Modprobe successfully lttng-probe-block [in modprobe_lttng_data() > >>> at modprobe.c:199] DEBUG1: Modprobe successfully lttng-probe-irq > >>> [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-probe-kvm [in modprobe_lttng_data() at modprobe.c:199] DEBUG1: > >>> Modprobe successfully lttng-probe-sched [in modprobe_lttng_data() > >>> at modprobe.c:199] DEBUG1: Modprobe successfully > >>> lttng-probe-signal [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>> successfully lttng-probe-statedump [in modprobe_lttng_data() at > >>> modprobe.c:199] > >>> DEBUG1: Modprobe successfully lttng-probe-timer [in > >>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Kernel tracer fd > >>> 6 [in > >>> init_kernel_tracer() at main.c:1887] DEBUG2: Creating consumer > >>> directory: /var/run/lttng/ustconsumerd64 [in > >>> set_consumer_sockets() at main.c:4357] DEBUG2: Creating consumer directory: > >>> /var/run/lttng/ustconsumerd32 [in set_consumer_sockets() at > >>> main.c:4357] DEBUG1: Signal handler set for SIGTERM, SIGPIPE and > >>> SIGINT [in set_signal_handler() at main.c:4449] DEBUG1: All > >>> permissions are set [in set_permissions() at main.c:4250] DEBUG1: > >>> poll set max size set to 65535 [in compat_poll_set_max_size() at compat-poll.c:196] DEBUG1: > >>> [thread] Manage application started [in thread_manage_apps() at > >>> main.c:1179] DEBUG1: fd 3 of 1 added to pollfd [in > >>> compat_poll_add() at compat-poll.c:91] DEBUG1: fd 13 of 2 added to > >>> pollfd [in > >>> compat_poll_add() at compat-poll.c:91] DEBUG1: Apps thread polling > >>> on 2 fds [in thread_manage_apps() at main.c:1200] DEBUG1: Thread > >>> manage kernel started [in thread_manage_kernel() at main.c:876] > >>> DEBUG1: fd 3 of 1 added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: > >>> fd 11 of 2 added to pollfd [in compat_poll_add() at > >>> compat-poll.c:91] > >>> DEBUG1: Updating kernel poll set [in update_kernel_poll() at > >>> main.c:748] DEBUG1: Thread kernel polling on 2 fds [in > >>> thread_manage_kernel() at main.c:905] DEBUG1: [thread] Manage > >>> application registration started [in thread_registration_apps() at > >>> main.c:1392] DEBUG1: fd 3 of 1 added to pollfd [in > >>> compat_poll_add() at compat-poll.c:91] DEBUG1: fd 10 of 2 added to > >>> pollfd [in > >>> compat_poll_add() at compat-poll.c:91] DEBUG1: Notifying > >>> applications of session daemon state: 1 [in notify_ust_apps() at > >>> main.c:687] > >>> DEBUG1: [thread] Dispatch UST command started [in > >>> thread_dispatch_ust_registration() at main.c:1324] DEBUG1: Futex n > >>> to 1 prepare done [in futex_nto1_prepare() at futex.c:73] DEBUG1: > >>> Woken up but nothing in the UST command queue [in > >>> thread_dispatch_ust_registration() at main.c:1334] DEBUG1: > >>> [thread] Manage client started [in thread_manage_clients() at > >>> main.c:3794] > >>> DEBUG1: fd 3 of 1 added to pollfd [in compat_poll_add() at > >>> compat-poll.c:91] DEBUG1: fd 9 of 2 added to pollfd [in > >>> compat_poll_add() at compat-poll.c:91] DEBUG1: Accepting client > >>> command ... [in thread_manage_clients() at main.c:3826] DEBUG1: > >>> Got the wait shm fd 15 [in get_wait_shm() at shm.c:117] DEBUG1: > >>> Futex wait update active 1 [in futex_wait_update() at futex.c:62] DEBUG1: > >>> Accepting application registration [in thread_registration_apps() > >>> at main.c:1423] > >>> ****************************************************************** > >>> ** > >>> * > >>> *********************************** > >>> > >>> > > Am I missing anything?? > >>> > >>> Thanks in Advance, Pavan > >>> > >>> > >>> ________________________________________ From: Mathieu Desnoyers > >>> [mathieu.desnoyers at efficios.com] Sent: Monday, June 11, 2012 7:24 > >>> PM > >>> To: Pavan Anumula Cc: lttng-dev at lists.lttng.org Subject: Re: > >>> [lttng-dev] Lttng start failed > >>> > >>> * Pavan Anumula (pavan.anumula at sasken.com) wrote: > >>>> Hi Mathieu, > >>>> > >>>> Please find the info below as per your comments > >>>> > >>>> > >>>> ########## Output of command > >>>> "arm-none-linux-gnueabi-lttng-sessiond > >>>> -vvv " , After loading the modules ####### > >>>> > >>>> DEBUG3: Creating LTTng run directory: /var/run/lttng [in > >>>> create_lttng_rundir() at main.c:4315] DEBUG2: Kernel consumer err > >>>> path: /var/run/lttng/kconsumerd/error [in main() at main.c:4543] > >>>> DEBUG2: Kernel consumer cmd path: > >>>> /var/run/lttng/kconsumerd/command [in main() at main.c:4545] > >>>> DEBUG1: Client socket path /var/run/lttng/client-lttng-sessiond > >>>> [in main() at main.c:4592] > >>>> DEBUG1: Application socket path > >>>> /var/run/lttng/apps-lttng-sessiond > >>>> [in main() at main.c:4593] DEBUG1: LTTng run directory path: > >>>> /var/run/lttng [in main() at main.c:4594] DEBUG2: UST consumer 32 > >>>> bits err path: /var/run/lttng/ustconsumerd32/error [in main() at > >>>> main.c:4603] DEBUG2: UST consumer 32 bits cmd path: > >>>> /var/run/lttng/ustconsumerd32/command [in main() at main.c:4605] > >>>> DEBUG2: UST consumer 64 bits err path: > >>>> /var/run/lttng/ustconsumerd64/error [in main() at main.c:4614] > >>>> DEBUG2: UST consumer 64 bits cmd path: > >>>> /var/run/lttng/ustconsumerd64/command [in main() at main.c:4616] > >>>> DEBUG3: Created hashtable size 4 at 0x4a080 of type 1 [in > >>>> lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size > >>>> 4 at > >>>> 0x4a168 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG2: > >>>> Creating consumer directory: /var/run/lttng/kconsumerd [in > >>>> set_consumer_sockets() at main.c:4357] FATAL: Module lttng_tracer > >>>> not found. Error: Unable to load module lttng-tracer > >>> > >>> Hrm. You want to do kernel tracing, but modprobe cannot find the > >>> lttng kernel tracer modules. You might want to run depmod -a or > >>> something like that on your target, and ensure that modprobe works properly. > >>> > >>> Thanks, > >>> > >>> Mathieu > >>> > >>>> DEBUG2: Kernel tracer version validated (major version 2) [in > >>>> kernel_validate_version() at kernel.c:675] DEBUG1: Modprobe > >>>> successfully lttng-ftrace [in modprobe_lttng_data() at > >>>> modprobe.c:199] DEBUG1: Modprobe successfully lttng-kprobes [in > >>>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>>> successfully lttng-kretprobes [in modprobe_lttng_data() at > >>>> modprobe.c:199] FATAL: Module lttng_lib_ring_buffer not found. Error: > >>>> Unable to load module lttng-lib-ring-buffer FATAL: Module > >>>> lttng_ring_buffer_client_discard not found. Error: Unable to load > >>>> module lttng-ring-buffer-client-discard FATAL: Module > >>>> lttng_ring_buffer_client_overwrite not found. Error: Unable to > >>>> load module lttng-ring-buffer-client-overwrite FATAL: Module > >>>> lttng_ring_buffer_metadata_client not found. Error: Unable to > >>>> load module lttng-ring-buffer-metadata-client FATAL: Module > >>>> lttng_ring_buffer_client_mmap_discard not found. Error: Unable to > >>>> load module lttng-ring-buffer-client-mmap-discard FATAL: Module > >>>> lttng_ring_buffer_client_mmap_overwrite not found. Error: Unable > >>>> to load module lttng-ring-buffer-client-mmap-overwrite FATAL: > >>>> Module lttng_ring_buffer_metadata_mmap_client not found. Error: > >>>> Unable to load module lttng-ring-buffer-metadata-mmap-client > >>>> FATAL: Module lttng_probe_lttng not found. Error: Unable to load > >>>> module lttng-probe-lttng DEBUG1: Modprobe successfully > >>>> lttng-types [in > >>>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>>> successfully lttng-probe-block [in modprobe_lttng_data() at > >>>> modprobe.c:199] DEBUG1: Modprobe successfully lttng-probe-irq [in > >>>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>>> successfully lttng-probe-kvm [in modprobe_lttng_data() at > >>>> modprobe.c:199] DEBUG1: Modprobe successfully lttng-probe-sched > >>>> [in > >>>> modprobe_lttng_data() at modprobe.c:199] DEBUG1: Modprobe > >>>> successfully lttng-probe-signal [in modprobe_lttng_data() at > >>>> modprobe.c:199] DEBUG1: Modprobe successfully > >>>> lttng-probe-statedump [in modprobe_lttng_data() at > >>>> modprobe.c:199] DEBUG1: Modprobe successfully lttng-probe-timer > >>>> [in modprobe_lttng_data() at modprobe.c:199] DEBUG1: Kernel > >>>> tracer fd 6 [in init_kernel_tracer() at main.c:1887] DEBUG2: Creating consumer directory: > >>>> /var/run/lttng/ustconsumerd64 [in set_consumer_sockets() at > >>>> main.c:4357] DEBUG2: Creating consumer directory: > >>>> /var/run/lttng/ustconsumerd32 [in set_consumer_sockets() at > >>>> main.c:4357] DEBUG1: Signal handler set for SIGTERM, SIGPIPE and > >>>> SIGINT [in set_signal_handler() at main.c:4449] DEBUG1: All > >>>> permissions are set [in set_permissions() at main.c:4250] DEBUG1: > >>>> poll set max size set to 65535 [in compat_poll_set_max_size() at > >>>> compat-poll.c:196] DEBUG1: [thread] Manage client started [in > >>>> thread_manage_clients() at main.c:3794] DEBUG1: fd 3 of 1 added > >>>> to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: fd 9 > >>>> of 2 added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: > >>>> Accepting client command ... [in thread_manage_clients() at > >>>> main.c:3826] DEBUG1: [thread] Dispatch UST command started [in > >>>> thread_dispatch_ust_registration() at main.c:1324] DEBUG1: Futex > >>>> n to > >>>> 1 prepare done [in futex_nto1_prepare() at futex.c:73] DEBUG1: > >>>> Woken up but nothing in the UST command queue [in > >>>> thread_dispatch_ust_registration() at main.c:1334] DEBUG1: Thread > >>>> manage kernel started [in thread_manage_kernel() at main.c:876] > >>>> DEBUG1: fd 3 of 1 added to pollfd [in compat_poll_add() at > >>>> compat-poll.c:91] DEBUG1: fd 11 of 2 added to pollfd [in > >>>> compat_poll_add() at compat-poll.c:91] DEBUG1: Updating kernel > >>>> poll set [in update_kernel_poll() at main.c:748] DEBUG1: Thread > >>>> kernel polling on 2 fds [in thread_manage_kernel() at main.c:905] DEBUG1: > >>>> [thread] Manage application started [in thread_manage_apps() at > >>>> main.c:1179] DEBUG1: fd 3 of 1 added to pollfd [in > >>>> compat_poll_add() at compat-poll.c:91] DEBUG1: fd 13 of 2 added > >>>> to pollfd [in > >>>> compat_poll_add() at compat-poll.c:91] DEBUG1: Apps thread > >>>> polling on > >>>> 2 fds [in thread_manage_apps() at main.c:1200] DEBUG1: [thread] > >>>> Manage application registration started [in > >>>> thread_registration_apps() at main.c:1392] DEBUG1: fd 3 of 1 > >>>> added to pollfd [in compat_poll_add() at compat-poll.c:91] > >>>> DEBUG1: fd 10 of 2 added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: > >>>> Notifying applications of session daemon state: 1 [in > >>>> notify_ust_apps() at main.c:687] DEBUG1: Got the wait shm fd 15 > >>>> [in > >>>> get_wait_shm() at shm.c:117] DEBUG1: Futex wait update active 1 > >>>> [in > >>>> futex_wait_update() at futex.c:62] DEBUG1: Accepting application > >>>> registration [in thread_registration_apps() at main.c:1423] > >>>> > >>>> > >>>> > >>>> #### Output of command "arm-none-linux-gnueabi-lttng-sessiond > >>>> -vvv " before loading the modules ############# > >>>> > >>>> DEBUG3: Creating LTTng run directory: /var/run/lttng [in > >>>> create_lttng_rundir() at main.c:4315] DEBUG2: Kernel consumer err > >>>> path: /var/run/lttng/kconsumerd/error [in main() at main.c:4543] > >>>> DEBUG2: Kernel consumer cmd path: > >>>> /var/run/lttng/kconsumerd/command [in main() at main.c:4545] > >>>> DEBUG1: Client socket path /var/run/lttng/client-lttng-sessiond > >>>> [in main() at main.c:4592] > >>>> DEBUG1: Application socket path > >>>> /var/run/lttng/apps-lttng-sessiond > >>>> [in main() at main.c:4593] DEBUG1: LTTng run directory path: > >>>> /var/run/lttng [in main() at main.c:4594] DEBUG2: UST consumer 32 > >>>> bits err path: /var/run/lttng/ustconsumerd32/error [in main() at > >>>> main.c:4603] DEBUG2: UST consumer 32 bits cmd path: > >>>> /var/run/lttng/ustconsumerd32/command [in main() at main.c:4605] > >>>> DEBUG2: UST consumer 64 bits err path: > >>>> /var/run/lttng/ustconsumerd64/error [in main() at main.c:4614] > >>>> DEBUG2: UST consumer 64 bits cmd path: > >>>> /var/run/lttng/ustconsumerd64/command [in main() at main.c:4616] > >>>> DEBUG3: Created hashtable size 4 at 0x4a080 of type 1 [in > >>>> lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size > >>>> 4 at > >>>> 0x4a168 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG2: > >>>> Creating consumer directory: /var/run/lttng/kconsumerd [in > >>>> set_consumer_sockets() at main.c:4357] FATAL: Module lttng_tracer > >>>> not found. Error: Unable to load module lttng-tracer DEBUG1: > >>>> Failed to open /proc/lttng [in init_kernel_tracer() at main.c:1871] Error: > >>>> Unable to remove module lttng-tracer Warning: No kernel tracer > >>>> available DEBUG2: Creating consumer directory: > >>>> /var/run/lttng/ustconsumerd64 [in set_consumer_sockets() at > >>>> main.c:4357] DEBUG2: Creating consumer directory: > >>>> /var/run/lttng/ustconsumerd32 [in set_consumer_sockets() at > >>>> main.c:4357] DEBUG1: Signal handler set for SIGTERM, SIGPIPE and > >>>> SIGINT [in set_signal_handler() at main.c:4449] DEBUG1: All > >>>> permissions are set [in set_permissions() at main.c:4250] DEBUG1: > >>>> poll set max size set to 65535 [in compat_poll_set_max_size() at > >>>> compat-poll.c:196] DEBUG1: [thread] Manage application started > >>>> [in > >>>> thread_manage_apps() at main.c:1179] DEBUG1: fd 3 of 1 added to > >>>> pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: fd 12 > >>>> of > >>>> 2 added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: > >>>> Apps thread polling on 2 fds [in thread_manage_apps() at > >>>> main.c:1200] > >>>> DEBUG1: Thread manage kernel started [in thread_manage_kernel() > >>>> at main.c:876] DEBUG1: fd 3 of 1 added to pollfd [in > >>>> compat_poll_add() at compat-poll.c:91] DEBUG1: fd 10 of 2 added > >>>> to pollfd [in > >>>> compat_poll_add() at compat-poll.c:91] DEBUG1: Updating kernel > >>>> poll set [in update_kernel_poll() at main.c:748] DEBUG1: Thread > >>>> kernel polling on 2 fds [in thread_manage_kernel() at main.c:905] DEBUG1: > >>>> [thread] Manage application registration started [in > >>>> thread_registration_apps() at main.c:1392] DEBUG1: fd 3 of 1 > >>>> added to pollfd [in compat_poll_add() at compat-poll.c:91] > >>>> DEBUG1: fd 9 of 2 added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: > >>>> Notifying applications of session daemon state: 1 [in > >>>> notify_ust_apps() at main.c:687] DEBUG1: [thread] Dispatch UST > >>>> command started [in thread_dispatch_ust_registration() at > >>>> main.c:1324] DEBUG1: Futex n to 1 prepare done [in > >>>> futex_nto1_prepare() at futex.c:73] DEBUG1: Woken up but nothing > >>>> in the UST command queue [in thread_dispatch_ust_registration() > >>>> at main.c:1334] DEBUG1: [thread] Manage client started [in > >>>> thread_manage_clients() at main.c:3794] DEBUG1: fd 3 of 1 added > >>>> to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: fd 8 > >>>> of 2 added to pollfd [in compat_poll_add() at compat-poll.c:91] DEBUG1: > >>>> Accepting client command ... [in thread_manage_clients() at > >>>> main.c:3826] DEBUG1: Got the wait shm fd 14 [in get_wait_shm() at > >>>> shm.c:117] DEBUG1: Futex wait update active 1 [in > >>>> futex_wait_update() at futex.c:62] DEBUG1: Accepting application > >>>> registration [in > >>>> thread_registration_apps() at main.c:1423] > >>>> > >>>> > >>>> Regards, Pavan > >>>> > >>>> -----Original Message----- From: Mathieu Desnoyers > >>>> [mailto:mathieu.desnoyers at efficios.com] Sent: Saturday, June 09, > >>>> 2012 6:03 PM To: Pavan Anumula Cc: lttng-dev at lists.lttng.org Subject: > >>>> Re: [lttng-dev] Lttng start failed > >>>> > >>>> * Pavan Anumula (pavan.anumula at sasken.com) wrote: > >>>>> Hi Mathue, > >>>>> > >>>>> Thanks for the quick reply, > >>>>> > >>>>> After inserting lttng modules , I had given the command > >>>>> "arm-none-linux-gnueabi-lttng-sessiond -vvv" as you said, Below > >>>>> is the output where there are error messages. Please help me in > >>>>> resolving the issue, SO that I can catch kernel and user traces. > >>>>> > >>>>> > >>>>> root at arago:/usr/lttng/modules# > >>>>> arm-none-linux-gnueabi-lttng-sessiond -d > >>>>> root at arago:/usr/lttng/modules# > >>>>> arm-none-linux-gnueabi-lttng-sessiond -vvv DEBUG3: Creating > >>>>> LTTng run directory: /var/run/lttng [in create_lttng_rundir() at > >>>>> main.c:4315] DEBUG2: Kernel consumer err path: > >>>>> /var/run/lttng/kconsumerd/error [in main() at main.c:4543] DEBUG2: > >>>>> Kernel consumer cmd path: /var/run/lttng/kconsumerd/command [in > >>>>> main() at main.c:4545] DEBUG1: Client socket path > >>>>> /var/run/lttng/client-lttng-sessiond [in main() at main.c:4592] > >>>>> DEBUG1: Application socket path > >>>>> /var/run/lttng/apps-lttng-sessiond > >>>>> [in main() at main.c:4593] DEBUG1: LTTng run directory path: > >>>>> /var/run/lttng [in main() at main.c:4594] DEBUG2: UST consumer > >>>>> 32 bits err path: /var/run/lttng/ustconsumerd32/error [in main() > >>>>> at main.c:4603] DEBUG2: UST consumer 32 bits cmd path: > >>>>> /var/run/lttng/ustconsumerd32/command [in main() at main.c:4605] > >>>>> DEBUG2: UST consumer 64 bits err path: > >>>>> /var/run/lttng/ustconsumerd64/error [in main() at main.c:4614] > >>>>> DEBUG2: UST consumer 64 bits cmd path: > >>>>> /var/run/lttng/ustconsumerd64/command [in main() at main.c:4616] > >>>>> Error: Already running daemon. > >>>> > >>>> Please kill the lttng-sessiond that is already started (the one > >>>> with -d). Instead of that one, run the sessiond with: > >>>> > >>>> lttng-sessiond -vvv > >>>> > >>>> (don't run lttng-sessiond -d before) > >>>> > >>>> Thanks, > >>>> > >>>> Mathieu > >>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> Thanks in advance, Pavan > >>>>> > >>>>> -----Original Message----- From: Mathieu Desnoyers > >>>>> [mailto:mathieu.desnoyers at efficios.com] Sent: Friday, June 08, > >>>>> 2012 11:12 PM To: Pavan Anumula Cc: lttng-dev at lists.lttng.org > >>>>> Subject: Re: [lttng-dev] Lttng start failed > >>>>> > >>>>> * Pavan Anumula (pavan.anumula at sasken.com) wrote: > >>>>>> Hi , > >>>>>> > >>>>>> I am new to LTTng usage, I am trying to use LTTng 2.0.1 and > >>>>>> LTTng-modules-2.0.2 for ARM(omapL138), with Linux kernel > >>>>>> 2.6.33 wit RT-29 patch on it. > >>>>>> > >>>>>> After enabling all the kernel events I am facing the below > >>>>>> errors. I loaded all the modules manually by insmod. > >>>>>> > >>>>>> > >>>>>> > >>>>>> root at arago:~/lttng-traces# arm-none-linux-gnueabi-lttng create > >>>>>> newsessiom Session newsessiom created. Traces will be written > >>>>>> in > >>>>>> /home/root/lttng-traces/newsessiom-20110325-154922 > >>>>>> > >>>>>> root at arago:~/lttng-traces# arm-none-linux-gnueabi-lttng > >>>>>> enable-event -a --kernel All kernel events are enabled in > >>>>>> channel > >>>>>> channel0 > >>>>>> > >>>>>> root at arago:~/lttng-traces# arm-none-linux-gnueabi-lttng start > >>>>>> LTTng: Failure to write metadata to buffers (timeout) Error: > >>>>>> Starting kernel trace failed > >>>>>> > >>>>>> Please kindly help me on this. > >>>>> > >>>>> I think you should look into the lttng-sessiond --help : > >>>>> > >>>>> --consumerd32-path PATH Specify path for the 32-bit UST > >>>>> consumer daemon binary --consumerd32-libdir PATH Specify path for > >>>>> the 32-bit UST consumer daemon libraries --consumerd64-path PATH > >>>>> Specify path for the 64-bit UST consumer daemon binary > >>>>> --consumerd64-libdir PATH Specify path for the 64-bit UST > >>>>> consumer daemon libraries > >>>>> > >>>>> options. My guess is that lttng-sessiond is not able to find the > >>>>> consumerd binary files, maybe due to a rename or because they > >>>>> have been moved after install. > >>>>> > >>>>> One more thing that might help is to launch the lttng-sessiond > >>>>> with "-vvv" : it will provide verbose output and let us know > >>>>> where things fall apart. > >>>>> > >>>>> Thanks, > >>>>> > >>>>> Mathieu > >>>>> > >>>>> > >>>>>> > >>>>>> > >>>>>> Thanks in advance, Pavan > >>>>>> > >>>>>> ________________________________ SASKEN BUSINESS DISCLAIMER: > >>>>>> This message may contain confidential, proprietary or legally > >>>>>> privileged information. In case you are not the original > >>>>>> intended Recipient of the message, you must not, directly or > >>>>>> indirectly, use, disclose, distribute, print, or copy any part > >>>>>> of this message and you are requested to delete it and inform the sender. > >>>>>> Any views expressed in this message are those of the individual > >>>>>> sender unless otherwise stated. Nothing contained in this > >>>>>> message shall be construed as an offer or acceptance of any > >>>>>> offer by Sasken Communication Technologies Limited ("Sasken") > >>>>>> unless sent with that express intent and with due authority of > >>>>>> Sasken. Sasken has taken enough precautions to prevent the spread of viruses. > >>>>>> However the company accepts no liability for any damage caused > >>>>>> by any virus transmitted by this email. Read Disclaimer at > >>>>>> http://www.sasken.com/extras/mail_disclaimer.html > >>>>> > >>>>>> _______________________________________________ lttng-dev > >>>>>> mailing list lttng-dev at lists.lttng.org > >>>>>> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > >>>>> > >>>>> > >>>>> -- Mathieu Desnoyers Operating System Efficiency R&D Consultant > >>>>> EfficiOS Inc. http://www.efficios.com > >>>> > >>>> -- Mathieu Desnoyers Operating System Efficiency R&D Consultant > >>>> EfficiOS Inc. http://www.efficios.com > >>> > >>> -- Mathieu Desnoyers Operating System Efficiency R&D Consultant > >>> EfficiOS Inc. http://www.efficios.com > > > > > > _______________________________________________ lttng-dev mailing > > list lttng-dev at lists.lttng.org > > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.12 (GNU/Linux) > > iQEcBAEBAgAGBQJP201YAAoJEELoaioR9I02a7AH/3sTHsbxRJ3z+//6+wPQu7GC > 6KIZxfBhhq4WSSZRJGHvD9O6QCHPgUmrYjR4leONB9//FfoWdzzRZb0IDErpJ3+L > B8I49nd7X2UHp1jf7CpbJUzrs1AQZa3K32D/nRlF3LceOGnvIpkKstur5msXvN5B > msGap8UQ8NsxkyCRW8cmPNt/Qm7lMsrg9zeP5VGEncj7dywIqaPfjz7MGFwNp4Vz > uxxBusAjnI50Kmx+ETYZmTiqEIPCV9rnpVK4T2LtZgX/+rh06gDkkvW6xy0wO7pf > ymZ0MytfvuKaHXmQnXyGvWhrodmn+D9E32DwyrcuhZa6K0ZPE5eDRbxUT5WGbuQ= > =VYvD > -----END PGP SIGNATURE----- > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From alexmonthy at voxpopuli.im Tue Jul 3 10:51:39 2012 From: alexmonthy at voxpopuli.im (Alexandre Montplaisir) Date: Tue, 03 Jul 2012 10:51:39 -0400 Subject: [lttng-dev] Displaying graphical results In-Reply-To: References: <4FC3CBF6.1060608@polymtl.ca> Message-ID: <4FF306FB.6060302@voxpopuli.im> On 12-07-02 02:42 PM, tchak adim wrote: > Hi all , > > does any new release of a viewer (supporting CTF format) of LTTng 2.0 has > been delivered ? > > Thanks. > Hi, Yes, TMF 1.0 was released last week as part of Eclipse Juno. You can get the installation instructions at http://lttng.org/eclipse . It's part of a pre-packaged version, so no need to install plugins manually anymore. Yannick would know more about the current status of LTTV. Cheers, Alexandre From thomas.petazzoni at free-electrons.com Wed Jul 4 03:38:21 2012 From: thomas.petazzoni at free-electrons.com (Thomas Petazzoni) Date: Wed, 4 Jul 2012 09:38:21 +0200 Subject: [lttng-dev] [PATCH] Expose kernel tracer to user-space (version 7) In-Reply-To: <1341322152-4380-1-git-send-email-francis.giraldeau@gmail.com> References: <1341322152-4380-1-git-send-email-francis.giraldeau@gmail.com> Message-ID: <20120704093821.35384043@skate> Hello, Le Tue, 3 Jul 2012 15:29:12 +0200, Francis Giraldeau a ?crit : > By writing to the file /proc/lttng_uevent, a user-space application creates a > kernel event. The event's payload is by default UTF-8 text, but any data can be > written. The maximum size of the data is at most the size of a packet defined > for the trace session. Null-character is optional and is not enforced. The > event uses sequence for space efficiency and to store any data as payload. Shouldn't this be in the debugfs filesystem rather than the proc filesystem? The debugfs filesystem already has entries for various tracing facilities of the Linux kernel, and adding entries in /proc that are not process-related is frowned upon these days. Best regards, Thomas -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com From bapi_mvit2004 at yahoo.com Wed Jul 4 04:09:46 2012 From: bapi_mvit2004 at yahoo.com (somanath sahoo) Date: Wed, 4 Jul 2012 01:09:46 -0700 (PDT) Subject: [lttng-dev] lttng_2.0-eclipse-juno : Connection to a Remote Host : Unable to list kernel events Message-ID: <1341389386.5657.YahooMailNeo@web140904.mail.bf1.yahoo.com> Hi, I am running eclipse c/c++ juno in ubuntu 12.04 which is running inside Virtualbox VM. Issue : Tree node of remote host is not being created in the cotrol view panel of eclipse while i am successfully connected to remote host (in this case my ubuntu 12.04). I am to trying use "lttng tracer control" feature of eclipse juno by following this link -- http://wiki.eclipse.org/index.php/Linux_Tools_Project/LTTng2/User_Guide#LTTng_Tracer_Control Error description : when eclipse is successfully connected to remote host, then eclipse is trying to run "lttng list -k" to listing the kernel event and its getting failed. ??? ??? ??? ??? ??? ??? ??? ? But whereas i am able to run lttng commands in my remote host (in ubuntu 12.04) successfully. The error message from eclipse is provided below - ---- List sessions failed Command failed! Command:? lttng list -k Return Value: 79 Error: Unable to list kernel events ------ I have attached screenshot of this error. please find the attachment. Please guide me to resolve this problem. Thanks & Regards, Somanath -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: eclipse-juno_Remote Host_lttng_Unable to list kernel events.png Type: image/png Size: 172079 bytes Desc: not available URL: From bhufmann at gmail.com Wed Jul 4 08:48:01 2012 From: bhufmann at gmail.com (Bernd Hufmann) Date: Wed, 4 Jul 2012 08:48:01 -0400 Subject: [lttng-dev] lttng_2.0-eclipse-juno : Connection to a Remote Host : Unable to list kernel events In-Reply-To: <1341389386.5657.YahooMailNeo@web140904.mail.bf1.yahoo.com> References: <1341389386.5657.YahooMailNeo@web140904.mail.bf1.yahoo.com> Message-ID: Hi, to be able to trace the kernel the global session daemon has to be running, that means it has to be running as root. To start the global session daemon login to your node and then execute sudo lttng list -k Then you are able to trace the kernel and UST using your user login. However you have to make sure that your user id is part of the user group tracing. Once this is setup the tracer control with Eclipse should work, too. Best Regards Bernd On 2012-07-04 4:10 AM, "somanath sahoo" wrote: > Hi, > > I am running eclipse c/c++ juno in ubuntu 12.04 which is running inside > Virtualbox VM. > > > Issue : Tree node of remote host is not being created in the cotrol view > panel of eclipse while i am successfully connected to remote host (in this > case my ubuntu 12.04). > > I am to trying use "lttng tracer control" feature of eclipse juno by > following this link -- > http://wiki.eclipse.org/index.php/Linux_Tools_Project/LTTng2/User_Guide#LTTng_Tracer_Control > > Error description : when eclipse is successfully connected to remote host, > then eclipse is trying to run "lttng list -k" to listing the kernel event > and its getting failed. > But whereas i am able to run lttng commands > in my remote host (in ubuntu 12.04) successfully. > > The error message from eclipse is provided below - > > ---- > List sessions failed > Command failed! Command: lttng list -k > Return Value: 79 > Error: Unable to list kernel events > > ------ > I have attached screenshot of this error. please find the attachment. > > Please guide me to resolve this problem. > > > Thanks & Regards, > Somanath > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu.desnoyers at efficios.com Wed Jul 4 12:10:09 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Wed, 4 Jul 2012 12:10:09 -0400 Subject: [lttng-dev] [RFC PATCH lttng-tools] Fix mmap for large subbuffers and handle EINTR Message-ID: <20120704161009.GA27758@Krystal> With large subbuffer (packet) size, if write() returns before copying the entire packet for mmap buffers, the consumerd restarts the write infinitely, which is not good at all. This affects both lttng-ust (in default mmap mode) and lttng-kernel (but only for mmap buffers, which is not the default). This issue would show up with large subbuffer size. We need to handle this case, as well as EINTR errors (which need to restart write). Also fixing the return value of mmap read functions, which were returning the amount of data written by the last invocation of write() rather than the total number of bytes written. splice use had the same issue. Also now consider a write() that returns more bytes than requested as an error. Moreover, assigning error = ret after failed splice and write was a mistake: error is holding the actual error value. ret just holds -1. This needs testing. Feedback is welcome. Signed-off-by: Mathieu Desnoyers --- diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c index bbc31f8..eca710d 100644 --- a/src/common/kernel-consumer/kernel-consumer.c +++ b/src/common/kernel-consumer/kernel-consumer.c @@ -49,7 +49,7 @@ ssize_t lttng_kconsumer_on_read_subbuffer_mmap( struct lttng_consumer_stream *stream, unsigned long len) { unsigned long mmap_offset; - ssize_t ret = 0; + ssize_t ret = 0, written = 0; off_t orig_offset = stream->out_fd_offset; int fd = stream->wait_fd; int outfd = stream->out_fd; @@ -64,25 +64,34 @@ ssize_t lttng_kconsumer_on_read_subbuffer_mmap( while (len > 0) { ret = write(outfd, stream->mmap_base + mmap_offset, len); - if (ret >= len) { - len = 0; - } else if (ret < 0) { - errno = -ret; + if (ret < 0) { + if (errno == EINTR) { + /* restart the interrupted system call */ + continue; + } else { + perror("Error in file write"); + if (written == 0) { + written = ret; + } + goto end; + } + } else if (ret > len) { perror("Error in file write"); + written += ret; goto end; + } else { + len -= ret; + mmap_offset += ret; } /* This won't block, but will start writeout asynchronously */ lttng_sync_file_range(outfd, stream->out_fd_offset, ret, SYNC_FILE_RANGE_WRITE); stream->out_fd_offset += ret; + written += ret; } - lttng_consumer_sync_trace_file(stream, orig_offset); - - goto end; - end: - return ret; + return written; } /* @@ -94,7 +103,7 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( struct lttng_consumer_local_data *ctx, struct lttng_consumer_stream *stream, unsigned long len) { - ssize_t ret = 0; + ssize_t ret = 0, written = 0; loff_t offset = 0; off_t orig_offset = stream->out_fd_offset; int fd = stream->wait_fd; @@ -107,8 +116,11 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( SPLICE_F_MOVE | SPLICE_F_MORE); DBG("splice chan to pipe ret %zd", ret); if (ret < 0) { - errno = -ret; perror("Error in relay splice"); + if (written == 0) { + written = ret; + } + ret = errno; goto splice_error; } @@ -116,8 +128,18 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( SPLICE_F_MOVE | SPLICE_F_MORE); DBG("splice pipe to file %zd", ret); if (ret < 0) { - errno = -ret; perror("Error in file splice"); + if (written == 0) { + written = ret; + } + ret = errno; + goto splice_error; + } + if (ret > len) { + errno = EINVAL; + perror("Wrote more data than requested"); + written += ret; + ret = errno; goto splice_error; } len -= ret; @@ -125,6 +147,7 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( lttng_sync_file_range(outfd, stream->out_fd_offset, ret, SYNC_FILE_RANGE_WRITE); stream->out_fd_offset += ret; + written += ret; } lttng_consumer_sync_trace_file(stream, orig_offset); @@ -132,7 +155,7 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( splice_error: /* send the appropriate error description to sessiond */ - switch(ret) { + switch (ret) { case EBADF: lttng_consumer_send_error(ctx, CONSUMERD_SPLICE_EBADF); break; @@ -148,7 +171,7 @@ splice_error: } end: - return ret; + return written; } /* @@ -351,13 +374,14 @@ ssize_t lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream *stream, /* splice the subbuffer to the tracefile */ ret = lttng_consumer_on_read_subbuffer_splice(ctx, stream, len); - if (ret < 0) { + if (ret != len) { /* * display the error but continue processing to try * to release the subbuffer */ ERR("Error splicing to tracefile"); } + break; case LTTNG_EVENT_MMAP: /* read the used subbuffer size */ @@ -369,7 +393,7 @@ ssize_t lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream *stream, } /* write the subbuffer to the tracefile */ ret = lttng_consumer_on_read_subbuffer_mmap(ctx, stream, len); - if (ret < 0) { + if (ret != len) { /* * display the error but continue processing to try * to release the subbuffer diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index 2b55fd4..4db39d8 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -49,7 +49,7 @@ ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( struct lttng_consumer_stream *stream, unsigned long len) { unsigned long mmap_offset; - long ret = 0; + long ret = 0, written = 0; off_t orig_offset = stream->out_fd_offset; int outfd = stream->out_fd; @@ -63,25 +63,34 @@ ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( } while (len > 0) { ret = write(outfd, stream->mmap_base + mmap_offset, len); - if (ret >= len) { - len = 0; - } else if (ret < 0) { - errno = -ret; - PERROR("Error in file write"); + if (ret < 0) { + if (errno == EINTR) { + /* restart the interrupted system call */ + continue; + } else { + perror("Error in file write"); + if (written == 0) { + written = ret; + } + goto end; + } + } else if (ret > len) { + perror("Error in file write"); + written += ret; goto end; + } else { + len -= ret; + mmap_offset += ret; } /* This won't block, but will start writeout asynchronously */ lttng_sync_file_range(outfd, stream->out_fd_offset, ret, SYNC_FILE_RANGE_WRITE); stream->out_fd_offset += ret; + written += ret; } - lttng_consumer_sync_trace_file(stream, orig_offset); - - goto end; - end: - return ret; + return written; } /* @@ -384,7 +393,7 @@ int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, assert(err == 0); /* write the subbuffer to the tracefile */ ret = lttng_consumer_on_read_subbuffer_mmap(ctx, stream, len); - if (ret < 0) { + if (ret != len) { /* * display the error but continue processing to try * to release the subbuffer -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From yannick.brosseau at gmail.com Wed Jul 4 16:37:42 2012 From: yannick.brosseau at gmail.com (Yannick Brosseau) Date: Wed, 04 Jul 2012 16:37:42 -0400 Subject: [lttng-dev] [babeltrace] FTS does not support large files on 32-bit In-Reply-To: <20120630185335.GA31235@Krystal> References: <20120630185335.GA31235@Krystal> Message-ID: <4FF4A996.8040606@gmail.com> On 2012-06-30 14:53, Mathieu Desnoyers wrote: > Hi Yannick, > > The babeltrace commit: > > We should therefore go back to FTW to support large files on 32-bit. Is > there any reason why we moved from ftw to fts ? > FTS does not use callbacks, which makes it easier to use. Also since it was supposed to be part of the babeltrace API, not having to manage a callbacks looked better. Might had other reasons at the time, but now I don't see any more. Yannick From bapi_mvit2004 at yahoo.com Thu Jul 5 01:45:27 2012 From: bapi_mvit2004 at yahoo.com (somanath sahoo) Date: Wed, 4 Jul 2012 22:45:27 -0700 (PDT) Subject: [lttng-dev] lttng_2.0-eclipse-juno : Connection to a Remote Host : Unable to list kernel events In-Reply-To: References: <1341389386.5657.YahooMailNeo@web140904.mail.bf1.yahoo.com> Message-ID: <1341467127.80260.YahooMailNeo@web140905.mail.bf1.yahoo.com> Hi Bernd, Thanks for your response. I did follow the procedure as you mentioned. Still the same problem is persistent. after the eclipse failed in "lttng list -k" ,? i did? "ps -ef | grep lttng " in my remote host (ubuntu 12.04). Log is provided below --- root?????? 558???? 1? 0 10:31 ???????? 00:00:00 lttng-sessiond somanath? 2949???? 1? 4 10:49 ???????? 00:00:30 /home/somanath/lttng_som/eclipse/eclipse somanath? 3242???? 1? 0 10:50 ???????? 00:00:00 lttng-sessiond --sig-parent --quiet somanath? 3539? 3251? 0 11:00 pts/3??? 00:00:00 grep --color=auto lttng --- but i am able to execute all the lttng features in the remote host successfully. i don't know why eclipse is not able to do that. However i want to know how to make sure my user id present in the tracing group ? is there any command to list or include the users into the "tracing" group ? please enlightened on this. Kindly let me know whether i need to follow something else to resolve this eclipse tracing control problem. Thanks for your need-fullness. Best Regards, Somanath ________________________________ From: Bernd Hufmann To: somanath sahoo Cc: "lttng-dev at lists.lttng.org" Sent: Wednesday, July 4, 2012 6:18 PM Subject: Re: [lttng-dev] lttng_2.0-eclipse-juno : Connection to a Remote Host : Unable to list kernel events Hi, to be able to trace the kernel the global session daemon has to be running, that means it has to be running as root. To start the global session daemon login to your node and then execute sudo lttng list -k Then you are able to trace the kernel and UST using your user login. However you have to make sure that your user id is part of the user group tracing. Once this is setup the tracer control with Eclipse should work, too. Best Regards Bernd On 2012-07-04 4:10 AM, "somanath sahoo" wrote: Hi, > > >I am running eclipse c/c++ juno in ubuntu 12.04 which is running inside VirtualboxVM. > > > > > >Issue : Tree node of remote host is not being created in the cotrol view panel of eclipse while i am successfully connected to remote host (in this case my ubuntu 12.04). > > > >I am to trying use "lttng tracer control" feature of eclipse juno by following this link -- http://wiki.eclipse.org/index.php/Linux_Tools_Project/LTTng2/User_Guide#LTTng_Tracer_Control > > >Error description : when eclipse is successfully connected to remote host, then eclipse is trying to run "lttng list -k" to listing the kernel event and its getting failed. >??? ??? ??? ??? ??? ??? ??? ? But whereas i am able to run lttng commands in my remote host (in ubuntu 12.04) successfully. > > >The error message from eclipse is provided below - > > > >---- > >List sessions failed >Command failed! Command:? lttng list -k >Return Value: 79 >Error: Unable to list kernel events > > >------ > >I have attached screenshot of this error. please find the attachment. > > >Please guide me to resolve this problem. > > > > >Thanks & Regards, >Somanath > >_______________________________________________ >lttng-dev mailing list >lttng-dev at lists.lttng.org >http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ddompe at gmail.com Thu Jul 5 10:15:12 2012 From: ddompe at gmail.com (Diego Dompe) Date: Thu, 5 Jul 2012 08:15:12 -0600 Subject: [lttng-dev] Questions about CTF format Message-ID: Hi, I'm developing a custom tracer for an embedded product that will generate CTF format. I was able to generate generic traces that can be interpreted properly with babeltrace (but not with eclipse, I already file a bug for that), but I found the CTF specification lacking in some aspects (I had to peek into lttng-generated CTF traces to figure out some details). I was wondering what is the proper mailing list to clear my questions and provide feedback on the CTF specification for improvement in the areas where the documentation is not detailed yet. I don't see any CTF-specific mailing list, it's OK to discuss it here? Or maybe directly with a developer(s)? Regards, Diego -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu.desnoyers at efficios.com Thu Jul 5 10:20:52 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 5 Jul 2012 10:20:52 -0400 Subject: [lttng-dev] Questions about CTF format In-Reply-To: References: Message-ID: <20120705142052.GA23162@Krystal> * Diego Dompe (ddompe at gmail.com) wrote: > Hi, > > I'm developing a custom tracer for an embedded product that will generate > CTF format. I was able to generate generic traces that can be interpreted > properly with babeltrace (but not with eclipse, I already file a bug for > that), but I found the CTF specification lacking in some aspects (I had to > peek into lttng-generated CTF traces to figure out some details). I was > wondering what is the proper mailing list to clear my questions and provide > feedback on the CTF specification for improvement in the areas where the > documentation is not detailed yet. I don't see any CTF-specific mailing > list, it's OK to discuss it here? Or maybe directly with a developer(s)? Hi Diego, Yes, this mailing list would be the proper place, along maybe with adding the MCA tiwg mailing list in CC, which I'm doing here. Thanks, Mathieu -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From alexmonthy at voxpopuli.im Thu Jul 5 10:29:37 2012 From: alexmonthy at voxpopuli.im (Alexandre Montplaisir) Date: Thu, 05 Jul 2012 10:29:37 -0400 Subject: [lttng-dev] lttng_2.0-eclipse-juno : Connection to a Remote Host : Unable to list kernel events In-Reply-To: <1341467127.80260.YahooMailNeo@web140905.mail.bf1.yahoo.com> References: <1341389386.5657.YahooMailNeo@web140904.mail.bf1.yahoo.com> <1341467127.80260.YahooMailNeo@web140905.mail.bf1.yahoo.com> Message-ID: <4FF5A4D1.7080708@voxpopuli.im> On 12-07-05 01:45 AM, somanath sahoo wrote: > However i want to know how to make sure my user id present in the tracing group ? is there any command to list or include the users into the "tracing" group ? please enlightened on this. You can use $ cat /etc/group | grep tracing It will list the users that are in the tracing group. Cheers, Alex From ddompe at gmail.com Thu Jul 5 10:49:57 2012 From: ddompe at gmail.com (Diego Dompe) Date: Thu, 5 Jul 2012 08:49:57 -0600 Subject: [lttng-dev] Questions about CTF format In-Reply-To: <20120705142052.GA23162@Krystal> References: <20120705142052.GA23162@Krystal> Message-ID: Hi Mathieu, Thanks for the help. Here is my list of details: - Clocks: the spec doesn't explain properly that timestamps are an offset from the base time of the clock they refer to. Since I was using 64bit timestamps I somehow assumed that I was using absolute timestamps from the epoch (although the spec doesn't says it either). - I saw that the lttng-generated traces for metadata are always a multiple of 4k in size (at least the ones I generate for either kernel or user space). I can't find where in the spec it mentions requirements regarding metadata packet padding. I was generating metadata packets that ended up right after my TSDL and eclipse wasn't happy about it (although I didn't try babeltrace). Also I found that the lttng-generated traces have a "empty" metadata packet after the metadata containing the TSDL, I didn't find either any documentation regarding this. Regards, Diego On Thu, Jul 5, 2012 at 8:20 AM, Mathieu Desnoyers < mathieu.desnoyers at efficios.com> wrote: > * Diego Dompe (ddompe at gmail.com) wrote: > > Hi, > > > > I'm developing a custom tracer for an embedded product that will generate > > CTF format. I was able to generate generic traces that can be interpreted > > properly with babeltrace (but not with eclipse, I already file a bug for > > that), but I found the CTF specification lacking in some aspects (I had > to > > peek into lttng-generated CTF traces to figure out some details). I was > > wondering what is the proper mailing list to clear my questions and > provide > > feedback on the CTF specification for improvement in the areas where the > > documentation is not detailed yet. I don't see any CTF-specific mailing > > list, it's OK to discuss it here? Or maybe directly with a developer(s)? > > Hi Diego, > > Yes, this mailing list would be the proper place, along maybe with > adding the MCA tiwg mailing list in CC, which I'm doing here. > > Thanks, > > Mathieu > > -- > Mathieu Desnoyers > Operating System Efficiency R&D Consultant > EfficiOS Inc. > http://www.efficios.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dgoulet at efficios.com Thu Jul 5 10:57:37 2012 From: dgoulet at efficios.com (David Goulet) Date: Thu, 05 Jul 2012 10:57:37 -0400 Subject: [lttng-dev] [RFC PATCH lttng-tools] Fix mmap for large subbuffers and handle EINTR In-Reply-To: <20120704161009.GA27758@Krystal> References: <20120704161009.GA27758@Krystal> Message-ID: <4FF5AB61.4040205@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Comments below. On 04/07/12 12:10 PM, Mathieu Desnoyers wrote: > With large subbuffer (packet) size, if write() returns before copying the > entire packet for mmap buffers, the consumerd restarts the write > infinitely, which is not good at all. > > This affects both lttng-ust (in default mmap mode) and lttng-kernel (but > only for mmap buffers, which is not the default). > > This issue would show up with large subbuffer size. > > We need to handle this case, as well as EINTR errors (which need to restart > write). > > Also fixing the return value of mmap read functions, which were returning > the amount of data written by the last invocation of write() rather than > the total number of bytes written. splice use had the same issue. > > Also now consider a write() that returns more bytes than requested as an > error. > > Moreover, assigning error = ret after failed splice and write was a > mistake: error is holding the actual error value. ret just holds -1. > > This needs testing. Feedback is welcome. > > Signed-off-by: Mathieu Desnoyers --- diff > --git a/src/common/kernel-consumer/kernel-consumer.c > b/src/common/kernel-consumer/kernel-consumer.c index bbc31f8..eca710d > 100644 --- a/src/common/kernel-consumer/kernel-consumer.c +++ > b/src/common/kernel-consumer/kernel-consumer.c @@ -49,7 +49,7 @@ ssize_t > lttng_kconsumer_on_read_subbuffer_mmap( struct lttng_consumer_stream > *stream, unsigned long len) { unsigned long mmap_offset; - ssize_t ret = > 0; + ssize_t ret = 0, written = 0; off_t orig_offset = > stream->out_fd_offset; int fd = stream->wait_fd; int outfd = > stream->out_fd; @@ -64,25 +64,34 @@ ssize_t > lttng_kconsumer_on_read_subbuffer_mmap( Just before going into the while() loop, there is a call to kernctl_get_mmap_read_offset() and, on failure, it goes to the "end:" label without setting "written" to a negative value. > > while (len > 0) { ret = write(outfd, stream->mmap_base + mmap_offset, > len); - if (ret >= len) { - len = 0; - } else if (ret < 0) { - errno > = -ret; + if (ret < 0) { + if (errno == EINTR) { + /* restart the > interrupted system call */ + continue; + } else { + perror("Error > in file write"); + if (written == 0) { + written = ret; + } + > goto end; + } + } else if (ret > len) { perror("Error in file write"); + > written += ret; goto end; I'm not sure this case is very useful... write() can not possibly return more than "len" (the size_t count argument). If it does, I'm pretty sure the whole Linux system will not go very well... hehe. The same applies for splice(), checking is ret > len is basically safe guarding the syscall which I don't think is necessary. However, according to the man page write(2), a return value of 0 coupled with a regular file can return an error status: If count is zero and fd refers to a regular file, then write() may return a failure status if one of the errors below is detected. If no errors are detected, 0 will be returned without causing any other effect. If count is zero and fd refers to a file other than a regular file, the results are not specified. We might want to add a zero/errno check instead. For testing, I can tell you that this patch fixes mmap network streaming (soon to be merged upstream) where the old code did not worked. Cheers! David > + } else { + len -= ret; + mmap_offset += ret; } /* This won't block, > but will start writeout asynchronously */ lttng_sync_file_range(outfd, > stream->out_fd_offset, ret, SYNC_FILE_RANGE_WRITE); stream->out_fd_offset > += ret; + written += ret; } - lttng_consumer_sync_trace_file(stream, > orig_offset); - - goto end; - end: - return ret; + return written; } > > /* @@ -94,7 +103,7 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( > struct lttng_consumer_local_data *ctx, struct lttng_consumer_stream > *stream, unsigned long len) { - ssize_t ret = 0; + ssize_t ret = 0, written > = 0; loff_t offset = 0; off_t orig_offset = stream->out_fd_offset; int fd = > stream->wait_fd; @@ -107,8 +116,11 @@ ssize_t > lttng_kconsumer_on_read_subbuffer_splice( SPLICE_F_MOVE | SPLICE_F_MORE); > DBG("splice chan to pipe ret %zd", ret); if (ret < 0) { - errno = -ret; > perror("Error in relay splice"); + if (written == 0) { + written = > ret; + } + ret = errno; goto splice_error; } > > @@ -116,8 +128,18 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( > SPLICE_F_MOVE | SPLICE_F_MORE); DBG("splice pipe to file %zd", ret); if > (ret < 0) { - errno = -ret; perror("Error in file splice"); + if > (written == 0) { + written = ret; + } + ret = errno; + goto > splice_error; + } + if (ret > len) { + errno = EINVAL; + > perror("Wrote more data than requested"); + written += ret; + ret = > errno; goto splice_error; } len -= ret; @@ -125,6 +147,7 @@ ssize_t > lttng_kconsumer_on_read_subbuffer_splice( lttng_sync_file_range(outfd, > stream->out_fd_offset, ret, SYNC_FILE_RANGE_WRITE); stream->out_fd_offset > += ret; + written += ret; } lttng_consumer_sync_trace_file(stream, > orig_offset); > > @@ -132,7 +155,7 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( > > splice_error: /* send the appropriate error description to sessiond */ - > switch(ret) { + switch (ret) { case EBADF: lttng_consumer_send_error(ctx, > CONSUMERD_SPLICE_EBADF); break; @@ -148,7 +171,7 @@ splice_error: } > > end: - return ret; + return written; } > > /* @@ -351,13 +374,14 @@ ssize_t lttng_kconsumer_read_subbuffer(struct > lttng_consumer_stream *stream, > > /* splice the subbuffer to the tracefile */ ret = > lttng_consumer_on_read_subbuffer_splice(ctx, stream, len); - if (ret < 0) > { + if (ret != len) { /* * display the error but continue processing to > try * to release the subbuffer */ ERR("Error splicing to tracefile"); } + > break; case LTTNG_EVENT_MMAP: /* read the used subbuffer size */ @@ -369,7 > +393,7 @@ ssize_t lttng_kconsumer_read_subbuffer(struct > lttng_consumer_stream *stream, } /* write the subbuffer to the tracefile > */ ret = lttng_consumer_on_read_subbuffer_mmap(ctx, stream, len); - if > (ret < 0) { + if (ret != len) { /* * display the error but continue > processing to try * to release the subbuffer diff --git > a/src/common/ust-consumer/ust-consumer.c > b/src/common/ust-consumer/ust-consumer.c index 2b55fd4..4db39d8 100644 --- > a/src/common/ust-consumer/ust-consumer.c +++ > b/src/common/ust-consumer/ust-consumer.c @@ -49,7 +49,7 @@ ssize_t > lttng_ustconsumer_on_read_subbuffer_mmap( struct lttng_consumer_stream > *stream, unsigned long len) { unsigned long mmap_offset; - long ret = 0; + > long ret = 0, written = 0; off_t orig_offset = stream->out_fd_offset; int > outfd = stream->out_fd; > > @@ -63,25 +63,34 @@ ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( } > while (len > 0) { ret = write(outfd, stream->mmap_base + mmap_offset, > len); - if (ret >= len) { - len = 0; - } else if (ret < 0) { - errno > = -ret; - PERROR("Error in file write"); + if (ret < 0) { + if (errno > == EINTR) { + /* restart the interrupted system call */ + continue; + > } else { + perror("Error in file write"); + if (written == 0) { + > written = ret; + } + goto end; + } + } else if (ret > len) { + > perror("Error in file write"); + written += ret; goto end; + } else { + > len -= ret; + mmap_offset += ret; } /* This won't block, but will start > writeout asynchronously */ lttng_sync_file_range(outfd, > stream->out_fd_offset, ret, SYNC_FILE_RANGE_WRITE); stream->out_fd_offset > += ret; + written += ret; } - lttng_consumer_sync_trace_file(stream, > orig_offset); - - goto end; - end: - return ret; + return written; } > > /* @@ -384,7 +393,7 @@ int lttng_ustconsumer_read_subbuffer(struct > lttng_consumer_stream *stream, assert(err == 0); /* write the subbuffer to > the tracefile */ ret = lttng_consumer_on_read_subbuffer_mmap(ctx, stream, > len); - if (ret < 0) { + if (ret != len) { /* * display the error but > continue processing to try * to release the subbuffer > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAEBAgAGBQJP9atdAAoJEELoaioR9I02l5wIAJe5VXr47vnXZoaxJWLHFeYs 4DT4HGLrZmPEUbyhrywQvtn86qNwiAfwFMHGEQ9P7xAxriLsSiFA0doQ6KzifXGn gfGGvwQJvEFxvCFh0EPjBVoneJ0hzMz0rLw97VoF0J03RKeLoDWHa36kai9fWOoO Ku42fxBPFTgqBZsDgqRUJpdudBkvqvCMpOQI27MEJ4E2vCg/G24Q83OhHfc9NUuO UtVsiAzPiXp3wKL882ly+r8lQpDKXkAdOfZszKROTNtMCf/Yo2QGKpKB4RMAGdQG uVSDgba7Ih/WmUbz5WUJ5FLmqC9UrGyKtKHgG6oJ+ebNdEbOafBydLNQ/00a/OY= =cS6M -----END PGP SIGNATURE----- From bapi_mvit2004 at yahoo.com Fri Jul 6 05:29:21 2012 From: bapi_mvit2004 at yahoo.com (somanath sahoo) Date: Fri, 6 Jul 2012 02:29:21 -0700 (PDT) Subject: [lttng-dev] lttng_2.0-eclipse-juno : Connection to a Remote Host : Unable to list kernel events In-Reply-To: <4FF5A4D1.7080708@voxpopuli.im> References: <1341389386.5657.YahooMailNeo@web140904.mail.bf1.yahoo.com> <1341467127.80260.YahooMailNeo@web140905.mail.bf1.yahoo.com> <4FF5A4D1.7080708@voxpopuli.im> Message-ID: <1341566961.89582.YahooMailNeo@web140903.mail.bf1.yahoo.com> Hi Alex, your reponse is much more appeciated. my user id was not present in tracing group in /etc/group. Now eclipse-remote-control is working great after addition of my user id into the tracing group. Thanks. Warm Regards, Somanath ________________________________ From: Alexandre Montplaisir To: somanath sahoo Cc: "lttng-dev at lists.lttng.org" Sent: Thursday, July 5, 2012 7:59 PM Subject: Re: [lttng-dev] lttng_2.0-eclipse-juno : Connection to a Remote Host : Unable to list kernel events On 12-07-05 01:45 AM, somanath sahoo wrote: > However i want to know how to make sure my user id present in the tracing group ? is there any command to list or include the users into the "tracing" group ? please enlightened on this. You can use $ cat /etc/group | grep tracing It will list the users that are in the tracing group. Cheers, Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu.desnoyers at efficios.com Fri Jul 6 09:31:29 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 6 Jul 2012 09:31:29 -0400 Subject: [lttng-dev] [RFC PATCH lttng-tools] Fix mmap for large subbuffers and handle EINTR In-Reply-To: <4FF5AB61.4040205@efficios.com> References: <20120704161009.GA27758@Krystal> <4FF5AB61.4040205@efficios.com> Message-ID: <20120706133129.GA16033@Krystal> * David Goulet (dgoulet at efficios.com) wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Comments below. > > On 04/07/12 12:10 PM, Mathieu Desnoyers wrote: > > With large subbuffer (packet) size, if write() returns before copying the > > entire packet for mmap buffers, the consumerd restarts the write > > infinitely, which is not good at all. > > > > This affects both lttng-ust (in default mmap mode) and lttng-kernel (but > > only for mmap buffers, which is not the default). > > > > This issue would show up with large subbuffer size. > > > > We need to handle this case, as well as EINTR errors (which need to restart > > write). > > > > Also fixing the return value of mmap read functions, which were returning > > the amount of data written by the last invocation of write() rather than > > the total number of bytes written. splice use had the same issue. > > > > Also now consider a write() that returns more bytes than requested as an > > error. > > > > Moreover, assigning error = ret after failed splice and write was a > > mistake: error is holding the actual error value. ret just holds -1. > > > > This needs testing. Feedback is welcome. > > > > Signed-off-by: Mathieu Desnoyers --- diff > > --git a/src/common/kernel-consumer/kernel-consumer.c > > b/src/common/kernel-consumer/kernel-consumer.c index bbc31f8..eca710d > > 100644 --- a/src/common/kernel-consumer/kernel-consumer.c +++ > > b/src/common/kernel-consumer/kernel-consumer.c @@ -49,7 +49,7 @@ ssize_t > > lttng_kconsumer_on_read_subbuffer_mmap( struct lttng_consumer_stream > > *stream, unsigned long len) { unsigned long mmap_offset; - ssize_t ret = > > 0; + ssize_t ret = 0, written = 0; off_t orig_offset = > > stream->out_fd_offset; int fd = stream->wait_fd; int outfd = > > stream->out_fd; @@ -64,25 +64,34 @@ ssize_t > > lttng_kconsumer_on_read_subbuffer_mmap( > > Just before going into the while() loop, there is a call to > kernctl_get_mmap_read_offset() and, on failure, it goes to the "end:" label > without setting "written" to a negative value. OK, fixed. > > > > > while (len > 0) { ret = write(outfd, stream->mmap_base + mmap_offset, > > len); - if (ret >= len) { - len = 0; - } else if (ret < 0) { - errno > > = -ret; + if (ret < 0) { + if (errno == EINTR) { + /* restart the > > interrupted system call */ + continue; + } else { + perror("Error > > in file write"); + if (written == 0) { + written = ret; + } + > > goto end; + } + } else if (ret > len) { perror("Error in file write"); + > > written += ret; goto end; > > I'm not sure this case is very useful... write() can not possibly return more > than "len" (the size_t count argument). If it does, I'm pretty sure the whole > Linux system will not go very well... hehe. The same applies for splice(), > checking is ret > len is basically safe guarding the syscall which I don't > think is necessary. Better safe than sorry ;) Especially for splice(), given that we implement our own splice actor, it's better to check for even the assumed kernel behavior. > > However, according to the man page write(2), a return value of 0 coupled with > a regular file can return an error status: > > If count is zero and fd refers to a regular file, then write() may > return a failure status if one of the errors below is detected. If no > errors are detected, 0 will be returned without causing any other > effect. If count is zero and fd refers to a file other than a regular > file, the results are not specified. > > We might want to add a zero/errno check instead. Done. > > For testing, I can tell you that this patch fixes mmap network streaming (soon > to be merged upstream) where the old code did not worked. Great! Will post the updated version in a jiffy. Thanks, Mathieu -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Fri Jul 6 09:35:40 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 6 Jul 2012 09:35:40 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Fix mmap write() for large subbuffers and handle EINTR Message-ID: <20120706133539.GB16033@Krystal> With large subbuffer (packet) size, if write() returns before copying the entire packet for mmap buffers, the consumerd restarts the write infinitely, which is not good at all. This affects both lttng-ust (in default mmap mode) and lttng-kernel (but only for mmap buffers, which is not the default). This issue would show up with large subbuffer size. We need to handle this case, as well as EINTR errors (which need to restart write). Also fixing the return value of mmap read functions, which were returning the amount of data written by the last invocation of write() rather than the total number of bytes written. splice use had the same issue. Also now consider a write() that returns more bytes than requested as an error. Moreover, assigning error = ret after failed splice and write was a mistake: error is holding the actual error value. ret just holds -1. Signed-off-by: Mathieu Desnoyers --- diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c index bbc31f8..739e06d 100644 --- a/src/common/kernel-consumer/kernel-consumer.c +++ b/src/common/kernel-consumer/kernel-consumer.c @@ -49,7 +49,7 @@ ssize_t lttng_kconsumer_on_read_subbuffer_mmap( struct lttng_consumer_stream *stream, unsigned long len) { unsigned long mmap_offset; - ssize_t ret = 0; + ssize_t ret = 0, written = 0; off_t orig_offset = stream->out_fd_offset; int fd = stream->wait_fd; int outfd = stream->out_fd; @@ -59,30 +59,40 @@ ssize_t lttng_kconsumer_on_read_subbuffer_mmap( if (ret != 0) { errno = -ret; perror("kernctl_get_mmap_read_offset"); + written = ret; goto end; } while (len > 0) { ret = write(outfd, stream->mmap_base + mmap_offset, len); - if (ret >= len) { - len = 0; - } else if (ret < 0) { - errno = -ret; + if (ret <= 0) { + if (errno == EINTR) { + /* restart the interrupted system call */ + continue; + } else { + perror("Error in file write"); + if (written == 0) { + written = ret; + } + goto end; + } + } else if (ret > len) { perror("Error in file write"); + written += ret; goto end; + } else { + len -= ret; + mmap_offset += ret; } /* This won't block, but will start writeout asynchronously */ lttng_sync_file_range(outfd, stream->out_fd_offset, ret, SYNC_FILE_RANGE_WRITE); stream->out_fd_offset += ret; + written += ret; } - lttng_consumer_sync_trace_file(stream, orig_offset); - - goto end; - end: - return ret; + return written; } /* @@ -94,7 +104,7 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( struct lttng_consumer_local_data *ctx, struct lttng_consumer_stream *stream, unsigned long len) { - ssize_t ret = 0; + ssize_t ret = 0, written = 0; loff_t offset = 0; off_t orig_offset = stream->out_fd_offset; int fd = stream->wait_fd; @@ -107,8 +117,11 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( SPLICE_F_MOVE | SPLICE_F_MORE); DBG("splice chan to pipe ret %zd", ret); if (ret < 0) { - errno = -ret; perror("Error in relay splice"); + if (written == 0) { + written = ret; + } + ret = errno; goto splice_error; } @@ -116,8 +129,18 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( SPLICE_F_MOVE | SPLICE_F_MORE); DBG("splice pipe to file %zd", ret); if (ret < 0) { - errno = -ret; perror("Error in file splice"); + if (written == 0) { + written = ret; + } + ret = errno; + goto splice_error; + } + if (ret > len) { + errno = EINVAL; + perror("Wrote more data than requested"); + written += ret; + ret = errno; goto splice_error; } len -= ret; @@ -125,6 +148,7 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( lttng_sync_file_range(outfd, stream->out_fd_offset, ret, SYNC_FILE_RANGE_WRITE); stream->out_fd_offset += ret; + written += ret; } lttng_consumer_sync_trace_file(stream, orig_offset); @@ -132,7 +156,7 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( splice_error: /* send the appropriate error description to sessiond */ - switch(ret) { + switch (ret) { case EBADF: lttng_consumer_send_error(ctx, CONSUMERD_SPLICE_EBADF); break; @@ -148,7 +172,7 @@ splice_error: } end: - return ret; + return written; } /* @@ -351,13 +375,14 @@ ssize_t lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream *stream, /* splice the subbuffer to the tracefile */ ret = lttng_consumer_on_read_subbuffer_splice(ctx, stream, len); - if (ret < 0) { + if (ret != len) { /* * display the error but continue processing to try * to release the subbuffer */ ERR("Error splicing to tracefile"); } + break; case LTTNG_EVENT_MMAP: /* read the used subbuffer size */ @@ -369,7 +394,7 @@ ssize_t lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream *stream, } /* write the subbuffer to the tracefile */ ret = lttng_consumer_on_read_subbuffer_mmap(ctx, stream, len); - if (ret < 0) { + if (ret != len) { /* * display the error but continue processing to try * to release the subbuffer diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index 2b55fd4..a29eb58 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -49,7 +49,7 @@ ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( struct lttng_consumer_stream *stream, unsigned long len) { unsigned long mmap_offset; - long ret = 0; + long ret = 0, written = 0; off_t orig_offset = stream->out_fd_offset; int outfd = stream->out_fd; @@ -59,29 +59,39 @@ ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( if (ret != 0) { errno = -ret; PERROR("ustctl_get_mmap_read_offset"); + written = ret; goto end; } while (len > 0) { ret = write(outfd, stream->mmap_base + mmap_offset, len); - if (ret >= len) { - len = 0; - } else if (ret < 0) { - errno = -ret; - PERROR("Error in file write"); + if (ret <= 0) { + if (errno == EINTR) { + /* restart the interrupted system call */ + continue; + } else { + perror("Error in file write"); + if (written == 0) { + written = ret; + } + goto end; + } + } else if (ret > len) { + perror("Error in file write"); + written += ret; goto end; + } else { + len -= ret; + mmap_offset += ret; } /* This won't block, but will start writeout asynchronously */ lttng_sync_file_range(outfd, stream->out_fd_offset, ret, SYNC_FILE_RANGE_WRITE); stream->out_fd_offset += ret; + written += ret; } - lttng_consumer_sync_trace_file(stream, orig_offset); - - goto end; - end: - return ret; + return written; } /* @@ -384,7 +394,7 @@ int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, assert(err == 0); /* write the subbuffer to the tracefile */ ret = lttng_consumer_on_read_subbuffer_mmap(ctx, stream, len); - if (ret < 0) { + if (ret != len) { /* * display the error but continue processing to try * to release the subbuffer -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Fri Jul 6 09:51:57 2012 From: dgoulet at efficios.com (David Goulet) Date: Fri, 06 Jul 2012 09:51:57 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Fix mmap write() for large subbuffers and handle EINTR In-Reply-To: <20120706133539.GB16033@Krystal> References: <20120706133539.GB16033@Krystal> Message-ID: <4FF6ED7D.9050308@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Mathieu Desnoyers: > With large subbuffer (packet) size, if write() returns before > copying the entire packet for mmap buffers, the consumerd restarts > the write infinitely, which is not good at all. > > This affects both lttng-ust (in default mmap mode) and lttng-kernel > (but only for mmap buffers, which is not the default). > > This issue would show up with large subbuffer size. > > We need to handle this case, as well as EINTR errors (which need to > restart write). > > Also fixing the return value of mmap read functions, which were > returning the amount of data written by the last invocation of > write() rather than the total number of bytes written. splice use > had the same issue. > > Also now consider a write() that returns more bytes than requested > as an error. > > Moreover, assigning error = ret after failed splice and write was > a mistake: error is holding the actual error value. ret just holds > -1. > > Signed-off-by: Mathieu Desnoyers > --- diff --git a/src/common/kernel-consumer/kernel-consumer.c > b/src/common/kernel-consumer/kernel-consumer.c index > bbc31f8..739e06d 100644 --- > a/src/common/kernel-consumer/kernel-consumer.c +++ > b/src/common/kernel-consumer/kernel-consumer.c @@ -49,7 +49,7 @@ > ssize_t lttng_kconsumer_on_read_subbuffer_mmap( struct > lttng_consumer_stream *stream, unsigned long len) { unsigned long > mmap_offset; - ssize_t ret = 0; + ssize_t ret = 0, written = 0; > off_t orig_offset = stream->out_fd_offset; int fd = > stream->wait_fd; int outfd = stream->out_fd; @@ -59,30 +59,40 @@ > ssize_t lttng_kconsumer_on_read_subbuffer_mmap( if (ret != 0) { > errno = -ret; perror("kernctl_get_mmap_read_offset"); + written = > ret; goto end; } > > while (len > 0) { ret = write(outfd, stream->mmap_base + > mmap_offset, len); - if (ret >= len) { - len = 0; - } else if > (ret < 0) { - errno = -ret; + if (ret <= 0) { + if (errno == > EINTR) { + /* restart the interrupted system call */ + > continue; + } else { + perror("Error in file write"); + if > (written == 0) { + written = ret; + } + goto end; + } Hmmm, write() of 0 _may_ be an error or not. Here it seems we are simply considering it an error and ending the loop. Idem for ust-consumer.c Small note while you are at it, can you use PERROR instead of perror() :). Here for you Mathieu :D :%s/perror/PERROR/g The rest seems very good on my side. Just tell me if you want me to integrate it in master and stable. Cheers! David > + } else if (ret > len) { perror("Error in file write"); + > written += ret; goto end; + } else { + len -= ret; + > mmap_offset += ret; } /* This won't block, but will start writeout > asynchronously */ lttng_sync_file_range(outfd, > stream->out_fd_offset, ret, SYNC_FILE_RANGE_WRITE); > stream->out_fd_offset += ret; + written += ret; } - > lttng_consumer_sync_trace_file(stream, orig_offset); - - goto end; > - end: - return ret; + return written; } > > /* @@ -94,7 +104,7 @@ ssize_t > lttng_kconsumer_on_read_subbuffer_splice( struct > lttng_consumer_local_data *ctx, struct lttng_consumer_stream > *stream, unsigned long len) { - ssize_t ret = 0; + ssize_t ret = 0, > written = 0; loff_t offset = 0; off_t orig_offset = > stream->out_fd_offset; int fd = stream->wait_fd; @@ -107,8 +117,11 > @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( SPLICE_F_MOVE > | SPLICE_F_MORE); DBG("splice chan to pipe ret %zd", ret); if (ret > < 0) { - errno = -ret; perror("Error in relay splice"); + if > (written == 0) { + written = ret; + } + ret = errno; goto > splice_error; } > > @@ -116,8 +129,18 @@ ssize_t > lttng_kconsumer_on_read_subbuffer_splice( SPLICE_F_MOVE | > SPLICE_F_MORE); DBG("splice pipe to file %zd", ret); if (ret < 0) > { - errno = -ret; perror("Error in file splice"); + if (written > == 0) { + written = ret; + } + ret = errno; + goto > splice_error; + } + if (ret > len) { + errno = EINVAL; + > perror("Wrote more data than requested"); + written += ret; + > ret = errno; goto splice_error; } len -= ret; @@ -125,6 +148,7 @@ > ssize_t lttng_kconsumer_on_read_subbuffer_splice( > lttng_sync_file_range(outfd, stream->out_fd_offset, ret, > SYNC_FILE_RANGE_WRITE); stream->out_fd_offset += ret; + written += > ret; } lttng_consumer_sync_trace_file(stream, orig_offset); > > @@ -132,7 +156,7 @@ ssize_t > lttng_kconsumer_on_read_subbuffer_splice( > > splice_error: /* send the appropriate error description to sessiond > */ - switch(ret) { + switch (ret) { case EBADF: > lttng_consumer_send_error(ctx, CONSUMERD_SPLICE_EBADF); break; @@ > -148,7 +172,7 @@ splice_error: } > > end: - return ret; + return written; } > > /* @@ -351,13 +375,14 @@ ssize_t > lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream > *stream, > > /* splice the subbuffer to the tracefile */ ret = > lttng_consumer_on_read_subbuffer_splice(ctx, stream, len); - if > (ret < 0) { + if (ret != len) { /* * display the error but > continue processing to try * to release the subbuffer */ ERR("Error > splicing to tracefile"); } + break; case LTTNG_EVENT_MMAP: /* read > the used subbuffer size */ @@ -369,7 +394,7 @@ ssize_t > lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream > *stream, } /* write the subbuffer to the tracefile */ ret = > lttng_consumer_on_read_subbuffer_mmap(ctx, stream, len); - if > (ret < 0) { + if (ret != len) { /* * display the error but > continue processing to try * to release the subbuffer diff --git > a/src/common/ust-consumer/ust-consumer.c > b/src/common/ust-consumer/ust-consumer.c index 2b55fd4..a29eb58 > 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ > b/src/common/ust-consumer/ust-consumer.c @@ -49,7 +49,7 @@ ssize_t > lttng_ustconsumer_on_read_subbuffer_mmap( struct > lttng_consumer_stream *stream, unsigned long len) { unsigned long > mmap_offset; - long ret = 0; + long ret = 0, written = 0; off_t > orig_offset = stream->out_fd_offset; int outfd = stream->out_fd; > > @@ -59,29 +59,39 @@ ssize_t > lttng_ustconsumer_on_read_subbuffer_mmap( if (ret != 0) { errno = > -ret; PERROR("ustctl_get_mmap_read_offset"); + written = ret; goto > end; } while (len > 0) { ret = write(outfd, stream->mmap_base + > mmap_offset, len); - if (ret >= len) { - len = 0; - } else if > (ret < 0) { - errno = -ret; - PERROR("Error in file write"); + > if (ret <= 0) { + if (errno == EINTR) { + /* restart the > interrupted system call */ + continue; + } else { + > perror("Error in file write"); + if (written == 0) { + > written = ret; + } + goto end; + } + } else if (ret > len) > { + perror("Error in file write"); + written += ret; goto end; > + } else { + len -= ret; + mmap_offset += ret; } /* This won't > block, but will start writeout asynchronously */ > lttng_sync_file_range(outfd, stream->out_fd_offset, ret, > SYNC_FILE_RANGE_WRITE); stream->out_fd_offset += ret; + written += > ret; } - lttng_consumer_sync_trace_file(stream, orig_offset); - - > goto end; - end: - return ret; + return written; } > > /* @@ -384,7 +394,7 @@ int lttng_ustconsumer_read_subbuffer(struct > lttng_consumer_stream *stream, assert(err == 0); /* write the > subbuffer to the tracefile */ ret = > lttng_consumer_on_read_subbuffer_mmap(ctx, stream, len); - if (ret > < 0) { + if (ret != len) { /* * display the error but continue > processing to try * to release the subbuffer -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJP9u16AAoJEELoaioR9I02NQQH/014q8Mz0+aNb14fWJf7UtCI 6R2pNLDGNsDEeyqxbHUu2iBVrnncVTbxp19/vZOtGZ7Gm0s4irHca63uZ24ad9pQ gj4Dl2mmv5VVJOV+23LPlvdFb0LzaV6HbZV4II8E+PBrQ563SElDOF1HvfGUKqIb uwwuZoUU2z6dQaK5fmgOU1nXLZjVUqVNq1me2dRAN/k25flTDw0iDnwxvLk12yE4 kjSSwAvsLWap5P2ElY/Oes1r/8eZUmmjKF6B1RnQ+ImbSRY16tKy3UaqzYfHb0ku S/lKP74ya3q13OuJapVWRWmHS/8bQ4OWYNyZScGN1/kJIDCySdoeBJbNLoYJ8g4= =MjwS -----END PGP SIGNATURE----- From mathieu.desnoyers at efficios.com Fri Jul 6 10:13:05 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 6 Jul 2012 10:13:05 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Fix mmap write() for large subbuffers and handle EINTR (v2) Message-ID: <20120706141305.GA16494@Krystal> With large subbuffer (packet) size, if write() returns before copying the entire packet for mmap buffers, the consumerd restarts the write infinitely, which is not good at all. This affects both lttng-ust (in default mmap mode) and lttng-kernel (but only for mmap buffers, which is not the default). This issue would show up with large subbuffer size. We need to handle this case, as well as EINTR errors (which need to restart write). Also fixing the return value of mmap read functions, which were returning the amount of data written by the last invocation of write() rather than the total number of bytes written. splice use had the same issue. Also now consider a write() that returns more bytes than requested as an error. Moreover, assigning error = ret after failed splice and write was a mistake: error is holding the actual error value. ret just holds -1. Signed-off-by: Mathieu Desnoyers --- diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c index bbc31f8..3c96873 100644 --- a/src/common/kernel-consumer/kernel-consumer.c +++ b/src/common/kernel-consumer/kernel-consumer.c @@ -49,7 +49,7 @@ ssize_t lttng_kconsumer_on_read_subbuffer_mmap( struct lttng_consumer_stream *stream, unsigned long len) { unsigned long mmap_offset; - ssize_t ret = 0; + ssize_t ret = 0, written = 0; off_t orig_offset = stream->out_fd_offset; int fd = stream->wait_fd; int outfd = stream->out_fd; @@ -59,30 +59,40 @@ ssize_t lttng_kconsumer_on_read_subbuffer_mmap( if (ret != 0) { errno = -ret; perror("kernctl_get_mmap_read_offset"); + written = ret; goto end; } while (len > 0) { ret = write(outfd, stream->mmap_base + mmap_offset, len); - if (ret >= len) { - len = 0; - } else if (ret < 0) { - errno = -ret; + if (ret < 0) { + if (errno == EINTR) { + /* restart the interrupted system call */ + continue; + } else { + perror("Error in file write"); + if (written == 0) { + written = ret; + } + goto end; + } + } else if (ret > len) { perror("Error in file write"); + written += ret; goto end; + } else { + len -= ret; + mmap_offset += ret; } /* This won't block, but will start writeout asynchronously */ lttng_sync_file_range(outfd, stream->out_fd_offset, ret, SYNC_FILE_RANGE_WRITE); stream->out_fd_offset += ret; + written += ret; } - lttng_consumer_sync_trace_file(stream, orig_offset); - - goto end; - end: - return ret; + return written; } /* @@ -94,7 +104,7 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( struct lttng_consumer_local_data *ctx, struct lttng_consumer_stream *stream, unsigned long len) { - ssize_t ret = 0; + ssize_t ret = 0, written = 0; loff_t offset = 0; off_t orig_offset = stream->out_fd_offset; int fd = stream->wait_fd; @@ -107,8 +117,11 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( SPLICE_F_MOVE | SPLICE_F_MORE); DBG("splice chan to pipe ret %zd", ret); if (ret < 0) { - errno = -ret; perror("Error in relay splice"); + if (written == 0) { + written = ret; + } + ret = errno; goto splice_error; } @@ -116,8 +129,18 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( SPLICE_F_MOVE | SPLICE_F_MORE); DBG("splice pipe to file %zd", ret); if (ret < 0) { - errno = -ret; perror("Error in file splice"); + if (written == 0) { + written = ret; + } + ret = errno; + goto splice_error; + } + if (ret > len) { + errno = EINVAL; + perror("Wrote more data than requested"); + written += ret; + ret = errno; goto splice_error; } len -= ret; @@ -125,6 +148,7 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( lttng_sync_file_range(outfd, stream->out_fd_offset, ret, SYNC_FILE_RANGE_WRITE); stream->out_fd_offset += ret; + written += ret; } lttng_consumer_sync_trace_file(stream, orig_offset); @@ -132,7 +156,7 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( splice_error: /* send the appropriate error description to sessiond */ - switch(ret) { + switch (ret) { case EBADF: lttng_consumer_send_error(ctx, CONSUMERD_SPLICE_EBADF); break; @@ -148,7 +172,7 @@ splice_error: } end: - return ret; + return written; } /* @@ -351,13 +375,14 @@ ssize_t lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream *stream, /* splice the subbuffer to the tracefile */ ret = lttng_consumer_on_read_subbuffer_splice(ctx, stream, len); - if (ret < 0) { + if (ret != len) { /* * display the error but continue processing to try * to release the subbuffer */ ERR("Error splicing to tracefile"); } + break; case LTTNG_EVENT_MMAP: /* read the used subbuffer size */ @@ -369,7 +394,7 @@ ssize_t lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream *stream, } /* write the subbuffer to the tracefile */ ret = lttng_consumer_on_read_subbuffer_mmap(ctx, stream, len); - if (ret < 0) { + if (ret != len) { /* * display the error but continue processing to try * to release the subbuffer diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index 2b55fd4..47c0d46 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -49,7 +49,7 @@ ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( struct lttng_consumer_stream *stream, unsigned long len) { unsigned long mmap_offset; - long ret = 0; + long ret = 0, written = 0; off_t orig_offset = stream->out_fd_offset; int outfd = stream->out_fd; @@ -59,29 +59,39 @@ ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( if (ret != 0) { errno = -ret; PERROR("ustctl_get_mmap_read_offset"); + written = ret; goto end; } while (len > 0) { ret = write(outfd, stream->mmap_base + mmap_offset, len); - if (ret >= len) { - len = 0; - } else if (ret < 0) { - errno = -ret; + if (ret < 0) { + if (errno == EINTR) { + /* restart the interrupted system call */ + continue; + } else { + PERROR("Error in file write"); + if (written == 0) { + written = ret; + } + goto end; + } + } else if (ret > len) { PERROR("Error in file write"); + written += ret; goto end; + } else { + len -= ret; + mmap_offset += ret; } /* This won't block, but will start writeout asynchronously */ lttng_sync_file_range(outfd, stream->out_fd_offset, ret, SYNC_FILE_RANGE_WRITE); stream->out_fd_offset += ret; + written += ret; } - lttng_consumer_sync_trace_file(stream, orig_offset); - - goto end; - end: - return ret; + return written; } /* @@ -384,7 +394,7 @@ int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, assert(err == 0); /* write the subbuffer to the tracefile */ ret = lttng_consumer_on_read_subbuffer_mmap(ctx, stream, len); - if (ret < 0) { + if (ret != len) { /* * display the error but continue processing to try * to release the subbuffer -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From bapi_mvit2004 at yahoo.com Mon Jul 9 07:37:36 2012 From: bapi_mvit2004 at yahoo.com (somanath sahoo) Date: Mon, 9 Jul 2012 04:37:36 -0700 (PDT) Subject: [lttng-dev] [video/audio link query] lttng2.0 presesntation at con foo 2012 Message-ID: <1341833856.69448.YahooMailNeo@web140905.mail.bf1.yahoo.com> Hi, Does anyone have the audio or video link for this lttng2.0 presesntation at con foo 2012. The presentation link is given below link -- http://www.dorsal.polymtl.ca/blog/yannick-brosseau/presenting-lttng-20-confoo-web-techno-conference I dont find any video or audio link of this above presentation. Please let me know if anyone have any knowledge on this or any lttng2.0 related video or audio link. Any help will be appreciated. Best Regards, Somanath -------------- next part -------------- An HTML attachment was scrubbed... URL: From Fredrik_Oestman at mentor.com Mon Jul 9 08:00:46 2012 From: Fredrik_Oestman at mentor.com (Oestman, Fredrik) Date: Mon, 9 Jul 2012 12:00:46 +0000 Subject: [lttng-dev] LTTng-UST 2.0 mutex usage Message-ID: <524C960C5DFC794E82BE548D825F05CF2834A6E5@EU-MBX-01.mgc.mentorg.com> Hi, We're experimenting with tracing calls to the pthreads library using a LD_PRELOAD-ed interposer library, which is instrumented with UST tracepoints. In the startup phase, before the application has been called, probes are being registered, and one by one the tracepoints start emitting events. So some of the pthreads mutex motions of UST itself are being traced along. What would be a good way of avoiding emitting events before the application itself has started, specifically events related to UST mutexes? The ust-ctl library appears to have a function ustctl_register_done(), is that useful? (Is there an API documentation?) Or would it be better to find out which mutexes belong to UST and filter them out? By controlling our interposer library from within the application we can avoid the problem, but we'd rather do without recompiling the application, since it sort of would defeat the reason for using LD_PRELOAD in the first place. Cheers, Fredrik ?stman From yannick.brosseau at gmail.com Mon Jul 9 09:09:03 2012 From: yannick.brosseau at gmail.com (Yannick Brosseau) Date: Mon, 09 Jul 2012 09:09:03 -0400 Subject: [lttng-dev] [video/audio link query] lttng2.0 presesntation at con foo 2012 In-Reply-To: <1341833856.69448.YahooMailNeo@web140905.mail.bf1.yahoo.com> References: <1341833856.69448.YahooMailNeo@web140905.mail.bf1.yahoo.com> Message-ID: <4FFAD7EF.901@gmail.com> On 2012-07-09 07:37, somanath sahoo wrote: > Hi, > > Does anyone have the audio or video link for this lttng2.0 > presesntation at con foo 2012. The presentation link is given below > > link -- > http://www.dorsal.polymtl.ca/blog/yannick-brosseau/presenting-lttng-20-confoo-web-techno-conference > > > I dont find any video or audio link of this above presentation. > > Please let me know if anyone have any knowledge on this or any > lttng2.0 related video or audio link. > > Any help will be appreciated. > Hi, I am sorry, but there was no video or audio recording of this conference. I don't think we have any video of a LTTng 2.0 presentation. Yannick -------------- next part -------------- An HTML attachment was scrubbed... URL: From bapi_mvit2004 at yahoo.com Mon Jul 9 11:08:37 2012 From: bapi_mvit2004 at yahoo.com (somanath sahoo) Date: Mon, 9 Jul 2012 08:08:37 -0700 (PDT) Subject: [lttng-dev] [video/audio link query] lttng2.0 presesntation at con foo 2012 In-Reply-To: <4FFAD7EF.901@gmail.com> References: <1341833856.69448.YahooMailNeo@web140905.mail.bf1.yahoo.com> <4FFAD7EF.901@gmail.com> Message-ID: <1341846517.28869.YahooMailNeo@web140901.mail.bf1.yahoo.com> Hi, > > >Does anyone have the audio or video link for this lttng2.0 presesntation at con foo 2012. The presentation link is given below > > > >link -- http://www.dorsal.polymtl.ca/blog/yannick-brosseau/presenting-lttng-20-confoo-web-techno-conference > > > > >I dont find any video or audio link of this above presentation. > > > >Please let me know if anyone have any knowledge on this or any lttng2.0 related video or audio link. > > >Any help will be appreciated. > > Hi, I am sorry, but there was no video or audio recording of this conference. I don't think we have any video of a LTTng 2.0 presentation. Hi Yannick, Thanks for your response. I have the pdf version of that presentation. As it was very nicely done, i was just curious to watch the video version. Best Regards, Somanath -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu.desnoyers at efficios.com Mon Jul 9 20:09:31 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 9 Jul 2012 20:09:31 -0400 Subject: [lttng-dev] [RFC PATCH lttng-tools] kernel consumer should empty the input splice pipe Message-ID: <20120710000931.GA28343@Krystal> When the splice pipe output cannot push all the data placed into the pipe by the first splice call, we should continue writing data out to the output file descriptor until we reach the amount of data that was placed into the pipe. This is probably the cause of the network streaming issues currently encountered. Testing is welcome. Signed-off-by: Mathieu Desnoyers --- diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c index bbc31f8..cc16f9f 100644 --- a/src/common/kernel-consumer/kernel-consumer.c +++ b/src/common/kernel-consumer/kernel-consumer.c @@ -101,6 +101,8 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( int outfd = stream->out_fd; while (len > 0) { + ssize_t tosplice; + DBG("splice chan to pipe offset %lu (fd : %d)", (unsigned long)offset, fd); ret = splice(fd, &offset, ctx->consumer_thread_pipe[1], NULL, len, @@ -111,20 +113,28 @@ ssize_t lttng_kconsumer_on_read_subbuffer_splice( perror("Error in relay splice"); goto splice_error; } - - ret = splice(ctx->consumer_thread_pipe[0], NULL, outfd, NULL, ret, - SPLICE_F_MOVE | SPLICE_F_MORE); - DBG("splice pipe to file %zd", ret); - if (ret < 0) { - errno = -ret; - perror("Error in file splice"); - goto splice_error; + tosplice = ret; + len -= tosplice; + + while (tosplice > 0) { + ret = splice(ctx->consumer_thread_pipe[0], NULL, outfd, + NULL, tosplice, + SPLICE_F_MOVE | SPLICE_F_MORE); + DBG("splice pipe to file %zd", ret); + if (ret < 0) { + errno = -ret; + perror("Error in file splice"); + goto splice_error; + } + tosplice -= ret; + /* + * This won't block, but will start writeout + * asynchronously. + */ + lttng_sync_file_range(outfd, stream->out_fd_offset, ret, + SYNC_FILE_RANGE_WRITE); + stream->out_fd_offset += ret; } - len -= ret; - /* This won't block, but will start writeout asynchronously */ - lttng_sync_file_range(outfd, stream->out_fd_offset, ret, - SYNC_FILE_RANGE_WRITE); - stream->out_fd_offset += ret; } lttng_consumer_sync_trace_file(stream, orig_offset); -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From zheng.chang at emc.com Tue Jul 10 04:06:48 2012 From: zheng.chang at emc.com (changz) Date: Tue, 10 Jul 2012 16:06:48 +0800 Subject: [lttng-dev] Question: multiple cft_integer for one argument? Message-ID: <4FFBE298.2070205@emc.com> Hi, I found an interesting thing when I went thru lttng-ust samples: In lttng-ust/tests/hello/ust_tests_hello.h, here is definition of an event: 28 TRACEPOINT_EVENT(ust_tests_hello, tptest, 29 TP_ARGS(int, anint, int, netint, long *, values, 30 char *, text, size_t, textlen, 31 double, doublearg, float, floatarg, 32 bool, boolarg), 33 TP_FIELDS( 34 ctf_integer(int, intfield, anint) 35 ctf_integer_hex(int, intfield2, anint) 36 ctf_integer(long, longfield, anint) 37 ctf_integer_network(int, netintfield, netint) 38 ctf_integer_network_hex(int, netintfieldhex, netint) 39 ctf_array(long, arrfield1, values, 3) 40 ctf_array_text(char, arrfield2, text, 10) 41 ctf_sequence(char, seqfield1, text, 42 size_t, textlen) 43 ctf_sequence_text(char, seqfield2, text, 44 size_t, textlen) 45 ctf_string(stringfield, text) 46 ctf_float(float, floatfield, floatarg) 47 ctf_float(double, doublefield, doublearg) 48 ctf_integer(bool, boolfield, boolarg) 49 ) 50 ) Please notice line 34-36. With my understanding, it decides the output format of each argument. Why does the argument anint need three cft_integer with different types? Best Regards Zheng From barthelemy at crans.org Tue Jul 10 04:26:48 2012 From: barthelemy at crans.org (=?ISO-8859-1?Q?S=E9bastien_Barth=E9l=E9my?=) Date: Tue, 10 Jul 2012 10:26:48 +0200 Subject: [lttng-dev] Download links outdated Message-ID: Hi, on the http://lttng.org/download page the links to the source tarballs are outdated. For instance, one gets a link to LTTng-tools 2.0.2 but the 2.03 was released. Idem for lttng-modules : the link is to 2.0.3 but 2.0.4 was released. Maybe you'd better automate this or just point to http://lttng.org/files/lttng-modules/ and let the visitor pick the latest. Cheers From zheng.chang at emc.com Tue Jul 10 04:44:25 2012 From: zheng.chang at emc.com (changz) Date: Tue, 10 Jul 2012 16:44:25 +0800 Subject: [lttng-dev] Question: multiple cft_integer for one argument? In-Reply-To: <4FFBE298.2070205@emc.com> References: <4FFBE298.2070205@emc.com> Message-ID: <4FFBEB69.1000804@emc.com> On 7/10/2012 16:06 PM, changz wrote: > Hi, > > I found an interesting thing when I went thru lttng-ust samples: > > In lttng-ust/tests/hello/ust_tests_hello.h, here is definition of an > event: > > 28 TRACEPOINT_EVENT(ust_tests_hello, tptest, > 29 TP_ARGS(int, anint, int, netint, long *, values, > 30 char *, text, size_t, textlen, > 31 double, doublearg, float, floatarg, > 32 bool, boolarg), > 33 TP_FIELDS( > 34 ctf_integer(int, intfield, anint) > 35 ctf_integer_hex(int, intfield2, anint) > 36 ctf_integer(long, longfield, anint) > 37 ctf_integer_network(int, netintfield, netint) > 38 ctf_integer_network_hex(int, netintfieldhex, netint) > 39 ctf_array(long, arrfield1, values, 3) > 40 ctf_array_text(char, arrfield2, text, 10) > 41 ctf_sequence(char, seqfield1, text, > 42 size_t, textlen) > 43 ctf_sequence_text(char, seqfield2, text, > 44 size_t, textlen) > 45 ctf_string(stringfield, text) > 46 ctf_float(float, floatfield, floatarg) > 47 ctf_float(double, doublefield, doublearg) > 48 ctf_integer(bool, boolfield, boolarg) > 49 ) > 50 ) > > Please notice line 34-36. With my understanding, it decides the output > format of each argument. > Why does the argument anint need three cft_integer with different types? > Got it. That means I can define the output format freely. Thanks > Best Regards > Zheng > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > From mathieu.desnoyers at efficios.com Tue Jul 10 09:32:52 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 10 Jul 2012 09:32:52 -0400 Subject: [lttng-dev] Question: multiple cft_integer for one argument? In-Reply-To: <4FFBE298.2070205@emc.com> References: <4FFBE298.2070205@emc.com> Message-ID: <20120710133252.GB7267@Krystal> * changz (zheng.chang at emc.com) wrote: > Hi, > > I found an interesting thing when I went thru lttng-ust samples: > > In lttng-ust/tests/hello/ust_tests_hello.h, here is definition of an event: > > 28 TRACEPOINT_EVENT(ust_tests_hello, tptest, > 29 TP_ARGS(int, anint, int, netint, long *, values, > 30 char *, text, size_t, textlen, > 31 double, doublearg, float, floatarg, > 32 bool, boolarg), > 33 TP_FIELDS( > 34 ctf_integer(int, intfield, anint) Here, "anint" (which is a C integer of type "int"), gets written into a integer field into the event (type "int" too). > 35 ctf_integer_hex(int, intfield2, anint) This line writes "anint" into the integer (type int) field, just like line 34. However, in the trace metadata, it will put a description attribute that requires that this integer must be pretty-printed as hexadecimal. > 36 ctf_integer(long, longfield, anint) Here, "anint" (again) gets cast into "long" type (either 32 or 64-bit depending on the architecture), and the result gets written into the trace. In this specific example, it serves no purpose, it' just there to show what can be done with TRACEPOINT_EVENTs. Best regards, Mathieu > 37 ctf_integer_network(int, netintfield, netint) > 38 ctf_integer_network_hex(int, netintfieldhex, netint) > 39 ctf_array(long, arrfield1, values, 3) > 40 ctf_array_text(char, arrfield2, text, 10) > 41 ctf_sequence(char, seqfield1, text, > 42 size_t, textlen) > 43 ctf_sequence_text(char, seqfield2, text, > 44 size_t, textlen) > 45 ctf_string(stringfield, text) > 46 ctf_float(float, floatfield, floatarg) > 47 ctf_float(double, doublefield, doublearg) > 48 ctf_integer(bool, boolfield, boolarg) > 49 ) > 50 ) > > Please notice line 34-36. With my understanding, it decides the output > format of each argument. > Why does the argument anint need three cft_integer with different types? > > Best Regards > Zheng > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Tue Jul 10 09:35:15 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 10 Jul 2012 09:35:15 -0400 Subject: [lttng-dev] Download links outdated In-Reply-To: References: Message-ID: <20120710133515.GC7267@Krystal> Alexandre, as I suspected, this needs to be automated. Can you look into this ? Either we create a script that checks for the latest version and updates the website, or we simply point to the respective download directories, but having out-of-date version numbers is not acceptable. Thanks, Mathieu * S?bastien Barth?l?my (barthelemy at crans.org) wrote: > Hi, > > on the http://lttng.org/download page the links to the source tarballs > are outdated. > > For instance, one gets a link to LTTng-tools 2.0.2 but the 2.03 was > released. Idem for lttng-modules : the link is to 2.0.3 but 2.0.4 was > released. > > Maybe you'd better automate this or just point to > http://lttng.org/files/lttng-modules/ and let the visitor pick the > latest. > > > Cheers > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Tue Jul 10 11:10:19 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 10 Jul 2012 11:10:19 -0400 Subject: [lttng-dev] [PATCH userspace-rcu] Add MIPS support In-Reply-To: References: Message-ID: <20120710151019.GB7990@Krystal> * Ralf Baechle (ralf.baechle at gmail.com) wrote: > From: Ralf Baechle > > Signed-off-by: Ralf Baechle Merged as the following commit, thanks ! commit e1259cb17954e4e03954ba7376d3ed61649116cd Author: Ralf Baechle Date: Tue Jul 10 11:03:08 2012 -0400 Add MIPS support [ Edit by Mathieu Desnoyers: add explanations about supported MIPS architectures, extracted from conversation with Ralf Baechle: * Supported architectures Ralf Baechle (edited by Mathieu Desnoyers): This code works on all MIPS architecture variants. The memory barrier instruction, SYNC, was introduced for MIPS II. The original MIPS I instruction set doesn't have SYNC nor SMP support in the processor architecture itself so SMP required horrible kludges in the system hardware. I think it's safe to say that Linux/MIPS will never support any of these MIPS I SMP systems. In the unlikely case this happens anyway, we have a (Linux) kernel emulation of the SYNC instruction. Voila - full binary compatibility across all MIPS processors and the oldest hardware pays the performance penalty. * Choice of barrier for cmm_mb()/cmm_rmb()/cmm_wmb() Ralf Baechle: "RMI (aka Netlogic and now Broadcom) XLR processor cores can be configured to permit LD-LD, LD-ST, ST-LD and ST-ST reordering; default is only ST-ST reordering. To allow Linux to eventually enable full reordering cmm_mb(), cmm_rmb() and cmm_wmb() all should perform SYNC and a compiler barrier." * No-op choice for cmm_read_barrier_depends(): Ralf Baechle: "Technically there is nothing in the MIPS architecture spec that would keep a MIPS implementation from reordering as freely as an Alpha or even more liberally. In practice most do strong ordering. However there is no MIPS implementation that makes full use of all the rope provided. So in theory a paranoid implementation of cmm_read_barrier_depends() for MIPS should perform a SYNC. In reality it's not necessary and no sane MIPS core designer would implement something that would design a core that need a non-empty cmm_read_barrier_depends(). The reason why my patch had an empty one is that I was using the Alpha code as a template." Mathieu Desnoyers: Moreover, the Linux kernel chooses a no-op for MIPS read_barrier_depends() implementation, so any MIPS architecture that would be as weak as Alpha would break the Linux kernel before breaking the userspace RCU library. * No need to put ".set noreorder" in cmm_mb() inline assembly: Ralf Baechle: "Certain instructions such as SYNC won't get reordered." ] Signed-off-by: Ralf Baechle CC: Paul McKenney Signed-off-by: Mathieu Desnoyers diff --git a/configure.ac b/configure.ac index 6935939..30fc045 100644 --- a/configure.ac +++ b/configure.ac @@ -63,6 +63,7 @@ AS_CASE([$host_cpu], [alpha*], [ARCHTYPE="alpha"], [ia64], [ARCHTYPE="gcc"], [arm*], [ARCHTYPE="arm"], + [mips*], [ARCHTYPE="mips"], [ARCHTYPE="unknown"] ) diff --git a/urcu/arch/mips.h b/urcu/arch/mips.h new file mode 100644 index 0000000..54c3c52 --- /dev/null +++ b/urcu/arch/mips.h @@ -0,0 +1,51 @@ +#ifndef _URCU_ARCH_MIPS_H +#define _URCU_ARCH_MIPS_H + +/* + * arch_mips.h: trivial definitions for the MIPS architecture. + * + * Copyright (c) 2010 Paolo Bonzini + * Copyright (c) 2012 Ralf Baechle + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define cmm_mb() __asm__ __volatile__ ( \ + " .set mips2 \n" \ + " sync \n" \ + " .set mips0 \n" \ + :::"memory") + +typedef unsigned long long cycles_t; + +static inline cycles_t caa_get_cycles(void) +{ + return 0; /* not supported */ +} + +#ifdef __cplusplus +} +#endif + +#include + +#endif /* _URCU_ARCH_MIPS_H */ diff --git a/urcu/uatomic/mips.h b/urcu/uatomic/mips.h new file mode 100644 index 0000000..bd7ca7f --- /dev/null +++ b/urcu/uatomic/mips.h @@ -0,0 +1,32 @@ +#ifndef _URCU_UATOMIC_ARCH_MIPS_H +#define _URCU_UATOMIC_ARCH_MIPS_H + +/* + * Atomic exchange operations for the MIPS architecture. Let GCC do it. + * + * Copyright (c) 2010 Paolo Bonzini + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include + +#endif /* _URCU_UATOMIC_ARCH_MIPS_H */ -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Wed Jul 11 14:39:56 2012 From: dgoulet at efficios.com (David Goulet) Date: Wed, 11 Jul 2012 14:39:56 -0400 Subject: [lttng-dev] [NEW] lttng-tools network streaming Message-ID: <4FFDC87C.2080505@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hi everyone, I just pushed a huge amount of work into master of lttng-tools which is the network streaming support. Please read the commit message appended to this email for more information. Since LTTng is an open source _community_, this feature is now in "crowd sourcing QA mode" :). Feel free to test, report bugs, contribute or comment on anything. Again, please do so! (https://bugs.lttng.orgprojects/lttng-tools) Here is a quick HOWTO in order to test the feature with kernel tracing ("remote" will receive the trace and "target" will stream the trace): (remote) $ lttng-relayd -d --> (daemonize the relayd) (target) # lttng create mystream # lttng enable-consumer -k net:// # lttng enable-event -k sched_switch # lttng start # lttng stop (remote) Check in $(HOME)/lttng-traces//... Hopefully it will work for you :) There is a known bug so please refer to the commit message below. Big thanks to all the LTTng dev team especially Julien Desfossez (relayd author), Mathieu Desnoyers and Yannick Brosseau for helping with design, code and birth of this amazing feature :)! Please note that man page for the relayd, streaming HOWTOs and streaming protocol specification will come in the next days in doc/. So for now, experiment with it and read the --help of each new command :). Cheers! I'm out for a beer :D David commit 00e2e675d54dc726a7c8f8887c889cc8ef022003 Author: David Goulet Date: Wed Jul 11 13:20:39 2012 -0400 Network streaming support This is a huge commit integrating a lot of new feature for network streaming support with the lttng-relayd previously merged. Please note that this commit is the initial import of the network streaming feature meaning that this is NOT stable and SHOULD be considered experimental hence not suited for production deployment. API Changes: lttng_create_session_uri(), lttng_enable_consumer(), lttng_set_consumer_uri() and lttng_disable_consumer() calls are added. The lttng command line now supports these new calls by introducing two new commands and one modified. (Please look at the --help option for more details). $ lttng enable-consumer $ lttng disable-consumer The "lttng create" command can now take new arguments to specify the destination URI for network streaming. There is also a new flag which allows the user to disable the consumer for the session. At this point, the now old deprecated lttng_create_session() call is still supported but SHOULD be replaced by lttng_create_session_uri(). More calls will be added to the API in order to facilitate the creation of lttng URI. Network streaming: Both kernel and user space tracing are supported for network streaming. For now, only IPv4 and IPv6 protocol over TCP is supported. Two network socket are used where one is for control commands and the second one is for data transmission. The port are respectively 5342 and 5343. BUGS: Streaming high throughput traces (e.g lttng enable-event -a -k) with low bandwitdh available to the relayd, the tracer does not behave well when the metadata are not emptied enough quickly so data are missing on the remote target and the tracing is simply not stoppable. This is a known bug and future iterations will try to fix it. WARNING: At this stage, there is _NO_ security features meaning no remote authentication on the relayd, no transport layer encryption or network secure handshake of some sort. So, uses only for in-vitro experiment or on _trusted_ networks. Signed-off-by: Julien Desfossez Signed-off-by: David Goulet -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJP/ch5AAoJEELoaioR9I02IYsH/RjaaUTWZDKL/sotQxfdKU/k Xq1qjrCiluLbgLJ+CvQDPCIEXzzWbySfQG/REUVbvN9bjQ+DPBMBdpQ1V/bjiAFt aOnpb8Om8YP1oMAXP+Mg7TYGTVMagAURx4IA1YP/Fkmv/tU+OhZEX00YDH3tu6Q6 sLTvEAzTBkrjh2HjeqlnKmevrZ4+OTr8LaNmDFznk3vUNyIkbGpFVYLfJWGI3CYF 3zAajqccZHosDDOVV1TMYkY+ZlVto20TJLjw5T+/efKaPcROpgnbN4guA5mdrDmr heyt6kGnhS30XWaZ8MS57IuySCWCIhpGTWw9kGrd3zXhgYRa4cion3+oXN/KxSU= =GEdj -----END PGP SIGNATURE----- From eikosaedron at gmail.com Thu Jul 12 02:55:40 2012 From: eikosaedron at gmail.com (eikosaedron at gmail.com) Date: Wed, 11 Jul 2012 23:55:40 -0700 Subject: [lttng-dev] Requesting help running LTTng-UST Message-ID: <13879f8bb0c.-1471800681871108244.-2125736047563382664@gmail.com> I've inherited a project that had LTTng userspace tracing built in in early 2012. I installed the latest LTTng releases from source on my build machine (debian 6 3.4) and built the binaries with LTTng enabled. I'm running them on a test server (sles 11 3.1) with a slightly older version of LTTng installed (current from two months ago). I have been running the binaries with appropriate input and invoking LTTng without any obvious problems, but have been unable to observe any tracing results. LTTng --verbose flags don't reveal any errors. I have started LTTng based on a sample script that came with the project so I believe it was invoked correctly. My main question at this point is whether I should consider downgrading my build machine or upgrading the test machine, whether tracing is likely broken in the binaries, or if there is anything else I may have overlooked. I hope someone more experienced with running LTTng can advise me as this is new ground for me. Thanks, Jon -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.han at umiami.edu Thu Jul 12 11:43:54 2012 From: r.han at umiami.edu (Rui Han) Date: Thu, 12 Jul 2012 11:43:54 -0400 Subject: [lttng-dev] Could I enable a particular system call tracing in LTTng 2.0 Message-ID: Hi, I just start using LTTng for my project. I found the system call tracing is verbose. What if I only want have one or several particular syscalls logged, how could I do that? Is there an easy way to do this like for kernel events by "lttng enable-event sched_switch -k."? Thank you very much. Regards, Rui -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu.desnoyers at efficios.com Thu Jul 12 13:10:21 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 12 Jul 2012 13:10:21 -0400 Subject: [lttng-dev] Could I enable a particular system call tracing in LTTng 2.0 In-Reply-To: References: Message-ID: <20120712171021.GA4937@Krystal> * Rui Han (r.han at umiami.edu) wrote: > Hi, > > I just start using LTTng for my project. I found the system call tracing is > verbose. What if I only want have one or several particular syscalls > logged, how could I do that? Is there an easy way to do this like for > kernel events by "lttng enable-event sched_switch -k."? No at this point, sorry. Eventually, this could be done once the filter bytecode gets ported from LTTng-UST to LTTng-modules, but we have no ETA on this at this point. Thanks, Mathieu > > Thank you very much. > > Regards, > Rui > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From r.han at umiami.edu Thu Jul 12 15:16:32 2012 From: r.han at umiami.edu (Rui Han) Date: Thu, 12 Jul 2012 15:16:32 -0400 Subject: [lttng-dev] Could I enable a particular system call tracing in LTTng 2.0 In-Reply-To: <5cf3b8d7e8694b949e946a6fd1199ca7@UMEX001.cgcent.miami.edu> References: <5cf3b8d7e8694b949e946a6fd1199ca7@UMEX001.cgcent.miami.edu> Message-ID: Hi Mathieu, Thank you for your reply. Then I probably will filter the tracing info by post processing. I will keep exploring this great tool. It is very useful. Thanks again. Regards, Rui On Thu, Jul 12, 2012 at 1:10 PM, Mathieu Desnoyers < mathieu.desnoyers at efficios.com> wrote: > * Rui Han (r.han at umiami.edu) wrote: > > Hi, > > > > I just start using LTTng for my project. I found the system call tracing > is > > verbose. What if I only want have one or several particular syscalls > > logged, how could I do that? Is there an easy way to do this like for > > kernel events by "lttng enable-event sched_switch -k."? > > No at this point, sorry. > > Eventually, this could be done once the filter bytecode gets ported from > LTTng-UST to LTTng-modules, but we have no ETA on this at this point. > > Thanks, > > Mathieu > > > > > Thank you very much. > > > > Regards, > > Rui > > > _______________________________________________ > > lttng-dev mailing list > > lttng-dev at lists.lttng.org > > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > > -- > Mathieu Desnoyers > Operating System Efficiency R&D Consultant > EfficiOS Inc. > http://www.efficios.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Fredrik_Oestman at mentor.com Fri Jul 13 06:29:31 2012 From: Fredrik_Oestman at mentor.com (Oestman, Fredrik) Date: Fri, 13 Jul 2012 10:29:31 +0000 Subject: [lttng-dev] When is tracepoint registration finished? Message-ID: <524C960C5DFC794E82BE548D825F05CF56CB1DF1@EU-MBX-04.mgc.mentorg.com> Hi, Is there any way to know from within the instrumented application when tracepoint registration is finished? We have instrumented clib functions, which are used by LTTng and start producing trace events before all tracepoint registration is finished. On ARM, this messes up LTTng UST and faulty events are recorded. On all architectures, we trace function calls we aren't interested in. Cheers, Fredrik ?stman From barthelemy at crans.org Mon Jul 16 08:37:40 2012 From: barthelemy at crans.org (=?ISO-8859-1?Q?S=E9bastien_Barth=E9l=E9my?=) Date: Mon, 16 Jul 2012 14:37:40 +0200 Subject: [lttng-dev] UST in flight recorder mode Message-ID: Hello, I'm currently tracking a bug which causes a full system freeze. It occurs during long running tests (after a few hours). The system kernel is too old for being traced with LTTng, but we have a few UST tracepoints which I used while tracking another bug last year. I would welcome any advice regarding a methodology to catch it. My best idea yet is to 1. add tracepoints where we suspect the bug to reside 2. setup lttng to record in flight recorder mode 3. trig the trace dump when a problem occurs Right now, we generate not much traces, so I can just skip steps 2 and 3. However, I'm thinking about having having LTTng always on in the future, and thus I would need to use the flight recorder mode. I have not found explanations or examples on how to trig the trace dump from software. Is there any? I had a look at lttng/ust-ctl.h, which seems to be the one header I need. I also found an old article where Mathieu was talking about "triggerring tracepoints", does it exist? I also saw some commits about a "filter" feature. This sound interesting can someone explain in a few words what this is about? Cheers -- Sebastian From christian.babeux at efficios.com Mon Jul 16 16:20:05 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Mon, 16 Jul 2012 16:20:05 -0400 Subject: [lttng-dev] [PATCH lttng-tools] relayd fix missing option --help Message-ID: Fix missing getopt_long option for --help in relayd. diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index 338341d..acc6ca8 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -120,6 +120,7 @@ int parse_args(int argc, char **argv) { "data-port", 1, 0, 'D' }, { "daemonize", 0, 0, 'd' }, { "output", 1, 0, 'o' }, + { "help", 0, 0, 'h' }, { "verbose", 0, 0, 'v' }, { NULL, 0, 0, 0 } }; From jbernard at debian.org Mon Jul 16 20:20:30 2012 From: jbernard at debian.org (Jon Bernard) Date: Mon, 16 Jul 2012 20:20:30 -0400 Subject: [lttng-dev] Query about LTTng 2.0 Debian packages In-Reply-To: <20120621191452.GA18195@quintessa> References: <20120621012622.GA1387@Krystal> <20120621191452.GA18195@quintessa> Message-ID: <20120717002030.GA19871@quintessa> * Jon Bernard wrote: > * Mathieu Desnoyers wrote: > > Hi Jon, > > > > I wanted to get in touch with you regarding LTTng 2.0 Debian packages. > > Is there anything we can do to help you getting those packages into > > Debian ? They have been out for a while now, and even Ubuntu picked them > > up. I understand that you are probably busy, hence my offer for help. > > I've just uploaded another package I've been working on and LTTng 2.0 packages > are next on my list. Give me a few days to get things sorted, I'll post an > update next week with my status. I am just now waiting on lttng-modules and babeltrace to be accepted into the archive. Once this happens, lttng-utils can be uploaded and the 2.0 packages should be complete. -- Jon From Paul_Woegerer at mentor.com Tue Jul 17 09:42:47 2012 From: Paul_Woegerer at mentor.com (Woegerer, Paul) Date: Tue, 17 Jul 2012 15:42:47 +0200 Subject: [lttng-dev] notrace missing in lttng-ust In-Reply-To: <4FF2A31D.9020100@mentor.com> References: <4FED6718.1000205@mentor.com> <20120630181600.GB30747@Krystal> <4FF2A31D.9020100@mentor.com> Message-ID: <50056BD7.4040807@mentor.com> Hello Mathieu, What is the status regarding this patch. Any reason why it doesn't get merged ? Thanks, Paul On 07/03/2012 09:45 AM, Woegerer, Paul wrote: > Hi Mathieu, > > here is the revised patch that makes tracepoint.h and > ust-tracepoint-event.h robust against -finstrument-functions. > I tested it against our small ackermann sample (3 custom tracepoints + > -finstrument-functions). See screenshots. > > Btw, nice macro metaprogramming in ust-tracepoint-event.h :) > > Thanks, > Paul > > On 06/30/2012 08:16 PM, Mathieu Desnoyers wrote: >> * Woegerer, Paul (Paul_Woegerer at mentor.com) wrote: >>> Hi Mathieu, >>> >>> libust 0.x uses notrace (__attribute__((no_instrument_function)) for >>> all >>> functions that are involved in event emitting. >>> >>> For example: >>> ./libust/marker.c:122:notrace void __ust_marker_empty_function(const >>> struct ust_marker *mdata, >>> ./libust/marker.c:137:notrace void ust_marker_probe_cb(const struct >>> ust_marker *mdata, >>> ./libust/marker.c:197:static notrace void >>> ust_marker_probe_cb_noarg(const struct ust_marker *mdata, >>> >>> I just realized that this is no more the case for lttng-ust. >>> Was it a conscious decision not to use notrace for LTTng 2.0 lttng-ust, >>> or is it just missing ? >> just missing. only needed for -finstrument-functions. >> >>> I would like to have notrace also in lttng-ust, at least for the >>> _DECLARE_TRACEPOINT macro in tracepoint.h. >> I guess the probes generated by ust-tracepoint-event.h would need that >> too. A patch that adds those noinline everywhere where it's needed >> (hint: all functions called on the tracing patch within public headers >> of lttng-ust 2.0 would be a good start). Please test the patch by >> tracing a program automatically instrumented by -finstrument-functions >> and see if things blow up. >> >> Thanks, >> >> Mathieu >> >>> Like this for example: >>> >>> diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h >>> index 5bab476..71665dc 100644 >>> --- a/include/lttng/tracepoint.h >>> +++ b/include/lttng/tracepoint.h >>> @@ -137,6 +137,7 @@ extern "C" { >>> >>> #define _DECLARE_TRACEPOINT(_provider, _name, ...) \ >>> extern struct tracepoint __tracepoint_##_provider##___##_name; >>> \ >>> +static inline void >>> __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) >>> __attribute__ ((no_instrument_function)); \ >>> static inline void >>> __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) \ >>> { \ >>> struct tracepoint_probe *__tp_probe; \ >>> @@ -158,12 +159,16 @@ end: \ >>> tp_rcu_read_unlock_bp(); \ >>> } \ >>> static inline void __tracepoint_register_##_provider##___##_name(char >>> *name, \ >>> + void (*func)(void), void *data) __attribute__ >>> ((no_instrument_function)); \ >>> +static inline void __tracepoint_register_##_provider##___##_name(char >>> *name, \ >>> void (*func)(void), void *data) \ >>> { \ >>> __tracepoint_probe_register(name, func, data, \ >>> __tracepoint_##_provider##___##_name.signature); \ >>> } \ >>> static inline void >>> __tracepoint_unregister_##_provider##___##_name(char >>> *name, \ >>> + void (*func)(void), void *data) __attribute__ >>> ((no_instrument_function)); \ >>> +static inline void >>> __tracepoint_unregister_##_provider##___##_name(char >>> *name, \ >>> void (*func)(void), void *data) \ >>> { \ >>> __tracepoint_probe_unregister(name, func, data); \ >>> >>> Greetings, >>> Paul >>> >>> -- >>> Paul Woegerer | SW Development Engineer >>> Mentor Embedded(tm) | Prinz Eugen Stra?e 72/2/4, Vienna, 1040 Austria >>> P 43.1.535991320 >>> Nucleus? | Linux? | Android(tm) | Services | UI | Multi-OS >>> >>> Android is a trademark of Google Inc. Use of this trademark is >>> subject to Google Permissions. >>> Linux is the registered trademark of Linus Torvalds in the U.S. and >>> other countries. >>> >>> >>> _______________________________________________ >>> lttng-dev mailing list >>> lttng-dev at lists.lttng.org >>> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Paul Woegerer | SW Development Engineer Mentor Embedded(tm) | Prinz Eugen Stra?e 72/2/4, Vienna, 1040 Austria P 43.1.535991320 Nucleus? | Linux? | Android(tm) | Services | UI | Multi-OS Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu.desnoyers at efficios.com Tue Jul 17 10:13:01 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 17 Jul 2012 10:13:01 -0400 Subject: [lttng-dev] notrace missing in lttng-ust In-Reply-To: <4FF2A31D.9020100@mentor.com> References: <4FED6718.1000205@mentor.com> <20120630181600.GB30747@Krystal> <4FF2A31D.9020100@mentor.com> Message-ID: <20120717141301.GA21204@Krystal> * Woegerer, Paul (Paul_Woegerer at mentor.com) wrote: > Hi Mathieu, > > here is the revised patch that makes tracepoint.h and > ust-tracepoint-event.h robust against -finstrument-functions. > I tested it against our small ackermann sample (3 custom tracepoints + > -finstrument-functions). See screenshots. > > Btw, nice macro metaprogramming in ust-tracepoint-event.h :) Some feedback, sorry for the delay, I've been busy working on filtering, [...] > From 29ce637941c1e3efefb2b5a82c2683c57f583ac1 Mon Sep 17 00:00:00 2001 > From: Paul Woegerer > Date: Tue, 3 Jul 2012 09:28:24 +0200 > Subject: [PATCH] Make lttng-ust robust against -finstrument-functions. > > --- > configure.ac | 12 ++++++++++++ > include/lttng/ringbuffer-config.h | 20 ++++++++++++++++++++ > include/lttng/tracepoint.h | 11 +++++++++++ > include/lttng/ust-config.h.in | 3 +++ > include/lttng/ust-tracepoint-event.h | 11 +++++++++++ > 5 files changed, 57 insertions(+) > > diff --git a/configure.ac b/configure.ac > index edd3c20..b12216f 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -21,6 +21,7 @@ AC_CONFIG_SRCDIR([include/lttng/tracepoint.h]) > AC_CONFIG_HEADERS([config.h include/lttng/ust-config.h]) > AH_TEMPLATE([LTTNG_UST_HAVE_EFFICIENT_UNALIGNED_ACCESS], [Use efficient unaligned access.]) > AH_TEMPLATE([LTTNG_UST_HAVE_SDT_INTEGRATION], [SystemTap integration via sdt.h]) > +AH_TEMPLATE([LTTNG_NOTRACE], [Prevent -finstrument-functions instrumentation]) I think we want to make the notrace always active. I don't see the point in letting UST lib be compiled with those tracing stubs in place. > > # Compute minor/major/patchlevel version numbers > AC_PROG_SED > @@ -264,6 +265,17 @@ AS_IF([test "x$with_sdt" = "xyes"],[ > ]) > ]) > > +instrument_func_save_cflags="$CFLAGS" > +CFLAGS=-finstrument-functions > +AC_MSG_CHECKING([whether CC supports -finstrument-functions]) > +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],[ > + AC_MSG_RESULT([yes]) > + AC_DEFINE([LTTNG_NOTRACE], [__attribute__((no_instrument_function))]) > +],[ > + AC_MSG_RESULT([no]) > +]) > +CFLAGS="$instrument_func_save_cflags" Well, pretty much all recent gcc and compilers supporting gcc extensions like llvm seem to support the no_instrument_function attribute. I'd be tempted to remove this stuff from configure.ac and assume __attribute__((no_instrument_function)) can be used. We'll manage if we see that it breaks compilers we care about. We should create a include/lttng/ust-compiler.h with: #define lttng_ust_notrace __attribute__((no_instrument_function)) so we don't duplicate the define. > + > #currently disabled. > #tests/hello2/Makefile > #tests/basic/Makefile > diff --git a/include/lttng/ringbuffer-config.h b/include/lttng/ringbuffer-config.h > index 24e7dbe..232e754 100644 > --- a/include/lttng/ringbuffer-config.h > +++ b/include/lttng/ringbuffer-config.h > @@ -219,6 +219,10 @@ struct lttng_ust_lib_ring_buffer_ctx { > char padding[LTTNG_UST_RING_BUFFER_CTX_PADDING]; > }; > > +#ifndef LTTNG_NOTRACE > +#define LTTNG_NOTRACE > +#endif > + > /** > * lib_ring_buffer_ctx_init - initialize ring buffer context > * @ctx: ring buffer context to initialize > @@ -232,6 +236,11 @@ static inline > void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, > struct channel *chan, void *priv, > size_t data_size, int largest_align, > + int cpu, struct lttng_ust_shm_handle *handle) LTTNG_NOTRACE; > +static inline > +void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, > + struct channel *chan, void *priv, > + size_t data_size, int largest_align, > int cpu, struct lttng_ust_shm_handle *handle) Can't we simply specify the attribute on the function definition, rather than having to duplicate its prototype ? Thanks, Mathieu > { > ctx->chan = chan; > @@ -276,6 +285,8 @@ void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, > * size_of_type must be non-zero. > */ > static inline > +unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) LTTNG_NOTRACE; > +static inline > unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) > { > return offset_align(align_drift, size_of_type); > @@ -290,6 +301,8 @@ unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) > * size_of_type must be non-zero. > */ > static inline > +unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) LTTNG_NOTRACE; > +static inline > unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) > { > return 0; > @@ -303,6 +316,9 @@ unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) > */ > static inline > void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, > + size_t alignment) LTTNG_NOTRACE; > +static inline > +void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, > size_t alignment) > { > ctx->buf_offset += lib_ring_buffer_align(ctx->buf_offset, > @@ -316,6 +332,10 @@ void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, > static inline > int lib_ring_buffer_check_config(const struct lttng_ust_lib_ring_buffer_config *config, > unsigned int switch_timer_interval, > + unsigned int read_timer_interval) LTTNG_NOTRACE; > +static inline > +int lib_ring_buffer_check_config(const struct lttng_ust_lib_ring_buffer_config *config, > + unsigned int switch_timer_interval, > unsigned int read_timer_interval) > { > if (config->alloc == RING_BUFFER_ALLOC_GLOBAL > diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h > index 5bab476..855b022 100644 > --- a/include/lttng/tracepoint.h > +++ b/include/lttng/tracepoint.h > @@ -23,6 +23,10 @@ > #include > #include /* for sdt */ > > +#ifndef LTTNG_NOTRACE > +#define LTTNG_NOTRACE > +#endif > + > #ifdef LTTNG_UST_HAVE_SDT_INTEGRATION > #define SDT_USE_VARIADIC > #include > @@ -137,6 +141,7 @@ extern "C" { > > #define _DECLARE_TRACEPOINT(_provider, _name, ...) \ > extern struct tracepoint __tracepoint_##_provider##___##_name; \ > +static inline void __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) LTTNG_NOTRACE; \ > static inline void __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) \ > { \ > struct tracepoint_probe *__tp_probe; \ > @@ -158,12 +163,16 @@ end: \ > tp_rcu_read_unlock_bp(); \ > } \ > static inline void __tracepoint_register_##_provider##___##_name(char *name, \ > + void (*func)(void), void *data) LTTNG_NOTRACE; \ > +static inline void __tracepoint_register_##_provider##___##_name(char *name, \ > void (*func)(void), void *data) \ > { \ > __tracepoint_probe_register(name, func, data, \ > __tracepoint_##_provider##___##_name.signature); \ > } \ > static inline void __tracepoint_unregister_##_provider##___##_name(char *name, \ > + void (*func)(void), void *data) LTTNG_NOTRACE; \ > +static inline void __tracepoint_unregister_##_provider##___##_name(char *name, \ > void (*func)(void), void *data) \ > { \ > __tracepoint_probe_unregister(name, func, data); \ > @@ -249,6 +258,7 @@ int __tracepoint_registered > struct tracepoint_dlopen tracepoint_dlopen > __attribute__((weak, visibility("hidden"))); > > +static void __attribute__((constructor)) __tracepoints__init(void) LTTNG_NOTRACE; > static void __attribute__((constructor)) __tracepoints__init(void) > { > if (__tracepoint_registered++) > @@ -285,6 +295,7 @@ static void __attribute__((constructor)) __tracepoints__init(void) > __start___tracepoints_ptrs); > } > > +static void __attribute__((destructor)) __tracepoints__destroy(void) LTTNG_NOTRACE; > static void __attribute__((destructor)) __tracepoints__destroy(void) > { > int ret; > diff --git a/include/lttng/ust-config.h.in b/include/lttng/ust-config.h.in > index 5d1ee40..b75dfb8 100644 > --- a/include/lttng/ust-config.h.in > +++ b/include/lttng/ust-config.h.in > @@ -5,3 +5,6 @@ > > /* DTrace/GDB/SystemTap integration via sdt.h */ > #undef LTTNG_UST_HAVE_SDT_INTEGRATION > + > +/* Prevent -finstrument-functions instrumentation */ > +#undef LTTNG_NOTRACE > diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h > index 78d85af..35c33dd 100644 > --- a/include/lttng/ust-tracepoint-event.h > +++ b/include/lttng/ust-tracepoint-event.h > @@ -89,6 +89,10 @@ > __max1 > __max2 ? __max1: __max2; \ > }) > > +#ifndef LTTNG_NOTRACE > +#define LTTNG_NOTRACE > +#endif > + > /* > * Stage 0 of tracepoint event generation. > * > @@ -278,6 +282,7 @@ static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)); > > #undef TRACEPOINT_EVENT_CLASS > #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ > +static inline size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) LTTNG_NOTRACE; \ > static inline size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) \ > { \ > size_t __event_len = 0; \ > @@ -330,6 +335,7 @@ static inline size_t __event_get_size__##_provider##___##_name(size_t *__dynamic > #undef TRACEPOINT_EVENT_CLASS > #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ > static inline \ > +size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) LTTNG_NOTRACE; \ > size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \ > { \ > size_t __event_align = 1; \ > @@ -400,6 +406,7 @@ size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \ > > #undef TRACEPOINT_EVENT_CLASS > #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ > +static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) LTTNG_NOTRACE; \ > static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args))\ > { \ > struct ltt_event *__event = __tp_data; \ > @@ -547,6 +554,8 @@ static struct lttng_probe_desc _TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PR > /* Reset all macros within TRACEPOINT_EVENT */ > #include > static void __attribute__((constructor)) > +_TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) LTTNG_NOTRACE; > +static void __attribute__((constructor)) > _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) > { > int ret; > @@ -556,6 +565,8 @@ _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) > } > > static void __attribute__((destructor)) > +_TP_COMBINE_TOKENS(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void) LTTNG_NOTRACE; > +static void __attribute__((destructor)) > _TP_COMBINE_TOKENS(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void) > { > ltt_probe_unregister(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER)); > -- > 1.7.10.4 > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Tue Jul 17 10:14:57 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 17 Jul 2012 10:14:57 -0400 Subject: [lttng-dev] Query about LTTng 2.0 Debian packages In-Reply-To: <20120717002030.GA19871@quintessa> References: <20120621012622.GA1387@Krystal> <20120621191452.GA18195@quintessa> <20120717002030.GA19871@quintessa> Message-ID: <20120717141457.GC21204@Krystal> * Jon Bernard (jbernard at debian.org) wrote: > * Jon Bernard wrote: > > * Mathieu Desnoyers wrote: > > > Hi Jon, > > > > > > I wanted to get in touch with you regarding LTTng 2.0 Debian packages. > > > Is there anything we can do to help you getting those packages into > > > Debian ? They have been out for a while now, and even Ubuntu picked them > > > up. I understand that you are probably busy, hence my offer for help. > > > > I've just uploaded another package I've been working on and LTTng 2.0 packages > > are next on my list. Give me a few days to get things sorted, I'll post an > > update next week with my status. > > I am just now waiting on lttng-modules and babeltrace to be accepted into the > archive. Once this happens, lttng-utils can be uploaded and the 2.0 packages > should be complete. Great! Looking forward to it :) Thanks, Mathieu -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Tue Jul 17 10:54:56 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 17 Jul 2012 10:54:56 -0400 Subject: [lttng-dev] UST in flight recorder mode In-Reply-To: References: Message-ID: <20120717145456.GA21849@Krystal> * S?bastien Barth?l?my (barthelemy at crans.org) wrote: > Hello, > > I'm currently tracking a bug which causes a full system freeze. It > occurs during long running tests (after a few hours). > > The system kernel is too old for being traced with LTTng, but we have a few > UST tracepoints which I used while tracking another bug last year. > > I would welcome any advice regarding a methodology to catch it. > > My best idea yet is to > > 1. add tracepoints where we suspect the bug to reside > 2. setup lttng to record in flight recorder mode Unfortunately, even though you can set the kernel and UST tracer channels to "--overwrite" mode, lttng-tools does not support flight recorder mode yet. This feature is planned for 2.1 or 2.2. It means that you'd have to manually stop the consumer daemon while you gather data, and only unstop it when you want to dump your buffers, if you want to "simulate" a kind-of-working flight recorder mode. > 3. trig the trace dump when a problem occurs > > Right now, we generate not much traces, so I can just skip steps 2 and 3. > However, I'm thinking about having having LTTng always on in the > future, and > thus I would need to use the flight recorder mode. > > I have not found explanations or examples on how to trig the trace dump > from software. Is there any? We plan to implement a --snapshot command, to take a snapshot of a flight recorder trace. > I had a look at lttng/ust-ctl.h, which seems to be the one header I need. > > I also found an old article where Mathieu was talking about "triggerring > tracepoints", does it exist? Not at this point. > > I also saw some commits about a "filter" feature. This sound interesting > can someone explain in a few words what this is about? Filtering out events based on a filtering expression, directly at the trace source, e.g.: lttng enable-event 'ust_tests_hello:tptest' --filter 'intfield>500 && intfield<503' -u will only record events for which the "intfield" has values within the requested range. One future step, once we get the snapshot command in, will be to implement actions (or triggers), so the evaluation of some filter expression can lead to, e.g., taking a flight recorder buffer snapshot. Hoping this helps, Thanks, Mathieu > > Cheers > > -- Sebastian > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From montarcyber at gmail.com Tue Jul 17 12:55:00 2012 From: montarcyber at gmail.com (tchak adim) Date: Tue, 17 Jul 2012 12:55:00 -0400 Subject: [lttng-dev] lttng 2.0 Message-ID: Hi , Using LTTng 2.0 , How can i generate just system call kernel traces using command line ? Thanks in advance ! Regards. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dgoulet at efficios.com Tue Jul 17 13:00:27 2012 From: dgoulet at efficios.com (David Goulet) Date: Tue, 17 Jul 2012 13:00:27 -0400 Subject: [lttng-dev] lttng 2.0 In-Reply-To: References: Message-ID: <50059A2B.2010903@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hi, # lttng create mysession # lttng enable-event -k --syscall -a # lttng start (tracing). Enjoy! David tchak adim: > Hi , > > > Using LTTng 2.0 , How can i generate just system call kernel > traces using command line ? > > Thanks in advance ! > > Regards. > > > This body part will be downloaded on demand. -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQBZooAAoJEELoaioR9I02QcIH/jGctW79JGeq1ll0p0KrrlC9 h4NzMGqN/vPxRC4yUc7ShqeRyj/v2xSfcZGkRHnfhIwlyGSfujoPv3moMqVldWhH Y3BzfI9DEcHmq2d4KwynYIMPj53ePT4YR+9V3i3NiU+eUqLyqxJ2DBNuzs0qTNUb u/CUA97SsI3h7Ia8M1dS7eqBP97d9TiE0xx/yFkY6rZl7Pou+Uz/g6dx/U3PdooE uOyjJkyHwYzoexoee+dcOqyvaKQgL/LkKetDrOoYlRT1N52clk4kMvWsrBkyRFTM H9w+NDqDja0eX73XSXWq5HO5PMhQNIsigGbzif0I7tsXO/GTgqw3tT1Fc/WTEhI= =7oYV -----END PGP SIGNATURE----- From barthelemy at crans.org Tue Jul 17 13:01:58 2012 From: barthelemy at crans.org (=?ISO-8859-1?Q?S=E9bastien_Barth=E9l=E9my?=) Date: Tue, 17 Jul 2012 19:01:58 +0200 Subject: [lttng-dev] UST in flight recorder mode In-Reply-To: <20120717145456.GA21849@Krystal> References: <20120717145456.GA21849@Krystal> Message-ID: On Tue, Jul 17, 2012 at 4:54 PM, Mathieu Desnoyers wrote: > Hoping this helps, Sure, thank you for the clarifications. From christian.babeux at efficios.com Tue Jul 17 15:15:35 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Tue, 17 Jul 2012 15:15:35 -0400 Subject: [lttng-dev] [RFC PATCH lttng-tools] relayd pipes and error handling Message-ID: Hi, The current relayd employ two set of pipes for command relaying and thread quit signalling. The relay_cmd_pipe pipes are never closed. Also, the thread_quit_pipe pipes are not closed in some error cases (fail to parse args, fail to daemonize, etc.). Here is a proposed way to cleanup and handle error cases. Thoughts? Thanks, Christian Fix: relayd relay_cmd_pipe/thread_quit_pipe should be closed on exit/error. diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index acc6ca8..55452b3 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -231,14 +231,26 @@ void cleanup(void) DBG("Cleaning up"); + /* Close thread quit pipes */ for (i = 0; i < 2; i++) { if (thread_quit_pipe[i] >= 0) { ret = close(thread_quit_pipe[i]); if (ret) { - PERROR("close"); + PERROR("close quit pipe"); } } } + + /* Close relay cmd pipes */ + for (i = 0; i < 2; i++) { + if (relay_cmd_pipe[i] >= 0) { + ret = close(relay_cmd_pipe[i]); + if (ret) { + PERROR("close cmd pipe"); + } + } + } + } /* @@ -1479,7 +1491,7 @@ int main(int argc, char **argv) /* Parse arguments */ progname = argv[0]; if ((ret = parse_args(argc, argv) < 0)) { - goto error; + goto exit; } if ((ret = set_signal_handler()) < 0) { @@ -1491,7 +1503,7 @@ int main(int argc, char **argv) ret = daemon(0, 0); if (ret < 0) { PERROR("daemon"); - goto error; + goto exit; } } @@ -1502,7 +1514,7 @@ int main(int argc, char **argv) if (control_uri->port < 1024 || data_uri->port < 1024) { ERR("Need to be root to use ports < 1024"); ret = -1; - goto error; + goto exit; } } @@ -1567,6 +1579,7 @@ exit: if (!ret) { exit(EXIT_SUCCESS); } + error: exit(EXIT_FAILURE); } From Bingfeng.Zhao at emc.com Wed Jul 18 05:53:34 2012 From: Bingfeng.Zhao at emc.com (Bingfeng.Zhao at emc.com) Date: Wed, 18 Jul 2012 05:53:34 -0400 Subject: [lttng-dev] some questions on lttng Message-ID: <4B3E7C3D6AE874479212F4D6AE0AFD1F02C7FF0741@MX28A.corp.emc.com> Hello the dev list, We encounter some basic questions when try to adapt the LTTNG in our poject. 1. When the trace is enabled and all are well configurated, we get trace messages collected under the session folder. The question is whether it is possible that some traces will lost when the trace messages are huge. How will LTTNG do if the consumer deamon cannot fast enough to copy the trace message from trace buffer? 2. For user space trace, currectly seems we cannot set the flush interval. How can we control the flush internal for UST? If no, is there hardcoded or random flash interval? Or there is no time based flush mechanism at all for UST? 3. For a severe kernel panic can we extrace buffered trace messages from LTTNG internal buffer in full memory core dump file? Is there tools on this we can leverage? Thank you, - Bingfeng -------------- next part -------------- An HTML attachment was scrubbed... URL: From Paul_Woegerer at mentor.com Wed Jul 18 06:33:08 2012 From: Paul_Woegerer at mentor.com (Woegerer, Paul) Date: Wed, 18 Jul 2012 12:33:08 +0200 Subject: [lttng-dev] notrace missing in lttng-ust In-Reply-To: <20120717141301.GA21204@Krystal> References: <4FED6718.1000205@mentor.com> <20120630181600.GB30747@Krystal> <4FF2A31D.9020100@mentor.com> <20120717141301.GA21204@Krystal> Message-ID: <500690E4.4020503@mentor.com> On 07/17/2012 04:13 PM, Mathieu Desnoyers wrote: > I think we want to make the notrace always active. I don't see the point > in letting UST lib be compiled with those tracing stubs in place. OK, I'll remove that ... > We should create a include/lttng/ust-compiler.h with: > > #define lttng_ust_notrace __attribute__((no_instrument_function)) > > so we don't duplicate the define. ... and use include/lttng/ust-compiler.h instead. > Can't we simply specify the attribute on the function definition, rather > than having to duplicate its prototype ? No. I tried that before but unfortunately it didn't work. It only works consistently if the attribute is on the function declaration. If you try to put it on the definition it will result in compiler errors either when tracepoint providers are compiled or when tracepoint provider header files are used. The updated patch is in the attachment. Thanks, Paul -- Paul Woegerer | SW Development Engineer Mentor Embedded(tm) | Prinz Eugen Stra?e 72/2/4, Vienna, 1040 Austria P 43.1.535991320 Nucleus? | Linux? | Android(tm) | Services | UI | Multi-OS Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Make-lttng-ust-robust-against-finstrument-functions.patch Type: text/x-patch Size: 9662 bytes Desc: not available URL: From mathieu.desnoyers at efficios.com Wed Jul 18 07:42:16 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Wed, 18 Jul 2012 07:42:16 -0400 Subject: [lttng-dev] notrace missing in lttng-ust In-Reply-To: <500690E4.4020503@mentor.com> References: <4FED6718.1000205@mentor.com> <20120630181600.GB30747@Krystal> <4FF2A31D.9020100@mentor.com> <20120717141301.GA21204@Krystal> <500690E4.4020503@mentor.com> Message-ID: <20120718114216.GA4061@Krystal> * Woegerer, Paul (Paul_Woegerer at mentor.com) wrote: > On 07/17/2012 04:13 PM, Mathieu Desnoyers wrote: > >> I think we want to make the notrace always active. I don't see the point >> in letting UST lib be compiled with those tracing stubs in place. > > OK, I'll remove that ... > >> We should create a include/lttng/ust-compiler.h with: >> >> #define lttng_ust_notrace __attribute__((no_instrument_function)) >> >> so we don't duplicate the define. > > ... and use include/lttng/ust-compiler.h instead. > >> Can't we simply specify the attribute on the function definition, rather >> than having to duplicate its prototype ? > > No. I tried that before but unfortunately it didn't work. It only works > consistently if the attribute is on the function declaration. If you try > to put it on the definition it will result in compiler errors either > when tracepoint providers are compiled or when tracepoint provider > header files are used. Please try with the change I propose below, > > The updated patch is in the attachment. > > Thanks, > Paul > > -- > Paul Woegerer | SW Development Engineer > Mentor Embedded(tm) | Prinz Eugen Stra?e 72/2/4, Vienna, 1040 Austria > P 43.1.535991320 > Nucleus? | Linux? | Android(tm) | Services | UI | Multi-OS > > Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions. > Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. > > From 46e709a85edbca6b9c869148cadd2abac2f98acf Mon Sep 17 00:00:00 2001 > From: Paul Woegerer > Date: Wed, 18 Jul 2012 12:27:07 +0200 > Subject: [PATCH] Make lttng-ust robust against -finstrument-functions. > > --- > include/Makefile.am | 1 + > include/lttng/ringbuffer-config.h | 17 +++++++++++++++++ > include/lttng/tracepoint.h | 8 ++++++++ > include/lttng/ust-compiler.h | 21 +++++++++++++++++++++ > include/lttng/ust-tracepoint-event.h | 8 ++++++++ > 5 files changed, 55 insertions(+) > create mode 100644 include/lttng/ust-compiler.h > > diff --git a/include/Makefile.am b/include/Makefile.am > index 633260b..208e74e 100644 > --- a/include/Makefile.am > +++ b/include/Makefile.am > @@ -14,6 +14,7 @@ nobase_include_HEADERS = \ > lttng/ringbuffer-abi.h \ > lttng/ust-tracer.h \ > lttng/ust-config.h \ > + lttng/ust-compiler.h \ > lttng/ust.h \ > lttng/ust-endian.h \ > lttng/ringbuffer-config.h \ > diff --git a/include/lttng/ringbuffer-config.h b/include/lttng/ringbuffer-config.h > index 24e7dbe..408d95a 100644 > --- a/include/lttng/ringbuffer-config.h > +++ b/include/lttng/ringbuffer-config.h > @@ -27,6 +27,7 @@ > #include > #include > #include "lttng/align.h" > +#include > > struct lttng_ust_lib_ring_buffer; > struct channel; > @@ -232,6 +233,11 @@ static inline > void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, > struct channel *chan, void *priv, > size_t data_size, int largest_align, > + int cpu, struct lttng_ust_shm_handle *handle) lttng_ust_notrace; > +static inline > +void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, > + struct channel *chan, void *priv, > + size_t data_size, int largest_align, > int cpu, struct lttng_ust_shm_handle *handle) e.g. here: static lttng_ust_notrace void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, struct channel *chan, void *priv, size_t data_size, int largest_align, int cpu, struct lttng_ust_shm_handle *handle) { ... body of function ... } Thanks, Mathieu > { > ctx->chan = chan; > @@ -276,6 +282,8 @@ void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, > * size_of_type must be non-zero. > */ > static inline > +unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) lttng_ust_notrace; > +static inline > unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) > { > return offset_align(align_drift, size_of_type); > @@ -290,6 +298,8 @@ unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) > * size_of_type must be non-zero. > */ > static inline > +unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) lttng_ust_notrace; > +static inline > unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) > { > return 0; > @@ -303,6 +313,9 @@ unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) > */ > static inline > void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, > + size_t alignment) lttng_ust_notrace; > +static inline > +void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, > size_t alignment) > { > ctx->buf_offset += lib_ring_buffer_align(ctx->buf_offset, > @@ -316,6 +329,10 @@ void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, > static inline > int lib_ring_buffer_check_config(const struct lttng_ust_lib_ring_buffer_config *config, > unsigned int switch_timer_interval, > + unsigned int read_timer_interval) lttng_ust_notrace; > +static inline > +int lib_ring_buffer_check_config(const struct lttng_ust_lib_ring_buffer_config *config, > + unsigned int switch_timer_interval, > unsigned int read_timer_interval) > { > if (config->alloc == RING_BUFFER_ALLOC_GLOBAL > diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h > index 5bab476..77595d3 100644 > --- a/include/lttng/tracepoint.h > +++ b/include/lttng/tracepoint.h > @@ -22,6 +22,7 @@ > #include /* for memset */ > #include > #include /* for sdt */ > +#include > > #ifdef LTTNG_UST_HAVE_SDT_INTEGRATION > #define SDT_USE_VARIADIC > @@ -137,6 +138,7 @@ extern "C" { > > #define _DECLARE_TRACEPOINT(_provider, _name, ...) \ > extern struct tracepoint __tracepoint_##_provider##___##_name; \ > +static inline void __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) lttng_ust_notrace; \ > static inline void __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) \ > { \ > struct tracepoint_probe *__tp_probe; \ > @@ -158,12 +160,16 @@ end: \ > tp_rcu_read_unlock_bp(); \ > } \ > static inline void __tracepoint_register_##_provider##___##_name(char *name, \ > + void (*func)(void), void *data) lttng_ust_notrace; \ > +static inline void __tracepoint_register_##_provider##___##_name(char *name, \ > void (*func)(void), void *data) \ > { \ > __tracepoint_probe_register(name, func, data, \ > __tracepoint_##_provider##___##_name.signature); \ > } \ > static inline void __tracepoint_unregister_##_provider##___##_name(char *name, \ > + void (*func)(void), void *data) lttng_ust_notrace; \ > +static inline void __tracepoint_unregister_##_provider##___##_name(char *name, \ > void (*func)(void), void *data) \ > { \ > __tracepoint_probe_unregister(name, func, data); \ > @@ -249,6 +255,7 @@ int __tracepoint_registered > struct tracepoint_dlopen tracepoint_dlopen > __attribute__((weak, visibility("hidden"))); > > +static void __attribute__((constructor)) __tracepoints__init(void) lttng_ust_notrace; > static void __attribute__((constructor)) __tracepoints__init(void) > { > if (__tracepoint_registered++) > @@ -285,6 +292,7 @@ static void __attribute__((constructor)) __tracepoints__init(void) > __start___tracepoints_ptrs); > } > > +static void __attribute__((destructor)) __tracepoints__destroy(void) lttng_ust_notrace; > static void __attribute__((destructor)) __tracepoints__destroy(void) > { > int ret; > diff --git a/include/lttng/ust-compiler.h b/include/lttng/ust-compiler.h > new file mode 100644 > index 0000000..c35a23e > --- /dev/null > +++ b/include/lttng/ust-compiler.h > @@ -0,0 +1,21 @@ > +#ifndef _LTTNG_UST_COMPILER_H > +#define _LTTNG_UST_COMPILER_H > + > +/* > + * Copyright 2011-2012 - Mathieu Desnoyers > + * Paul Woegerer > + * > + * Permission is hereby granted, free of charge, to any person obtaining a copy > + * of this software and associated documentation files (the "Software"), to deal > + * in the Software without restriction, including without limitation the rights > + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > + * copies of the Software, and to permit persons to whom the Software is > + * furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice shall be included in > + * all copies or substantial portions of the Software. > + */ > + > +#define lttng_ust_notrace __attribute__((no_instrument_function)) > + > +#endif /* _LTTNG_UST_COMPILER_H */ > diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h > index 8db1e68..8628dbe 100644 > --- a/include/lttng/ust-tracepoint-event.h > +++ b/include/lttng/ust-tracepoint-event.h > @@ -16,6 +16,7 @@ > #include > #include > #include > +#include > #include > > /* > @@ -244,6 +245,7 @@ static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)); > > #undef TRACEPOINT_EVENT_CLASS > #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ > +static inline size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) lttng_ust_notrace; \ > static inline size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) \ > { \ > size_t __event_len = 0; \ > @@ -361,6 +363,7 @@ void __event_prepare_filter_stack__##_provider##___##_name(char *__stack_data,\ > #undef TRACEPOINT_EVENT_CLASS > #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ > static inline \ > +size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) lttng_ust_notrace; \ > size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \ > { \ > size_t __event_align = 1; \ > @@ -438,6 +441,7 @@ size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \ > */ > #undef TRACEPOINT_EVENT_CLASS > #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ > +static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) lttng_ust_notrace; \ > static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args))\ > { \ > struct ltt_event *__event = __tp_data; \ > @@ -594,6 +598,8 @@ static struct lttng_probe_desc _TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PR > /* Reset all macros within TRACEPOINT_EVENT */ > #include > static void __attribute__((constructor)) > +_TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) lttng_ust_notrace; > +static void __attribute__((constructor)) > _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) > { > int ret; > @@ -603,6 +609,8 @@ _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) > } > > static void __attribute__((destructor)) > +_TP_COMBINE_TOKENS(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void) lttng_ust_notrace; > +static void __attribute__((destructor)) > _TP_COMBINE_TOKENS(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void) > { > ltt_probe_unregister(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER)); > -- > 1.7.10.4 > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From Paul_Woegerer at mentor.com Wed Jul 18 08:51:43 2012 From: Paul_Woegerer at mentor.com (Woegerer, Paul) Date: Wed, 18 Jul 2012 14:51:43 +0200 Subject: [lttng-dev] notrace missing in lttng-ust In-Reply-To: <20120718114216.GA4061@Krystal> References: <4FED6718.1000205@mentor.com> <20120630181600.GB30747@Krystal> <4FF2A31D.9020100@mentor.com> <20120717141301.GA21204@Krystal> <500690E4.4020503@mentor.com> <20120718114216.GA4061@Krystal> Message-ID: <5006B15F.30509@mentor.com> On 07/18/2012 01:42 PM, Mathieu Desnoyers wrote: > e.g. here: > > static lttng_ust_notrace > void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, > struct channel *chan, void *priv, > size_t data_size, int largest_align, > int cpu, struct lttng_ust_shm_handle *handle) > { > ... body of function ... > } For ringbuffer-config.h that will work but if you try the same in tracepoint.h:258 with: static lttng_ust_notrace void __attribute__((constructor)) __tracepoints__init(void) you get: Making all in hello.cxx make[3]: Entering directory `/home/pwoegere/MGC/SA/lttng-ust/tests/hello.cxx' CXX hello.o In file included from ust_tests_hello.h:21:0, from hello.cpp:33: ../../include/lttng/tracepoint.h:258:60: error: can?t set ?no_instrument_function? attribute after definition or if you try it in the macro definitons at tracepoint.h:141 you get: Making all in hello.cxx make[3]: Entering directory `/home/pwoegere/MGC/SA/lttng-ust/tests/hello.cxx' CXX hello.o In file included from hello.cpp:33:0: ust_tests_hello.h:43:1: error: can?t set ?no_instrument_function? attribute after definition ust_tests_hello.h:43:1: error: can?t set ?no_instrument_function? attribute after definition ust_tests_hello.h:43:1: error: can?t set ?no_instrument_function? attribute after definition ust_tests_hello.h:48:1: error: can?t set ?no_instrument_function? attribute after definition ust_tests_hello.h:48:1: error: can?t set ?no_instrument_function? attribute after definition ust_tests_hello.h:48:1: error: can?t set ?no_instrument_function? attribute after definition Anyway I send you a patch that uses the attribute on the definitions wherever possible. -- Paul > > Thanks, > > Mathieu > >> { >> ctx->chan = chan; >> @@ -276,6 +282,8 @@ void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, >> * size_of_type must be non-zero. >> */ >> static inline >> +unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) lttng_ust_notrace; >> +static inline >> unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) >> { >> return offset_align(align_drift, size_of_type); >> @@ -290,6 +298,8 @@ unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) >> * size_of_type must be non-zero. >> */ >> static inline >> +unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) lttng_ust_notrace; >> +static inline >> unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) >> { >> return 0; >> @@ -303,6 +313,9 @@ unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) >> */ >> static inline >> void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, >> + size_t alignment) lttng_ust_notrace; >> +static inline >> +void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, >> size_t alignment) >> { >> ctx->buf_offset += lib_ring_buffer_align(ctx->buf_offset, >> @@ -316,6 +329,10 @@ void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, >> static inline >> int lib_ring_buffer_check_config(const struct lttng_ust_lib_ring_buffer_config *config, >> unsigned int switch_timer_interval, >> + unsigned int read_timer_interval) lttng_ust_notrace; >> +static inline >> +int lib_ring_buffer_check_config(const struct lttng_ust_lib_ring_buffer_config *config, >> + unsigned int switch_timer_interval, >> unsigned int read_timer_interval) >> { >> if (config->alloc == RING_BUFFER_ALLOC_GLOBAL >> diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h >> index 5bab476..77595d3 100644 >> --- a/include/lttng/tracepoint.h >> +++ b/include/lttng/tracepoint.h >> @@ -22,6 +22,7 @@ >> #include /* for memset */ >> #include >> #include /* for sdt */ >> +#include >> >> #ifdef LTTNG_UST_HAVE_SDT_INTEGRATION >> #define SDT_USE_VARIADIC >> @@ -137,6 +138,7 @@ extern "C" { >> >> #define _DECLARE_TRACEPOINT(_provider, _name, ...) \ >> extern struct tracepoint __tracepoint_##_provider##___##_name; \ >> +static inline void __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) lttng_ust_notrace; \ >> static inline void __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) \ >> { \ >> struct tracepoint_probe *__tp_probe; \ >> @@ -158,12 +160,16 @@ end: \ >> tp_rcu_read_unlock_bp(); \ >> } \ >> static inline void __tracepoint_register_##_provider##___##_name(char *name, \ >> + void (*func)(void), void *data) lttng_ust_notrace; \ >> +static inline void __tracepoint_register_##_provider##___##_name(char *name, \ >> void (*func)(void), void *data) \ >> { \ >> __tracepoint_probe_register(name, func, data, \ >> __tracepoint_##_provider##___##_name.signature); \ >> } \ >> static inline void __tracepoint_unregister_##_provider##___##_name(char *name, \ >> + void (*func)(void), void *data) lttng_ust_notrace; \ >> +static inline void __tracepoint_unregister_##_provider##___##_name(char *name, \ >> void (*func)(void), void *data) \ >> { \ >> __tracepoint_probe_unregister(name, func, data); \ >> @@ -249,6 +255,7 @@ int __tracepoint_registered >> struct tracepoint_dlopen tracepoint_dlopen >> __attribute__((weak, visibility("hidden"))); >> >> +static void __attribute__((constructor)) __tracepoints__init(void) lttng_ust_notrace; >> static void __attribute__((constructor)) __tracepoints__init(void) >> { >> if (__tracepoint_registered++) >> @@ -285,6 +292,7 @@ static void __attribute__((constructor)) __tracepoints__init(void) >> __start___tracepoints_ptrs); >> } >> >> +static void __attribute__((destructor)) __tracepoints__destroy(void) lttng_ust_notrace; >> static void __attribute__((destructor)) __tracepoints__destroy(void) >> { >> int ret; >> diff --git a/include/lttng/ust-compiler.h b/include/lttng/ust-compiler.h >> new file mode 100644 >> index 0000000..c35a23e >> --- /dev/null >> +++ b/include/lttng/ust-compiler.h >> @@ -0,0 +1,21 @@ >> +#ifndef _LTTNG_UST_COMPILER_H >> +#define _LTTNG_UST_COMPILER_H >> + >> +/* >> + * Copyright 2011-2012 - Mathieu Desnoyers >> + * Paul Woegerer >> + * >> + * Permission is hereby granted, free of charge, to any person obtaining a copy >> + * of this software and associated documentation files (the "Software"), to deal >> + * in the Software without restriction, including without limitation the rights >> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell >> + * copies of the Software, and to permit persons to whom the Software is >> + * furnished to do so, subject to the following conditions: >> + * >> + * The above copyright notice and this permission notice shall be included in >> + * all copies or substantial portions of the Software. >> + */ >> + >> +#define lttng_ust_notrace __attribute__((no_instrument_function)) >> + >> +#endif /* _LTTNG_UST_COMPILER_H */ >> diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h >> index 8db1e68..8628dbe 100644 >> --- a/include/lttng/ust-tracepoint-event.h >> +++ b/include/lttng/ust-tracepoint-event.h >> @@ -16,6 +16,7 @@ >> #include >> #include >> #include >> +#include >> #include >> >> /* >> @@ -244,6 +245,7 @@ static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)); >> >> #undef TRACEPOINT_EVENT_CLASS >> #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ >> +static inline size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) lttng_ust_notrace; \ >> static inline size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) \ >> { \ >> size_t __event_len = 0; \ >> @@ -361,6 +363,7 @@ void __event_prepare_filter_stack__##_provider##___##_name(char *__stack_data,\ >> #undef TRACEPOINT_EVENT_CLASS >> #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ >> static inline \ >> +size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) lttng_ust_notrace; \ >> size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \ >> { \ >> size_t __event_align = 1; \ >> @@ -438,6 +441,7 @@ size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \ >> */ >> #undef TRACEPOINT_EVENT_CLASS >> #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ >> +static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) lttng_ust_notrace; \ >> static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args))\ >> { \ >> struct ltt_event *__event = __tp_data; \ >> @@ -594,6 +598,8 @@ static struct lttng_probe_desc _TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PR >> /* Reset all macros within TRACEPOINT_EVENT */ >> #include >> static void __attribute__((constructor)) >> +_TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) lttng_ust_notrace; >> +static void __attribute__((constructor)) >> _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) >> { >> int ret; >> @@ -603,6 +609,8 @@ _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) >> } >> >> static void __attribute__((destructor)) >> +_TP_COMBINE_TOKENS(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void) lttng_ust_notrace; >> +static void __attribute__((destructor)) >> _TP_COMBINE_TOKENS(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void) >> { >> ltt_probe_unregister(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER)); >> -- >> 1.7.10.4 >> > -- Paul Woegerer | SW Development Engineer Mentor Embedded(tm) | Prinz Eugen Stra?e 72/2/4, Vienna, 1040 Austria P 43.1.535991320 Nucleus? | Linux? | Android(tm) | Services | UI | Multi-OS Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Make-lttng-ust-robust-against-finstrument-functions.patch Type: text/x-patch Size: 9666 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-Use-lttng_ust_notrace-on-definitons-instead-of-decla.patch Type: text/x-patch Size: 6395 bytes Desc: not available URL: From salman.rafiq at esk.fraunhofer.de Wed Jul 18 09:27:58 2012 From: salman.rafiq at esk.fraunhofer.de (Salman Rafiq) Date: Wed, 18 Jul 2012 15:27:58 +0200 Subject: [lttng-dev] Reading CTF trace from time T Message-ID: Hello All, I am tracing a user application using lttng kernel tracer, i.e., Start lttng kernel trace ./application Stop lttng kernel trace Before I was reading kernel CTF trace using babeltrace API's from beginning of trace, e.g., struct bt_iter_pos begin_pos struct bt_ctf_iter *iterator begin_pos.type = BT_SEEK_BEGIN iterator = create_iterator(context, &begin_pos, NULL) .. and then read events start from that iterator postion. Recently, I have been trying to seek trace using timestamp from when the application started to application end. I would like to know if I am doing it right. Would the method below enough to achieve this? Or I am missing something here :-S begin_pos.type = BT_SEEK_TIME end_pos.type = BT_SEEK_TIME begin_pos.u.seek_time = timestamp1 (for now manually taken from CTF kernel trace when application started) end_pos.u.seek_time = timestamp2 (for now manually taken from CTF kernel trace when application ended) iterator = create_iterator(context, &begin_pos, &end_pos); and then with reading events at iterator position until end_pos. I am using babeltrace package version "1.0.0-pre4". Any help related to achieving this functionality will be highly appreciated. Best Regards, Salman -- Salman Rafiq Industrial Communication Fraunhofer-Einrichtung f?r Systeme der Kommunikationstechnik ESK Hansastra?e 32 | 80686 M?nchen Telefon, Fax: +49 89 547088-356 | +49 89 547088-66-356 E-Mail: salman.rafiq at esk.fraunhofer.de Internet: http://www.esk.fraunhofer.de http://www.facebook.com/FraunhoferESK http://www.twitter.com/FraunhoferESK -------------- next part -------------- An HTML attachment was scrubbed... URL: From dgoulet at efficios.com Wed Jul 18 11:54:59 2012 From: dgoulet at efficios.com (David Goulet) Date: Wed, 18 Jul 2012 11:54:59 -0400 Subject: [lttng-dev] [RFC PATCH lttng-tools] relayd pipes and error handling In-Reply-To: References: Message-ID: <5006DC53.1040709@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 I'm pretty OK with that. I have utils_* function for that in lttng-sessiond/ ... I think I'm going to move them to common/ since they are pretty useful for the complete code tree. Cheers! David Christian Babeux: > Hi, > > The current relayd employ two set of pipes for command relaying > and thread quit signalling. The relay_cmd_pipe pipes are never > closed. Also, the thread_quit_pipe pipes are not closed in some > error cases (fail to parse args, fail to daemonize, etc.). Here is > a proposed way to cleanup and handle error cases. > > Thoughts? > > Thanks, > > Christian > > Fix: relayd relay_cmd_pipe/thread_quit_pipe should be closed on > exit/error. > > diff --git a/src/bin/lttng-relayd/main.c > b/src/bin/lttng-relayd/main.c index acc6ca8..55452b3 100644 --- > a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ > -231,14 +231,26 @@ void cleanup(void) > > DBG("Cleaning up"); > > + /* Close thread quit pipes */ for (i = 0; i < 2; i++) { if > (thread_quit_pipe[i] >= 0) { ret = close(thread_quit_pipe[i]); if > (ret) { - PERROR("close"); + > PERROR("close quit pipe"); } } } + + /* Close relay cmd pipes > */ + for (i = 0; i < 2; i++) { + if > (relay_cmd_pipe[i] >= 0) { + ret = > close(relay_cmd_pipe[i]); + if (ret) { + > PERROR("close cmd pipe"); + } + > } + } + } > > /* @@ -1479,7 +1491,7 @@ int main(int argc, char **argv) /* Parse > arguments */ progname = argv[0]; if ((ret = parse_args(argc, argv) > < 0)) { - goto error; + goto exit; } > > if ((ret = set_signal_handler()) < 0) { @@ -1491,7 +1503,7 @@ int > main(int argc, char **argv) ret = daemon(0, 0); if (ret < 0) { > PERROR("daemon"); - goto error; + > goto exit; } } > > @@ -1502,7 +1514,7 @@ int main(int argc, char **argv) if > (control_uri->port < 1024 || data_uri->port < 1024) { ERR("Need to > be root to use ports < 1024"); ret = -1; - > goto error; + goto exit; } } > > @@ -1567,6 +1579,7 @@ exit: if (!ret) { exit(EXIT_SUCCESS); } + > error: exit(EXIT_FAILURE); } > > _______________________________________________ lttng-dev mailing > list lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQBtxQAAoJEELoaioR9I02hjoH/RKfCg0r4nq5AnKDpxJIQEaC Cy0QUmLZ812prSDaHgoPBL8ItJ4XiLGmFxwj+F0RXP9sT2QuOsiHYRc3aKk1+X5u RMnIuqx4ZdkakeGkTtZMr3ujmy/vOj9NOMuZsigV9z7g/jL5uXzfL0eJcW9kJLQ3 cNEtdO519q9hInoxpRBkRQtJya1LHoT66oc5AK8TWMBCLjHzvTvvqWNSEBEOfQqH b7CulD3x6//DvnlVImA3zFNB2YXLvY6bL3XnU9I/DIEENjG1uAP+9/h+IzWRMNcS F0bttSrK9faUqBedMB81hadx0uLjpQxnIB9oFR2NEW/W1J3HAwwVN5YntZFo+lw= =BfP8 -----END PGP SIGNATURE----- From dgoulet at efficios.com Wed Jul 18 11:57:16 2012 From: dgoulet at efficios.com (David Goulet) Date: Wed, 18 Jul 2012 11:57:16 -0400 Subject: [lttng-dev] [PATCH lttng-tools] relayd fix missing option --help In-Reply-To: References: Message-ID: <5006DCDC.2040304@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hmmm... this patch does not apply with "git am"... I'll probably simply merge it my self since it's pretty trivial ;) Cheers! David Christian Babeux: > Fix missing getopt_long option for --help in relayd. > > diff --git a/src/bin/lttng-relayd/main.c > b/src/bin/lttng-relayd/main.c index 338341d..acc6ca8 100644 --- > a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ > -120,6 +120,7 @@ int parse_args(int argc, char **argv) { > "data-port", 1, 0, 'D' }, { "daemonize", 0, 0, 'd' }, { "output", > 1, 0, 'o' }, + { "help", 0, 0, 'h' }, { "verbose", 0, > 0, 'v' }, { NULL, 0, 0, 0 } }; > > _______________________________________________ lttng-dev mailing > list lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQBtzcAAoJEELoaioR9I02n/wIAKk2PgjPtiM5MkWUqcUECXMp STwxHFCltUVqV9JSM+11qKN5OTPHELp9N/GvHuJFhB9CrdSn+dN9hBrzec7/eqlX nQEMgFQV8gyshZg3HjjrTghYxGcnhxYyZx8Kjq0KlGngSOoAoNh5/fOrlrg2e8+H t/TCxFyGy1RbrJ9kMm5Ta4c4/FLJN34ajtiuFSX/bXjCAF+zEpXtHCBfUDV5fF/a nK+dVTfy/Bo65JtDUNptQmHzz6lffakNiZEqmynkPXG+i9eVsRB8/tSn8bx/EfVo HCaWLfz69UQMl378+b8gZLi45hSR/76WENabXVjE9F8t8a9gYmPwvlWNTYwteVE= =No56 -----END PGP SIGNATURE----- From mathieu.desnoyers at efficios.com Wed Jul 18 15:32:24 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Wed, 18 Jul 2012 15:32:24 -0400 Subject: [lttng-dev] notrace missing in lttng-ust In-Reply-To: <5006B15F.30509@mentor.com> References: <4FED6718.1000205@mentor.com> <20120630181600.GB30747@Krystal> <4FF2A31D.9020100@mentor.com> <20120717141301.GA21204@Krystal> <500690E4.4020503@mentor.com> <20120718114216.GA4061@Krystal> <5006B15F.30509@mentor.com> Message-ID: <20120718193224.GA8531@Krystal> I ended up pushing your work as: commit a8909ba54718ed54cefb1b839a5d41a065df09f9 Author: Paul Woegerer Date: Wed Jul 18 15:28:44 2012 -0400 Make lttng-ust robust against -finstrument-functions. [ Edit by Mathieu Desnoyers: We need to declare the no_instrument_function attribute on function declarations (rather than definition) for g++. Moved the attribute prior to the function declaration (rather than after) to follow the coding style within LTTng-UST. ] Signed-off-by: Mathieu Desnoyers Indeed, g++ is weird. Thanks! Mathieu * Woegerer, Paul (Paul_Woegerer at mentor.com) wrote: > On 07/18/2012 01:42 PM, Mathieu Desnoyers wrote: > >> e.g. here: >> >> static lttng_ust_notrace >> void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, >> struct channel *chan, void *priv, >> size_t data_size, int largest_align, >> int cpu, struct lttng_ust_shm_handle *handle) >> { >> ... body of function ... >> } > > For ringbuffer-config.h that will work but if you try the same in > tracepoint.h:258 with: > > static lttng_ust_notrace void __attribute__((constructor)) > __tracepoints__init(void) > > you get: > > Making all in hello.cxx > make[3]: Entering directory > `/home/pwoegere/MGC/SA/lttng-ust/tests/hello.cxx' > CXX hello.o > In file included from ust_tests_hello.h:21:0, > from hello.cpp:33: > ../../include/lttng/tracepoint.h:258:60: error: can?t set > ?no_instrument_function? attribute after definition > > or if you try it in the macro definitons at tracepoint.h:141 > > you get: > > Making all in hello.cxx > make[3]: Entering directory > `/home/pwoegere/MGC/SA/lttng-ust/tests/hello.cxx' > CXX hello.o > In file included from hello.cpp:33:0: > ust_tests_hello.h:43:1: error: can?t set ?no_instrument_function? > attribute after definition > ust_tests_hello.h:43:1: error: can?t set ?no_instrument_function? > attribute after definition > ust_tests_hello.h:43:1: error: can?t set ?no_instrument_function? > attribute after definition > ust_tests_hello.h:48:1: error: can?t set ?no_instrument_function? > attribute after definition > ust_tests_hello.h:48:1: error: can?t set ?no_instrument_function? > attribute after definition > ust_tests_hello.h:48:1: error: can?t set ?no_instrument_function? > attribute after definition > > > Anyway I send you a patch that uses the attribute on the definitions > wherever possible. > > -- > Paul > >> >> Thanks, >> >> Mathieu >> >>> { >>> ctx->chan = chan; >>> @@ -276,6 +282,8 @@ void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, >>> * size_of_type must be non-zero. >>> */ >>> static inline >>> +unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) lttng_ust_notrace; >>> +static inline >>> unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) >>> { >>> return offset_align(align_drift, size_of_type); >>> @@ -290,6 +298,8 @@ unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) >>> * size_of_type must be non-zero. >>> */ >>> static inline >>> +unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) lttng_ust_notrace; >>> +static inline >>> unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) >>> { >>> return 0; >>> @@ -303,6 +313,9 @@ unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) >>> */ >>> static inline >>> void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, >>> + size_t alignment) lttng_ust_notrace; >>> +static inline >>> +void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, >>> size_t alignment) >>> { >>> ctx->buf_offset += lib_ring_buffer_align(ctx->buf_offset, >>> @@ -316,6 +329,10 @@ void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, >>> static inline >>> int lib_ring_buffer_check_config(const struct lttng_ust_lib_ring_buffer_config *config, >>> unsigned int switch_timer_interval, >>> + unsigned int read_timer_interval) lttng_ust_notrace; >>> +static inline >>> +int lib_ring_buffer_check_config(const struct lttng_ust_lib_ring_buffer_config *config, >>> + unsigned int switch_timer_interval, >>> unsigned int read_timer_interval) >>> { >>> if (config->alloc == RING_BUFFER_ALLOC_GLOBAL >>> diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h >>> index 5bab476..77595d3 100644 >>> --- a/include/lttng/tracepoint.h >>> +++ b/include/lttng/tracepoint.h >>> @@ -22,6 +22,7 @@ >>> #include /* for memset */ >>> #include >>> #include /* for sdt */ >>> +#include >>> #ifdef LTTNG_UST_HAVE_SDT_INTEGRATION >>> #define SDT_USE_VARIADIC >>> @@ -137,6 +138,7 @@ extern "C" { >>> #define _DECLARE_TRACEPOINT(_provider, _name, ...) \ >>> extern struct tracepoint __tracepoint_##_provider##___##_name; \ >>> +static inline void __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) lttng_ust_notrace; \ >>> static inline void __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) \ >>> { \ >>> struct tracepoint_probe *__tp_probe; \ >>> @@ -158,12 +160,16 @@ end: \ >>> tp_rcu_read_unlock_bp(); \ >>> } \ >>> static inline void __tracepoint_register_##_provider##___##_name(char *name, \ >>> + void (*func)(void), void *data) lttng_ust_notrace; \ >>> +static inline void __tracepoint_register_##_provider##___##_name(char *name, \ >>> void (*func)(void), void *data) \ >>> { \ >>> __tracepoint_probe_register(name, func, data, \ >>> __tracepoint_##_provider##___##_name.signature); \ >>> } \ >>> static inline void __tracepoint_unregister_##_provider##___##_name(char *name, \ >>> + void (*func)(void), void *data) lttng_ust_notrace; \ >>> +static inline void __tracepoint_unregister_##_provider##___##_name(char *name, \ >>> void (*func)(void), void *data) \ >>> { \ >>> __tracepoint_probe_unregister(name, func, data); \ >>> @@ -249,6 +255,7 @@ int __tracepoint_registered >>> struct tracepoint_dlopen tracepoint_dlopen >>> __attribute__((weak, visibility("hidden"))); >>> +static void __attribute__((constructor)) __tracepoints__init(void) >>> lttng_ust_notrace; >>> static void __attribute__((constructor)) __tracepoints__init(void) >>> { >>> if (__tracepoint_registered++) >>> @@ -285,6 +292,7 @@ static void __attribute__((constructor)) __tracepoints__init(void) >>> __start___tracepoints_ptrs); >>> } >>> +static void __attribute__((destructor)) >>> __tracepoints__destroy(void) lttng_ust_notrace; >>> static void __attribute__((destructor)) __tracepoints__destroy(void) >>> { >>> int ret; >>> diff --git a/include/lttng/ust-compiler.h b/include/lttng/ust-compiler.h >>> new file mode 100644 >>> index 0000000..c35a23e >>> --- /dev/null >>> +++ b/include/lttng/ust-compiler.h >>> @@ -0,0 +1,21 @@ >>> +#ifndef _LTTNG_UST_COMPILER_H >>> +#define _LTTNG_UST_COMPILER_H >>> + >>> +/* >>> + * Copyright 2011-2012 - Mathieu Desnoyers >>> + * Paul Woegerer >>> + * >>> + * Permission is hereby granted, free of charge, to any person obtaining a copy >>> + * of this software and associated documentation files (the "Software"), to deal >>> + * in the Software without restriction, including without limitation the rights >>> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell >>> + * copies of the Software, and to permit persons to whom the Software is >>> + * furnished to do so, subject to the following conditions: >>> + * >>> + * The above copyright notice and this permission notice shall be included in >>> + * all copies or substantial portions of the Software. >>> + */ >>> + >>> +#define lttng_ust_notrace __attribute__((no_instrument_function)) >>> + >>> +#endif /* _LTTNG_UST_COMPILER_H */ >>> diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h >>> index 8db1e68..8628dbe 100644 >>> --- a/include/lttng/ust-tracepoint-event.h >>> +++ b/include/lttng/ust-tracepoint-event.h >>> @@ -16,6 +16,7 @@ >>> #include >>> #include >>> #include >>> +#include >>> #include >>> /* >>> @@ -244,6 +245,7 @@ static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)); >>> #undef TRACEPOINT_EVENT_CLASS >>> #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ >>> +static inline size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) lttng_ust_notrace; \ >>> static inline size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) \ >>> { \ >>> size_t __event_len = 0; \ >>> @@ -361,6 +363,7 @@ void __event_prepare_filter_stack__##_provider##___##_name(char *__stack_data,\ >>> #undef TRACEPOINT_EVENT_CLASS >>> #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ >>> static inline \ >>> +size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) lttng_ust_notrace; \ >>> size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \ >>> { \ >>> size_t __event_align = 1; \ >>> @@ -438,6 +441,7 @@ size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \ >>> */ >>> #undef TRACEPOINT_EVENT_CLASS >>> #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ >>> +static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) lttng_ust_notrace; \ >>> static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args))\ >>> { \ >>> struct ltt_event *__event = __tp_data; \ >>> @@ -594,6 +598,8 @@ static struct lttng_probe_desc _TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PR >>> /* Reset all macros within TRACEPOINT_EVENT */ >>> #include >>> static void __attribute__((constructor)) >>> +_TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) lttng_ust_notrace; >>> +static void __attribute__((constructor)) >>> _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) >>> { >>> int ret; >>> @@ -603,6 +609,8 @@ _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) >>> } >>> static void __attribute__((destructor)) >>> +_TP_COMBINE_TOKENS(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void) lttng_ust_notrace; >>> +static void __attribute__((destructor)) >>> _TP_COMBINE_TOKENS(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void) >>> { >>> ltt_probe_unregister(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER)); >>> -- >>> 1.7.10.4 >>> >> > > > -- > Paul Woegerer | SW Development Engineer > Mentor Embedded(tm) | Prinz Eugen Stra?e 72/2/4, Vienna, 1040 Austria > P 43.1.535991320 > Nucleus? | Linux? | Android(tm) | Services | UI | Multi-OS > > Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions. > Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. > > From 46e709a85edbca6b9c869148cadd2abac2f98acf Mon Sep 17 00:00:00 2001 > From: Paul Woegerer > Date: Wed, 18 Jul 2012 12:27:07 +0200 > Subject: [PATCH 1/2] Make lttng-ust robust against -finstrument-functions. > > --- > include/Makefile.am | 1 + > include/lttng/ringbuffer-config.h | 17 +++++++++++++++++ > include/lttng/tracepoint.h | 8 ++++++++ > include/lttng/ust-compiler.h | 21 +++++++++++++++++++++ > include/lttng/ust-tracepoint-event.h | 8 ++++++++ > 5 files changed, 55 insertions(+) > create mode 100644 include/lttng/ust-compiler.h > > diff --git a/include/Makefile.am b/include/Makefile.am > index 633260b..208e74e 100644 > --- a/include/Makefile.am > +++ b/include/Makefile.am > @@ -14,6 +14,7 @@ nobase_include_HEADERS = \ > lttng/ringbuffer-abi.h \ > lttng/ust-tracer.h \ > lttng/ust-config.h \ > + lttng/ust-compiler.h \ > lttng/ust.h \ > lttng/ust-endian.h \ > lttng/ringbuffer-config.h \ > diff --git a/include/lttng/ringbuffer-config.h b/include/lttng/ringbuffer-config.h > index 24e7dbe..408d95a 100644 > --- a/include/lttng/ringbuffer-config.h > +++ b/include/lttng/ringbuffer-config.h > @@ -27,6 +27,7 @@ > #include > #include > #include "lttng/align.h" > +#include > > struct lttng_ust_lib_ring_buffer; > struct channel; > @@ -232,6 +233,11 @@ static inline > void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, > struct channel *chan, void *priv, > size_t data_size, int largest_align, > + int cpu, struct lttng_ust_shm_handle *handle) lttng_ust_notrace; > +static inline > +void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, > + struct channel *chan, void *priv, > + size_t data_size, int largest_align, > int cpu, struct lttng_ust_shm_handle *handle) > { > ctx->chan = chan; > @@ -276,6 +282,8 @@ void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, > * size_of_type must be non-zero. > */ > static inline > +unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) lttng_ust_notrace; > +static inline > unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) > { > return offset_align(align_drift, size_of_type); > @@ -290,6 +298,8 @@ unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) > * size_of_type must be non-zero. > */ > static inline > +unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) lttng_ust_notrace; > +static inline > unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) > { > return 0; > @@ -303,6 +313,9 @@ unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) > */ > static inline > void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, > + size_t alignment) lttng_ust_notrace; > +static inline > +void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, > size_t alignment) > { > ctx->buf_offset += lib_ring_buffer_align(ctx->buf_offset, > @@ -316,6 +329,10 @@ void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, > static inline > int lib_ring_buffer_check_config(const struct lttng_ust_lib_ring_buffer_config *config, > unsigned int switch_timer_interval, > + unsigned int read_timer_interval) lttng_ust_notrace; > +static inline > +int lib_ring_buffer_check_config(const struct lttng_ust_lib_ring_buffer_config *config, > + unsigned int switch_timer_interval, > unsigned int read_timer_interval) > { > if (config->alloc == RING_BUFFER_ALLOC_GLOBAL > diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h > index 5bab476..77595d3 100644 > --- a/include/lttng/tracepoint.h > +++ b/include/lttng/tracepoint.h > @@ -22,6 +22,7 @@ > #include /* for memset */ > #include > #include /* for sdt */ > +#include > > #ifdef LTTNG_UST_HAVE_SDT_INTEGRATION > #define SDT_USE_VARIADIC > @@ -137,6 +138,7 @@ extern "C" { > > #define _DECLARE_TRACEPOINT(_provider, _name, ...) \ > extern struct tracepoint __tracepoint_##_provider##___##_name; \ > +static inline void __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) lttng_ust_notrace; \ > static inline void __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) \ > { \ > struct tracepoint_probe *__tp_probe; \ > @@ -158,12 +160,16 @@ end: \ > tp_rcu_read_unlock_bp(); \ > } \ > static inline void __tracepoint_register_##_provider##___##_name(char *name, \ > + void (*func)(void), void *data) lttng_ust_notrace; \ > +static inline void __tracepoint_register_##_provider##___##_name(char *name, \ > void (*func)(void), void *data) \ > { \ > __tracepoint_probe_register(name, func, data, \ > __tracepoint_##_provider##___##_name.signature); \ > } \ > static inline void __tracepoint_unregister_##_provider##___##_name(char *name, \ > + void (*func)(void), void *data) lttng_ust_notrace; \ > +static inline void __tracepoint_unregister_##_provider##___##_name(char *name, \ > void (*func)(void), void *data) \ > { \ > __tracepoint_probe_unregister(name, func, data); \ > @@ -249,6 +255,7 @@ int __tracepoint_registered > struct tracepoint_dlopen tracepoint_dlopen > __attribute__((weak, visibility("hidden"))); > > +static void __attribute__((constructor)) __tracepoints__init(void) lttng_ust_notrace; > static void __attribute__((constructor)) __tracepoints__init(void) > { > if (__tracepoint_registered++) > @@ -285,6 +292,7 @@ static void __attribute__((constructor)) __tracepoints__init(void) > __start___tracepoints_ptrs); > } > > +static void __attribute__((destructor)) __tracepoints__destroy(void) lttng_ust_notrace; > static void __attribute__((destructor)) __tracepoints__destroy(void) > { > int ret; > diff --git a/include/lttng/ust-compiler.h b/include/lttng/ust-compiler.h > new file mode 100644 > index 0000000..c35a23e > --- /dev/null > +++ b/include/lttng/ust-compiler.h > @@ -0,0 +1,21 @@ > +#ifndef _LTTNG_UST_COMPILER_H > +#define _LTTNG_UST_COMPILER_H > + > +/* > + * Copyright 2011-2012 - Mathieu Desnoyers > + * Paul Woegerer > + * > + * Permission is hereby granted, free of charge, to any person obtaining a copy > + * of this software and associated documentation files (the "Software"), to deal > + * in the Software without restriction, including without limitation the rights > + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > + * copies of the Software, and to permit persons to whom the Software is > + * furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice shall be included in > + * all copies or substantial portions of the Software. > + */ > + > +#define lttng_ust_notrace __attribute__((no_instrument_function)) > + > +#endif /* _LTTNG_UST_COMPILER_H */ > diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h > index 8db1e68..8628dbe 100644 > --- a/include/lttng/ust-tracepoint-event.h > +++ b/include/lttng/ust-tracepoint-event.h > @@ -16,6 +16,7 @@ > #include > #include > #include > +#include > #include > > /* > @@ -244,6 +245,7 @@ static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)); > > #undef TRACEPOINT_EVENT_CLASS > #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ > +static inline size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) lttng_ust_notrace; \ > static inline size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) \ > { \ > size_t __event_len = 0; \ > @@ -361,6 +363,7 @@ void __event_prepare_filter_stack__##_provider##___##_name(char *__stack_data,\ > #undef TRACEPOINT_EVENT_CLASS > #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ > static inline \ > +size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) lttng_ust_notrace; \ > size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \ > { \ > size_t __event_align = 1; \ > @@ -438,6 +441,7 @@ size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \ > */ > #undef TRACEPOINT_EVENT_CLASS > #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ > +static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) lttng_ust_notrace; \ > static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args))\ > { \ > struct ltt_event *__event = __tp_data; \ > @@ -594,6 +598,8 @@ static struct lttng_probe_desc _TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PR > /* Reset all macros within TRACEPOINT_EVENT */ > #include > static void __attribute__((constructor)) > +_TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) lttng_ust_notrace; > +static void __attribute__((constructor)) > _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) > { > int ret; > @@ -603,6 +609,8 @@ _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) > } > > static void __attribute__((destructor)) > +_TP_COMBINE_TOKENS(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void) lttng_ust_notrace; > +static void __attribute__((destructor)) > _TP_COMBINE_TOKENS(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void) > { > ltt_probe_unregister(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER)); > -- > 1.7.10.4 > > From 94372244110b3bc5e3223310525b349c8320be7e Mon Sep 17 00:00:00 2001 > From: Paul Woegerer > Date: Wed, 18 Jul 2012 14:46:25 +0200 > Subject: [PATCH 2/2] Use lttng_ust_notrace on definitons (instead of > declarations) where possible. > > --- > include/lttng/ringbuffer-config.h | 26 +++++--------------------- > include/lttng/ust-tracepoint-event.h | 17 +++++------------ > 2 files changed, 10 insertions(+), 33 deletions(-) > > diff --git a/include/lttng/ringbuffer-config.h b/include/lttng/ringbuffer-config.h > index 408d95a..558e071 100644 > --- a/include/lttng/ringbuffer-config.h > +++ b/include/lttng/ringbuffer-config.h > @@ -229,12 +229,7 @@ struct lttng_ust_lib_ring_buffer_ctx { > * @largest_align: largest alignment within data payload types > * @cpu: processor id > */ > -static inline > -void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, > - struct channel *chan, void *priv, > - size_t data_size, int largest_align, > - int cpu, struct lttng_ust_shm_handle *handle) lttng_ust_notrace; > -static inline > +static inline lttng_ust_notrace > void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, > struct channel *chan, void *priv, > size_t data_size, int largest_align, > @@ -281,9 +276,7 @@ void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, > * Calculate the offset needed to align the type. > * size_of_type must be non-zero. > */ > -static inline > -unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) lttng_ust_notrace; > -static inline > +static inline lttng_ust_notrace > unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) > { > return offset_align(align_drift, size_of_type); > @@ -297,9 +290,7 @@ unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) > * Calculate the offset needed to align the type. > * size_of_type must be non-zero. > */ > -static inline > -unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) lttng_ust_notrace; > -static inline > +static inline lttng_ust_notrace > unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) > { > return 0; > @@ -311,10 +302,7 @@ unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) > * lib_ring_buffer_align_ctx - Align context offset on "alignment" > * @ctx: ring buffer context. > */ > -static inline > -void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, > - size_t alignment) lttng_ust_notrace; > -static inline > +static inline lttng_ust_notrace > void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, > size_t alignment) > { > @@ -326,11 +314,7 @@ void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, > * lib_ring_buffer_check_config() returns 0 on success. > * Used internally to check for valid configurations at channel creation. > */ > -static inline > -int lib_ring_buffer_check_config(const struct lttng_ust_lib_ring_buffer_config *config, > - unsigned int switch_timer_interval, > - unsigned int read_timer_interval) lttng_ust_notrace; > -static inline > +static inline lttng_ust_notrace > int lib_ring_buffer_check_config(const struct lttng_ust_lib_ring_buffer_config *config, > unsigned int switch_timer_interval, > unsigned int read_timer_interval) > diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h > index 8628dbe..6fbd1d8 100644 > --- a/include/lttng/ust-tracepoint-event.h > +++ b/include/lttng/ust-tracepoint-event.h > @@ -245,8 +245,7 @@ static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)); > > #undef TRACEPOINT_EVENT_CLASS > #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ > -static inline size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) lttng_ust_notrace; \ > -static inline size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) \ > +static inline lttng_ust_notrace size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) \ > { \ > size_t __event_len = 0; \ > unsigned int __dynamic_len_idx = 0; \ > @@ -362,8 +361,7 @@ void __event_prepare_filter_stack__##_provider##___##_name(char *__stack_data,\ > > #undef TRACEPOINT_EVENT_CLASS > #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ > -static inline \ > -size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) lttng_ust_notrace; \ > +static inline lttng_ust_notrace \ > size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \ > { \ > size_t __event_align = 1; \ > @@ -441,8 +439,7 @@ size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \ > */ > #undef TRACEPOINT_EVENT_CLASS > #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ > -static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) lttng_ust_notrace; \ > -static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args))\ > +static lttng_ust_notrace void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args))\ > { \ > struct ltt_event *__event = __tp_data; \ > struct ltt_channel *__chan = __event->chan; \ > @@ -597,9 +594,7 @@ static struct lttng_probe_desc _TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PR > > /* Reset all macros within TRACEPOINT_EVENT */ > #include > -static void __attribute__((constructor)) > -_TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) lttng_ust_notrace; > -static void __attribute__((constructor)) > +static lttng_ust_notrace void __attribute__((constructor)) > _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) > { > int ret; > @@ -608,9 +603,7 @@ _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) > assert(!ret); > } > > -static void __attribute__((destructor)) > -_TP_COMBINE_TOKENS(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void) lttng_ust_notrace; > -static void __attribute__((destructor)) > +static lttng_ust_notrace void __attribute__((destructor)) > _TP_COMBINE_TOKENS(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void) > { > ltt_probe_unregister(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER)); > -- > 1.7.10.4 > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From Paul_Woegerer at mentor.com Thu Jul 19 03:26:54 2012 From: Paul_Woegerer at mentor.com (Woegerer, Paul) Date: Thu, 19 Jul 2012 09:26:54 +0200 Subject: [lttng-dev] LTTng-UST alternative to LD_PRELOAD In-Reply-To: <1339945703.2599.21.camel@DellE5500> References: <1339945703.2599.21.camel@DellE5500> Message-ID: <5007B6BE.4020209@mentor.com> On 06/17/2012 05:08 PM, Lars wrote: > Hello, > > I have recently started to use LTTng-UST and am using LD_PRELOAD > to make it possilbe to execute instrumented code on systems without > LTTng-UST installed. > > To define LD_PRELOAD however affects too much. For instance all > forked processes also get the library loaded. This can be fixed by > removing the library from the LD_PRELOAD variable early in the main > function. This looks odd and required some explaining in comments. > > Also, in my case, the instrumented program is started with a "wrapper" > program which I can not alter. This wrapper also gets the library > loaded. > > As an alternative to using LD_PRELOAD I would like to use an explicit > function, like; > > int traceload(char const* library_path); > > that is called early in main (instead of the LD_PRELOAD environment > manipulation) and loads the library with dlopen if it exists. > > I have already tried this (of course) and it almost works already. > The tracepoints becomes visible but I get no trace data written. > So I think a really small modification is needed. Another alternative would be to implement an lttng-backend for latrace ( see: http://people.redhat.com/jolsa/latrace/index.shtml ). Library calls from the following headers are supported as of version 0.5.11: ctype.h dlfcn.h getopt.h ioctl.h libintl.h locale.h mman.h netdb.h pwd.h signal.h stat.h stdlib.h sysdeps term.h time.h unistd.h wait.h dirent.h fcntl.h inet.h latrace.h libio.h misc.h ncurses.h pthread.h resource.h socket.h stdio.h string.h syslog.h termios.h typedefs.h utmp.h So if we let latrace optionally emit lttng events for call enter and exit we would instantly get support for tracing for _any_ library call. -- Paul -- Paul Woegerer | SW Development Engineer Mentor Embedded(tm) | Prinz Eugen Stra?e 72/2/4, Vienna, 1040 Austria P 43.1.535991320 Nucleus? | Linux? | Android(tm) | Services | UI | Multi-OS Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. From Fredrik_Oestman at mentor.com Thu Jul 19 05:30:54 2012 From: Fredrik_Oestman at mentor.com (Oestman, Fredrik) Date: Thu, 19 Jul 2012 09:30:54 +0000 Subject: [lttng-dev] [babeltrace] FTS does not support large files on 32-bit In-Reply-To: <4FF4A996.8040606@gmail.com> References: <20120630185335.GA31235@Krystal> <4FF4A996.8040606@gmail.com> Message-ID: <524C960C5DFC794E82BE548D825F05CF56CB608F@EU-MBX-04.mgc.mentorg.com> Hi Yannick and Julien, Yannick Brosseau wrote: > FTS does not use callbacks, which makes it easier to use. > Also since it was supposed to be part of the babeltrace API, not having > to manage a callbacks looked better. > > Might had other reasons at the time, but now I don't see any more. Are you making any progress in supplying large file support in babeltrace? Would it be helpful if I filed a bug report? Cheers, Fredrik ?stman From zheng.chang at emc.com Thu Jul 19 05:33:31 2012 From: zheng.chang at emc.com (changz) Date: Thu, 19 Jul 2012 17:33:31 +0800 Subject: [lttng-dev] Question about zero metadata Message-ID: <5007D46B.3060205@emc.com> Hi all, I tried to generate one event and view the trace at run-time. It didn't work because metadata was zero. And then I found metadata couldn't be dumped to disk when sub-buffer were not filled(i.e. consumer daemon didn't read data from ring-buffer). And seems no timer to flush it because I waited for very long time. Once I stopped lttng or the application, metadata got ready at once. My lttng version is 2.01. Is this a known issue? Thanks Zheng From r.han at umiami.edu Thu Jul 19 17:55:34 2012 From: r.han at umiami.edu (Rui Han) Date: Thu, 19 Jul 2012 17:55:34 -0400 Subject: [lttng-dev] Question about file descriptor of sockets and pipes Message-ID: Hi All, What does the number "6454" and "6455" in the following dump information stand for? Are they pipe number and socket number? How did they generated, I want to figure out what process is using it, where should I start? Thank you very much. lttng_statedump_file_descriptor: { cpu_id = 0 }, { pid = 1, fd = 3, filename = "pipe:[6454]" } lttng_statedump_file_descriptor: { cpu_id = 0 }, { pid = 1, fd = 7, filename = "socket:[6455]" } Regards, Rui -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu.desnoyers at efficios.com Thu Jul 19 18:04:37 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 19 Jul 2012 18:04:37 -0400 Subject: [lttng-dev] Question about file descriptor of sockets and pipes In-Reply-To: References: Message-ID: <20120719220437.GB28181@Krystal> * Rui Han (r.han at umiami.edu) wrote: > Hi All, > > What does the number "6454" and "6455" in the following dump information > stand for? Are they pipe number and socket number? How did they generated, > I want to figure out what process is using it, where should I start? Thank > you very much. > > lttng_statedump_file_descriptor: { cpu_id = 0 }, { pid = 1, fd = 3, > filename = "pipe:[6454]" } > lttng_statedump_file_descriptor: { cpu_id = 0 }, { pid = 1, fd = 7, > filename = "socket:[6455]" } This is the file name assigned internally to the pipe and socket file descriptors by the Linux kernel. You might want to compare this with the output of "lsof". This might be the "NODE" value (to be confirmed). Thanks, Mathieu > > Regards, > Rui > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From Bingfeng.Zhao at emc.com Thu Jul 19 22:10:26 2012 From: Bingfeng.Zhao at emc.com (Bingfeng.Zhao at emc.com) Date: Thu, 19 Jul 2012 22:10:26 -0400 Subject: [lttng-dev] some questions on lttng In-Reply-To: <4B3E7C3D6AE874479212F4D6AE0AFD1F02C7FF0741@MX28A.corp.emc.com> References: <4B3E7C3D6AE874479212F4D6AE0AFD1F02C7FF0741@MX28A.corp.emc.com> Message-ID: <4B3E7C3D6AE874479212F4D6AE0AFD1F02C7FF0805@MX28A.corp.emc.com> Anyone can answer our questions? Mathieu? From: Bingfeng.Zhao at emc.com [mailto:Bingfeng.Zhao at emc.com] Sent: Wednesday, July 18, 2012 5:54 PM To: lttng-dev at lists.lttng.org Subject: [lttng-dev] some questions on lttng Hello the dev list, We encounter some basic questions when try to adapt the LTTNG in our poject. 1. When the trace is enabled and all are well configurated, we get trace messages collected under the session folder. The question is whether it is possible that some traces will lost when the trace messages are huge. How will LTTNG do if the consumer deamon cannot fast enough to copy the trace message from trace buffer? 2. For user space trace, currectly seems we cannot set the flush interval. How can we control the flush internal for UST? If no, is there hardcoded or random flash interval? Or there is no time based flush mechanism at all for UST? 3. For a severe kernel panic can we extrace buffered trace messages from LTTNG internal buffer in full memory core dump file? Is there tools on this we can leverage? Thank you, - Bingfeng -------------- next part -------------- An HTML attachment was scrubbed... URL: From Paul_Woegerer at mentor.com Fri Jul 20 02:39:14 2012 From: Paul_Woegerer at mentor.com (Woegerer, Paul) Date: Fri, 20 Jul 2012 08:39:14 +0200 Subject: [lttng-dev] some questions on lttng In-Reply-To: <4B3E7C3D6AE874479212F4D6AE0AFD1F02C7FF0805@MX28A.corp.emc.com> References: <4B3E7C3D6AE874479212F4D6AE0AFD1F02C7FF0741@MX28A.corp.emc.com> <4B3E7C3D6AE874479212F4D6AE0AFD1F02C7FF0805@MX28A.corp.emc.com> Message-ID: <5008FD12.4040803@mentor.com> On 07/20/2012 04:10 AM, Bingfeng.Zhao at emc.com wrote: > > Anyone can answer our questions? Mathieu? > > *From:*Bingfeng.Zhao at emc.com [mailto:Bingfeng.Zhao at emc.com] > *Sent:* Wednesday, July 18, 2012 5:54 PM > *To:* lttng-dev at lists.lttng.org > *Subject:* [lttng-dev] some questions on lttng > > Hello the dev list, > > We encounter some basic questions when try to adapt the LTTNG in our > poject. > > 1.When the trace is enabled and all are well configurated, we get > trace messages collected under the session folder. The question is > whether it is possible that some traces will lost when the trace > messages are huge. How will LTTNG do if the consumer deamon cannot > fast enough to copy the trace message from trace buffer? > I had similar concerns ... http://lists.lttng.org/pipermail/lttng-dev/2012-April/017869.html http://lists.lttng.org/pipermail/lttng-dev/2012-April/017835.html AFAIK, there is no solution for this issue yet. -- Paul -- Paul Woegerer | SW Development Engineer Mentor Embedded(tm) | Prinz Eugen Stra?e 72/2/4, Vienna, 1040 Austria P 43.1.535991320 Nucleus? | Linux? | Android(tm) | Services | UI | Multi-OS Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Luay.Alawneh at nuance.com Fri Jul 20 10:08:33 2012 From: Luay.Alawneh at nuance.com (Alawneh, Luay) Date: Fri, 20 Jul 2012 14:08:33 +0000 Subject: [lttng-dev] LTTng Message-ID: Hi, I am reading about LTTng and I would like to know if it can replace Log4c for logging user space events in the production environment. In addition to the method enter/exit events we also use Log4c to log many other events to indicate errors and other useful information. To summarize, I would like to know if LTTng can be used in a production environment for logging different types of events. We are planning to replace Log4c with another logging framework to improve the performance by reducing the time spent in logging. Thanks, Luay Alawneh Nuance Communications -------------- next part -------------- An HTML attachment was scrubbed... URL: From dgoulet at efficios.com Fri Jul 20 10:28:32 2012 From: dgoulet at efficios.com (David Goulet) Date: Fri, 20 Jul 2012 10:28:32 -0400 Subject: [lttng-dev] Question about zero metadata In-Reply-To: <5007D46B.3060205@emc.com> References: <5007D46B.3060205@emc.com> Message-ID: <50096B10.9030808@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hi Zheng, In order to be able to read the trace, you have to stop the session (lttng stop) and a flush is automatically done in the background. However, reading a trace while it is being created (live reading) is on the roadmap for LTTng 2.2 or later. So, for now, you need to start/stop the tracing session. Thanks! David changz: > Hi all, > > I tried to generate one event and view the trace at run-time. It > didn't work because metadata was zero. And then I found metadata > couldn't be dumped to disk when sub-buffer were not filled(i.e. > consumer daemon didn't read data from ring-buffer). And seems no > timer to flush it because I waited for very long time. Once I > stopped lttng or the application, metadata got ready at once. > > My lttng version is 2.01. Is this a known issue? > > Thanks Zheng > > _______________________________________________ lttng-dev mailing > list lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQCWsMAAoJEELoaioR9I02DFwH/A6mGfvwOqshhqCspYAsdBev ZmJ0PsT5q6JqmJcbwasMdH9CgEUBb9Kx+H9Jr8cJNfZLq6mk/sNLvz3CUy1HUsKF TsAnXImbFs00+mFTE8rn296SXkzfz9boB1ROU9OqDfLJvdNZYSdivCadSBDS9dap 5rrXT5ktILb2h9UoupUqpW9sGZwANmCPuVNnIM2AYBvKFbtqoqWhQldWr8Qg87D3 JdkK+5OFDficGpGUOXhcEoDFzit95TzDYqE6aN7k8TW8H1RrcQ1TPf2bFfO20PZF T6XFVzkbzmUWvzbVfAIiRC0YtmyTojTn+45htkRF6VVPWQivxVrMq50XUXuzsyo= =/52f -----END PGP SIGNATURE----- From dgoulet at efficios.com Fri Jul 20 10:56:14 2012 From: dgoulet at efficios.com (David Goulet) Date: Fri, 20 Jul 2012 10:56:14 -0400 Subject: [lttng-dev] LTTng In-Reply-To: References: Message-ID: <5009718E.8020308@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hi Luay, I am not aware of any Log4c --> LTTng transition work done up to this day... One thing I can say is that user space tracing using LTTng will certainly improve speed and scalability performance. The event LOGLEVEL feature is pretty interesting for that where you can only enable a certain loglevel facility for a trace (exactly like the syslog facilities). You can refer to the lttng-ust(3) man page for more information. Moreover, you can also couple kernel traces to your user space traces which can give you way more information :). I guess that if now one replies to this thread describing their experience with log4c vs lttng, you guys will be the first to try a transition and we will be more than happy to help you with any bugs or difficulties you'll encounter :) Moreover, if you are able to come up with some sort of scripts/recipe for that, it will be the kind of documentation or tool that could benefit big time the community! :) Feel free to ask on the mailing list any concerns/questions/comments you have. Cheers! David Alawneh, Luay: > Hi, > > > > I am reading about LTTng and I would like to know if it can > replace Log4c for logging user space events in the production > environment. In addition to the method enter/exit events we also > use Log4c to log many other events to indicate errors and other > useful information. > > > > To summarize, I would like to know if LTTng can be used in a > production environment for logging different types of events. We > are planning to replace Log4c with another logging framework to > improve the performance by reducing the time spent in logging. > > > > Thanks, > > > > Luay Alawneh > > Nuance Communications > > > > > > This body part will be downloaded on demand. -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQCXGLAAoJEELoaioR9I02u0YH/3MGDZJuzI6iTh4oVvXGeoAl NkKjNOU6c/vrsPbys+sNnlczg8CyezT6nL8DOeLkhg/HBAS6JtJngULOwBaSiNV3 J4/SD6Y/Fa96oJnOR5pLUBVdLxrkdOhPvwEiUd2L1DIugrZKJ8pTxs28lX59ltq+ 3s59b20pJw9hNEHeDRc7MUY5fEa6t0FNYONsnYqUEEyLeZwYydHz1offgTG2dAhC FzUCsG1Xzq2TT5PkA/M9ZNu3YQlDJOOzPOY/9A+O9rI5993iAab/lZ/jaDAgZZ0j 4JpHzJGjaqF0XuY+3FpfoPC/DFqBBEjnzXzBTUQahmX7KjzqmdxQIwBiiiloMHg= =Z97t -----END PGP SIGNATURE----- From mathieu.desnoyers at efficios.com Fri Jul 20 13:02:33 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 20 Jul 2012 13:02:33 -0400 Subject: [lttng-dev] LTTng In-Reply-To: References: Message-ID: <20120720170233.GA18851@Krystal> One small detail to keep in mind at this point: only the "discard" and "overwrite" modes are implemented for handling buffer condition. If you need to ensure that events are _never_ discarded, even with high-throughput scenarios, we might need to implement a "blocking" mode, which makes the application wait until there is space free in the buffer before it continues. It would probably make more sense for logging. Other than this detail, LTTng-UST would be a good fit for low-overhead logging. Thanks, Mathieu * Alawneh, Luay (Luay.Alawneh at nuance.com) wrote: > Hi, > > I am reading about LTTng and I would like to know if it can replace Log4c for logging user space events in the production environment. In addition to the method enter/exit events we also use Log4c to log many other events to indicate errors and other useful information. > > To summarize, I would like to know if LTTng can be used in a production environment for logging different types of events. We are planning to replace Log4c with another logging framework to improve the performance by reducing the time spent in logging. > > Thanks, > > Luay Alawneh > Nuance Communications > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Fri Jul 20 13:26:18 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 20 Jul 2012 13:26:18 -0400 Subject: [lttng-dev] some questions on lttng In-Reply-To: <4B3E7C3D6AE874479212F4D6AE0AFD1F02C7FF0805@MX28A.corp.emc.com> References: <4B3E7C3D6AE874479212F4D6AE0AFD1F02C7FF0741@MX28A.corp.emc.com> <4B3E7C3D6AE874479212F4D6AE0AFD1F02C7FF0805@MX28A.corp.emc.com> Message-ID: <20120720172618.GA19112@Krystal> * Bingfeng.Zhao at emc.com (Bingfeng.Zhao at emc.com) wrote: > Anyone can answer our questions? Mathieu? sorry for the slow reply, I've been swamped in filtering implementation lately, > > From: Bingfeng.Zhao at emc.com [mailto:Bingfeng.Zhao at emc.com] > Sent: Wednesday, July 18, 2012 5:54 PM > To: lttng-dev at lists.lttng.org > Subject: [lttng-dev] some questions on lttng > > Hello the dev list, > We encounter some basic questions when try to adapt the LTTNG in our poject. > > 1. When the trace is enabled and all are well configurated, we get > trace messages collected under the session folder. The question is > whether it is possible that some traces will lost when the trace > messages are huge. How will LTTNG do if the consumer deamon cannot > fast enough to copy the trace message from trace buffer? There are currently two ways to configure the channels: discard and overwrite mode. In discard mode, upon buffer full condition, events are discarded, and we keep track of the number of events discarded in the packet headers, so the trace viewer can print warnings about discarded events within a specific time-frame. In overwrite mode, upon buffer full condition, the oldest subbuffer (packet) is overwritten. We will soon add a sequence counter to the packet header, so the trace viewer can show when a packet is missing in the stream (either due to being overwritten by the tracer or due to UDP packet loss in network streaming). If the message (event) is too large to fit within a packet, it is discarded, incrementing the event discarded counter accordingly (so the viewer can show this information from the packet header). It would be interesting to implement a "blocking" mode that makes the application block if buffer is full. This makes the tracer much more intrusive, and if something goes wrong in the session daemon or consumer daemon, the app hangs, but it might be interesting for logging purposes, if you care about _never_ losing an event. I would recommend to use this kind of feature in debugging setups, not in production, at the beginning, since it would make the sessiond/consumerd critical (if they die, the application hangs. I don't want to see this happen in production). > > 2. For user space trace, currectly seems we cannot set the flush > interval. How can we control the flush internal for UST? If no, is > there hardcoded or random flash interval? Or there is no time based > flush mechanism at all for UST? The flush interval will only be useful for live streaming, which is not supported yet. Currently, UST does a subbuffer switch (flush) each time the subbuffer cannot hold the next event to write. I plan to implement this periodic flush at the consumer daemon level, so it will be less intrusive within the application. Adding timers to a traced application without its knowledge would likely be a nightware waiting to happen. > > 3. For a severe kernel panic can we extrace buffered trace messages > from LTTNG internal buffer in full memory core dump file? Is there > tools on this we can leverage? Not yet, but it's a feature we look forward to see coming. At some point in the past, I remember there was a patch to lcrash that was supporting extraction of lttng 0.x buffers from a crashed kernel image. However, LTTng 2.0 data structure layout is quite different, so this work would have to be redone. I'm aware that Thomas Gleixner is working on "Shrinking core dump on the fly" (see the Tracing Summit schedule at http://tracingsummit.org/wiki/TracingSummit2012). Maybe he has a few words to say on this, and some recommendations. One related thing that would be interesting to implement is a libringbuffer backend that uses video card memory buffers that survive reboots. Given that lttng libringbuffer is very modular, it should be straightforward to implement. Thanks! Mathieu > > Thank you, > - Bingfeng > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From yannick.brosseau at gmail.com Fri Jul 20 13:43:59 2012 From: yannick.brosseau at gmail.com (Yannick Brosseau) Date: Fri, 20 Jul 2012 13:43:59 -0400 Subject: [lttng-dev] LTTng In-Reply-To: <5009718E.8020308@efficios.com> References: <5009718E.8020308@efficios.com> Message-ID: <500998DF.30106@gmail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, UST could work for your logging purpose, but one drag back is that you'll need to have a session daemon running, which will spawn a consumer. You will also need to manage the start/stop of the tracing. Yannick On 2012-07-20 10:56, David Goulet wrote: > Hi Luay, > > I am not aware of any Log4c --> LTTng transition work done up to this > day... > > One thing I can say is that user space tracing using LTTng will > certainly improve speed and scalability performance. > > The event LOGLEVEL feature is pretty interesting for that where you > can only enable a certain loglevel facility for a trace (exactly like > the syslog facilities). You can refer to the lttng-ust(3) man page for > more information. > > Moreover, you can also couple kernel traces to your user space traces > which can give you way more information :). > > I guess that if now one replies to this thread describing their > experience with log4c vs lttng, you guys will be the first to try a > transition and we will be more than happy to help you with any bugs or > difficulties you'll encounter :) > > Moreover, if you are able to come up with some sort of scripts/recipe > for that, it will be the kind of documentation or tool that could > benefit big time the community! :) > > Feel free to ask on the mailing list any concerns/questions/comments > you have. > > Cheers! > David > > Alawneh, Luay: > > Hi, > > > > > I am reading about LTTng and I would like to know if it can > > replace Log4c for logging user space events in the production > > environment. In addition to the method enter/exit events we also > > use Log4c to log many other events to indicate errors and other > > useful information. > > > > > To summarize, I would like to know if LTTng can be used in a > > production environment for logging different types of events. We > > are planning to replace Log4c with another logging framework to > > improve the performance by reducing the time spent in logging. > > > > > Thanks, > > > > > Luay Alawneh > > > Nuance Communications > > > > > > > This body part will be downloaded on demand. > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlAJmNUACgkQFQrZ7GzHX2pCUQCfZDF5c6Bl+ums2gf3CfsBUxnB pIYAn3KCWayyKnQDkqM/88663iWeFHFH =z4nw -----END PGP SIGNATURE----- -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu.desnoyers at efficios.com Fri Jul 20 14:07:30 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 20 Jul 2012 14:07:30 -0400 Subject: [lttng-dev] [babeltrace] FTS does not support large files on 32-bit In-Reply-To: <524C960C5DFC794E82BE548D825F05CF56CB608F@EU-MBX-04.mgc.mentorg.com> References: <20120630185335.GA31235@Krystal> <4FF4A996.8040606@gmail.com> <524C960C5DFC794E82BE548D825F05CF56CB608F@EU-MBX-04.mgc.mentorg.com> Message-ID: <20120720180730.GA20073@Krystal> * Oestman, Fredrik (Fredrik_Oestman at mentor.com) wrote: > Hi Yannick and Julien, > > > Yannick Brosseau wrote: > > FTS does not use callbacks, which makes it easier to use. > > Also since it was supposed to be part of the babeltrace API, not having > > to manage a callbacks looked better. > > > > Might had other reasons at the time, but now I don't see any more. > > Are you making any progress in supplying large file support in babeltrace? > > Would it be helpful if I filed a bug report? Julien was on vacation last week. Hopefully he will make progress on this issue within the next week. Adding a bug entry would be helpful to track this issue, yes. Thanks, Mathieu > > > Cheers, > > Fredrik ?stman > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Fri Jul 20 14:13:21 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 20 Jul 2012 14:13:21 -0400 Subject: [lttng-dev] LTTng-UST alternative to LD_PRELOAD In-Reply-To: <1339945703.2599.21.camel@DellE5500> References: <1339945703.2599.21.camel@DellE5500> Message-ID: <20120720181321.GB20073@Krystal> * Lars (lars at grandepotatis.se) wrote: > > Hello, > > I have recently started to use LTTng-UST and am using LD_PRELOAD > to make it possilbe to execute instrumented code on systems without > LTTng-UST installed. > > To define LD_PRELOAD however affects too much. For instance all > forked processes also get the library loaded. This can be fixed by > removing the library from the LD_PRELOAD variable early in the main > function. This looks odd and required some explaining in comments. good point. LD_PRELOAD was originally the only way we allowed lttng-ust to be loaded, because during the rc phase of the lttng-ust 2.0 development, we had issues with dlopening liblttng-ust. This has been fixed within the rc stages though, so we could go for a dlopen approach now. > > Also, in my case, the instrumented program is started with a "wrapper" > program which I can not alter. This wrapper also gets the library > loaded. > > As an alternative to using LD_PRELOAD I would like to use an explicit > function, like; > > int traceload(char const* library_path); or maybe: int lttng_ust_dlopen(const char *library_path); ? > that is called early in main (instead of the LD_PRELOAD environment > manipulation) and loads the library with dlopen if it exists. yep, makes sense. > > I have already tried this (of course) and it almost works already. > The tracepoints becomes visible but I get no trace data written. > So I think a really small modification is needed. > > Is anything like this planned? if you can provide a patch, I'd be glad to review & merge it. > > Or can anybody give me a hint on what is missing? Try running your app with the env. var LTTNG_UST_DEBUG=1 set. It might provide helpful info. If you still have problems, please post your patch as RFC along with specific test programs so we can look at the behavior. Thanks, Mathieu > > I checked the mailing list a couple of months back but did not > find anything. > > Best Regards, > Lars Ekman > > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Fri Jul 20 14:15:11 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 20 Jul 2012 14:15:11 -0400 Subject: [lttng-dev] [RFC PATCH lttng-tools] relayd pipes and error handling In-Reply-To: <5006DC53.1040709@efficios.com> References: <5006DC53.1040709@efficios.com> Message-ID: <20120720181511.GC20073@Krystal> * David Goulet (dgoulet at efficios.com) wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > I'm pretty OK with that. > > I have utils_* function for that in lttng-sessiond/ ... I think I'm > going to move them to common/ since they are pretty useful for the > complete code tree. since this was a RFC patch, does Christian need to resend it, after update ? > > Cheers! > David > > Christian Babeux: > > Hi, > > > > The current relayd employ two set of pipes for command relaying > > and thread quit signalling. The relay_cmd_pipe pipes are never > > closed. Also, the thread_quit_pipe pipes are not closed in some > > error cases (fail to parse args, fail to daemonize, etc.). Here is > > a proposed way to cleanup and handle error cases. > > > > Thoughts? > > > > Thanks, > > > > Christian > > > > Fix: relayd relay_cmd_pipe/thread_quit_pipe should be closed on > > exit/error. > > > > diff --git a/src/bin/lttng-relayd/main.c > > b/src/bin/lttng-relayd/main.c index acc6ca8..55452b3 100644 --- > > a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ > > -231,14 +231,26 @@ void cleanup(void) > > > > DBG("Cleaning up"); > > > > + /* Close thread quit pipes */ for (i = 0; i < 2; i++) { if > > (thread_quit_pipe[i] >= 0) { ret = close(thread_quit_pipe[i]); if > > (ret) { - PERROR("close"); + > > PERROR("close quit pipe"); } } } + + /* Close relay cmd pipes > > */ + for (i = 0; i < 2; i++) { + if > > (relay_cmd_pipe[i] >= 0) { + ret = > > close(relay_cmd_pipe[i]); + if (ret) { + > > PERROR("close cmd pipe"); + } + > > } + } + } > > > > /* @@ -1479,7 +1491,7 @@ int main(int argc, char **argv) /* Parse > > arguments */ progname = argv[0]; if ((ret = parse_args(argc, argv) > > < 0)) { - goto error; + goto exit; } > > > > if ((ret = set_signal_handler()) < 0) { @@ -1491,7 +1503,7 @@ int > > main(int argc, char **argv) ret = daemon(0, 0); if (ret < 0) { > > PERROR("daemon"); - goto error; + > > goto exit; } } > > > > @@ -1502,7 +1514,7 @@ int main(int argc, char **argv) if > > (control_uri->port < 1024 || data_uri->port < 1024) { ERR("Need to > > be root to use ports < 1024"); ret = -1; - > > goto error; + goto exit; } } > > > > @@ -1567,6 +1579,7 @@ exit: if (!ret) { exit(EXIT_SUCCESS); } + > > error: exit(EXIT_FAILURE); } > > > > _______________________________________________ lttng-dev mailing > > list lttng-dev at lists.lttng.org > > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > -----BEGIN PGP SIGNATURE----- > > iQEcBAEBCgAGBQJQBtxQAAoJEELoaioR9I02hjoH/RKfCg0r4nq5AnKDpxJIQEaC > Cy0QUmLZ812prSDaHgoPBL8ItJ4XiLGmFxwj+F0RXP9sT2QuOsiHYRc3aKk1+X5u > RMnIuqx4ZdkakeGkTtZMr3ujmy/vOj9NOMuZsigV9z7g/jL5uXzfL0eJcW9kJLQ3 > cNEtdO519q9hInoxpRBkRQtJya1LHoT66oc5AK8TWMBCLjHzvTvvqWNSEBEOfQqH > b7CulD3x6//DvnlVImA3zFNB2YXLvY6bL3XnU9I/DIEENjG1uAP+9/h+IzWRMNcS > F0bttSrK9faUqBedMB81hadx0uLjpQxnIB9oFR2NEW/W1J3HAwwVN5YntZFo+lw= > =BfP8 > -----END PGP SIGNATURE----- > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Fri Jul 20 14:21:02 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 20 Jul 2012 14:21:02 -0400 Subject: [lttng-dev] When is tracepoint registration finished? In-Reply-To: <524C960C5DFC794E82BE548D825F05CF56CB1DF1@EU-MBX-04.mgc.mentorg.com> References: <524C960C5DFC794E82BE548D825F05CF56CB1DF1@EU-MBX-04.mgc.mentorg.com> Message-ID: <20120720182101.GD20073@Krystal> * Oestman, Fredrik (Fredrik_Oestman at mentor.com) wrote: > Hi, > > Is there any way to know from within the instrumented application when > tracepoint registration is finished? No. > > We have instrumented clib functions, which are used by LTTng and start > producing trace events before all tracepoint registration is finished. Yep, this is because the events are triggered before the constructor that registers the tracepoint probes gets called. > On ARM, this messes up LTTng UST and faulty events are recorded. What do you mean by faulty events ? > On all architectures, we trace function calls we aren't interested in. Well, if you trace _all_ function calls, then you get all function calls ;) Not just those of your application, but also those of library constructors. Thanks, Mathieu > > Cheers, > > Fredrik ?stman > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From skrishnakar at gmail.com Fri Jul 20 14:21:19 2012 From: skrishnakar at gmail.com (srikanth krishnakar) Date: Fri, 20 Jul 2012 23:51:19 +0530 Subject: [lttng-dev] Need inputs on LTTng for ARM Linux-3.0.15 Message-ID: Hello Mathieu, I am working on LTTng integration for *Linux-3.0.15* *ARM v7 Freescale i.MX6 SabreLite* target. I previously integrated lttng-modules into kernel with while I was working on Linux-2.6.38. Now I would like to know is there any repository that you are maintaining to restore kernel patches for Linux kernel 3.x series ? If yes is there any documentation on using those patches against 3.x kernel Or should I go with building and installing lttng-modules-2.0.x as my only option ? You inputs are appreciated ! Thanks in Advance ! -- "The Good You Do, The Best You GET" Regards Srikanth Krishnakar ********************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.goulet at polymtl.ca Fri Jul 20 14:23:44 2012 From: david.goulet at polymtl.ca (David Goulet) Date: Fri, 20 Jul 2012 14:23:44 -0400 Subject: [lttng-dev] [RFC PATCH lttng-tools] relayd pipes and error handling In-Reply-To: <20120720181511.GC20073@Krystal> References: <5006DC53.1040709@efficios.com> <20120720181511.GC20073@Krystal> Message-ID: <5009A230.8010002@polymtl.ca> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Yep, Christian is aware of that, we talked so I guess a patch is coming :) David Mathieu Desnoyers: > * David Goulet (dgoulet at efficios.com) wrote: I'm pretty OK with > that. > > I have utils_* function for that in lttng-sessiond/ ... I think > I'm going to move them to common/ since they are pretty useful for > the complete code tree. > >> since this was a RFC patch, does Christian need to resend it, >> after update ? > > > Cheers! David > > Christian Babeux: >>>> Hi, >>>> >>>> The current relayd employ two set of pipes for command >>>> relaying and thread quit signalling. The relay_cmd_pipe pipes >>>> are never closed. Also, the thread_quit_pipe pipes are not >>>> closed in some error cases (fail to parse args, fail to >>>> daemonize, etc.). Here is a proposed way to cleanup and >>>> handle error cases. >>>> >>>> Thoughts? >>>> >>>> Thanks, >>>> >>>> Christian >>>> >>>> Fix: relayd relay_cmd_pipe/thread_quit_pipe should be closed >>>> on exit/error. >>>> >>>> diff --git a/src/bin/lttng-relayd/main.c >>>> b/src/bin/lttng-relayd/main.c index acc6ca8..55452b3 100644 >>>> --- a/src/bin/lttng-relayd/main.c +++ >>>> b/src/bin/lttng-relayd/main.c @@ -231,14 +231,26 @@ void >>>> cleanup(void) >>>> >>>> DBG("Cleaning up"); >>>> >>>> + /* Close thread quit pipes */ for (i = 0; i < 2; i++) >>>> { if (thread_quit_pipe[i] >= 0) { ret = >>>> close(thread_quit_pipe[i]); if (ret) { - >>>> PERROR("close"); + PERROR("close quit pipe"); } } } + + >>>> /* Close relay cmd pipes */ + for (i = 0; i < 2; i++) { >>>> + if (relay_cmd_pipe[i] >= 0) { + >>>> ret = close(relay_cmd_pipe[i]); + if >>>> (ret) { + PERROR("close cmd pipe"); + } >>>> + } + } + } >>>> >>>> /* @@ -1479,7 +1491,7 @@ int main(int argc, char **argv) /* >>>> Parse arguments */ progname = argv[0]; if ((ret = >>>> parse_args(argc, argv) < 0)) { - goto error; + >>>> goto exit; } >>>> >>>> if ((ret = set_signal_handler()) < 0) { @@ -1491,7 +1503,7 @@ >>>> int main(int argc, char **argv) ret = daemon(0, 0); if (ret < >>>> 0) { PERROR("daemon"); - goto error; + >>>> goto exit; } } >>>> >>>> @@ -1502,7 +1514,7 @@ int main(int argc, char **argv) if >>>> (control_uri->port < 1024 || data_uri->port < 1024) { >>>> ERR("Need to be root to use ports < 1024"); ret = -1; - goto >>>> error; + goto exit; } } >>>> >>>> @@ -1567,6 +1579,7 @@ exit: if (!ret) { exit(EXIT_SUCCESS); } >>>> + error: exit(EXIT_FAILURE); } >>>> >>>> _______________________________________________ lttng-dev >>>> mailing list lttng-dev at lists.lttng.org >>>> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev >> >> _______________________________________________ lttng-dev mailing >> list lttng-dev at lists.lttng.org >> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQCaItAAoJEELoaioR9I02JZMH/27Y/xxj0hC0RScI1b5AG5Rq uG7cUKPCcyaMsHmng6t9+UMmAqMfSO+J52nkY0iHHOJg1U09Tu+UtEFIyAURBJF6 1WS3e73xSHmKPbVOWVhhoCgSSCDLHlhm9T2Jk8rFyIPRwn+7K5z2g8KIHWJWnx/7 enlJrQQpPE5szoFomVLn36SzQqbCxsKymPaJYvseTjRJSd1TW8cKyFocziMTnPvB ENFZHMd7rpiCyo0XfKA9JgKKEVn0d1sVjaxnMwQ4KIAxIIyPPPOqSZl3pHuumSb8 tZ/MUfMKjiBL9JHqvR8Yc7yUxZ7fzYlCKBIizNhzdwfKAgzsNH92/h+OVrsfgLA= =ssYW -----END PGP SIGNATURE----- From mathieu.desnoyers at efficios.com Fri Jul 20 14:27:06 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 20 Jul 2012 14:27:06 -0400 Subject: [lttng-dev] Need inputs on LTTng for ARM Linux-3.0.15 In-Reply-To: References: Message-ID: <20120720182706.GA20397@Krystal> Hi Srikanth, * srikanth krishnakar (skrishnakar at gmail.com) wrote: > Hello Mathieu, > > I am working on LTTng integration for *Linux-3.0.15* *ARM v7 Freescale > i.MX6 SabreLite* target. I previously integrated lttng-modules into kernel > with while I was working on Linux-2.6.38. > > Now I would like to know is there any repository that you are maintaining > to restore kernel patches for Linux kernel 3.x series ? If yes is there any > documentation on using those patches against 3.x kernel Or should I go with > building and installing lttng-modules-2.0.x as my only option ? For kernel 2.6.38 and more recent, lttng-modules 2.0.x is your only option. I don't maintain any lttng 0.x kernel tree for those newer kernels anymore. Best regards, Mathieu > > You inputs are appreciated ! > > Thanks in Advance ! > > -- > "The Good You Do, The Best You GET" > > Regards > Srikanth Krishnakar > ********************** -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From christian.babeux at efficios.com Fri Jul 20 15:26:47 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Fri, 20 Jul 2012 15:26:47 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Fix: relayd relay_cmd_pipe/thread_quit_pipe should be closed on exit/error. Message-ID: <1342812407-5225-1-git-send-email-christian.babeux@efficios.com> Use the utils functions found in common/utils.h on pipes operations (open/close). Signed-off-by: Christian Babeux --- src/bin/lttng-relayd/main.c | 57 +++++++++++---------------------------------- 1 file changed, 14 insertions(+), 43 deletions(-) diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index bdefd16..795a694 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -49,6 +49,7 @@ #include #include #include +#include #include "lttng-relayd.h" @@ -228,18 +229,13 @@ exit: static void cleanup(void) { - int i, ret; - DBG("Cleaning up"); - for (i = 0; i < 2; i++) { - if (thread_quit_pipe[i] >= 0) { - ret = close(thread_quit_pipe[i]); - if (ret) { - PERROR("close"); - } - } - } + /* Close thread quit pipes */ + utils_close_pipe(thread_quit_pipe); + + /* Close relay cmd pipes */ + utils_close_pipe(relay_cmd_pipe); } /* @@ -351,23 +347,10 @@ int set_signal_handler(void) static int init_thread_quit_pipe(void) { - int ret, i; - - ret = pipe(thread_quit_pipe); - if (ret < 0) { - PERROR("thread quit pipe"); - goto error; - } + int ret; - for (i = 0; i < 2; i++) { - ret = fcntl(thread_quit_pipe[i], F_SETFD, FD_CLOEXEC); - if (ret < 0) { - PERROR("fcntl"); - goto error; - } - } + ret = utils_create_pipe_cloexec(thread_quit_pipe); -error: return ret; } @@ -1444,23 +1427,10 @@ error_poll_create: */ static int create_relay_cmd_pipe(void) { - int ret, i; - - ret = pipe(relay_cmd_pipe); - if (ret < 0) { - PERROR("relay cmd pipe"); - goto error; - } + int ret; - for (i = 0; i < 2; i++) { - ret = fcntl(relay_cmd_pipe[i], F_SETFD, FD_CLOEXEC); - if (ret < 0) { - PERROR("fcntl relay_cmd_pipe"); - goto error; - } - } + ret = utils_create_pipe_cloexec(relay_cmd_pipe); -error: return ret; } @@ -1480,7 +1450,7 @@ int main(int argc, char **argv) /* Parse arguments */ progname = argv[0]; if ((ret = parse_args(argc, argv) < 0)) { - goto error; + goto exit; } if ((ret = set_signal_handler()) < 0) { @@ -1492,7 +1462,7 @@ int main(int argc, char **argv) ret = daemon(0, 0); if (ret < 0) { PERROR("daemon"); - goto error; + goto exit; } } @@ -1503,7 +1473,7 @@ int main(int argc, char **argv) if (control_uri->port < 1024 || data_uri->port < 1024) { ERR("Need to be root to use ports < 1024"); ret = -1; - goto error; + goto exit; } } @@ -1568,6 +1538,7 @@ exit: if (!ret) { exit(EXIT_SUCCESS); } + error: exit(EXIT_FAILURE); } -- 1.7.11.2 From yannick.brosseau at gmail.com Fri Jul 20 16:47:46 2012 From: yannick.brosseau at gmail.com (Yannick Brosseau) Date: Fri, 20 Jul 2012 16:47:46 -0400 Subject: [lttng-dev] Need inputs on LTTng for ARM Linux-3.0.15 In-Reply-To: References: Message-ID: <5009C3F2.4050905@gmail.com> On 2012-07-20 14:21, srikanth krishnakar wrote: > Hello Mathieu, > > I am working on LTTng integration for *Linux-3.0.15**ARM v7 Freescale > i.MX6 SabreLite* target. I previously integrated lttng-modules into > kernel with while I was working on Linux-2.6.38. > > Now I would like to know is there any repository that you are > maintaining to restore kernel patches for Linux kernel 3.x series ? If > yes is there any documentation on using those patches against 3.x > kernel Or should I go with building and installing lttng-modules-2.0.x > as my only option ? You can have a look at the LTSI Kernel which include an in tree patchset for LTTng-modules 2.x http://ltsi.linuxfoundation.org/downloads Yannick -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdesfossez at efficios.com Fri Jul 20 18:41:19 2012 From: jdesfossez at efficios.com (Julien Desfossez) Date: Fri, 20 Jul 2012 18:41:19 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Fix: relayd relay_cmd_pipe/thread_quit_pipe should be closed on exit/error. In-Reply-To: <1342812407-5225-1-git-send-email-christian.babeux@efficios.com> References: <1342812407-5225-1-git-send-email-christian.babeux@efficios.com> Message-ID: <5009DE8F.1070502@efficios.com> Signed-off-by: Julien Desfossez On 20/07/12 03:26 PM, Christian Babeux wrote: > Use the utils functions found in common/utils.h on pipes operations > (open/close). > > Signed-off-by: Christian Babeux > --- > src/bin/lttng-relayd/main.c | 57 +++++++++++---------------------------------- > 1 file changed, 14 insertions(+), 43 deletions(-) > > diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c > index bdefd16..795a694 100644 > --- a/src/bin/lttng-relayd/main.c > +++ b/src/bin/lttng-relayd/main.c > @@ -49,6 +49,7 @@ > #include > #include > #include > +#include > > #include "lttng-relayd.h" > > @@ -228,18 +229,13 @@ exit: > static > void cleanup(void) > { > - int i, ret; > - > DBG("Cleaning up"); > > - for (i = 0; i < 2; i++) { > - if (thread_quit_pipe[i] >= 0) { > - ret = close(thread_quit_pipe[i]); > - if (ret) { > - PERROR("close"); > - } > - } > - } > + /* Close thread quit pipes */ > + utils_close_pipe(thread_quit_pipe); > + > + /* Close relay cmd pipes */ > + utils_close_pipe(relay_cmd_pipe); > } > > /* > @@ -351,23 +347,10 @@ int set_signal_handler(void) > static > int init_thread_quit_pipe(void) > { > - int ret, i; > - > - ret = pipe(thread_quit_pipe); > - if (ret < 0) { > - PERROR("thread quit pipe"); > - goto error; > - } > + int ret; > > - for (i = 0; i < 2; i++) { > - ret = fcntl(thread_quit_pipe[i], F_SETFD, FD_CLOEXEC); > - if (ret < 0) { > - PERROR("fcntl"); > - goto error; > - } > - } > + ret = utils_create_pipe_cloexec(thread_quit_pipe); > > -error: > return ret; > } > > @@ -1444,23 +1427,10 @@ error_poll_create: > */ > static int create_relay_cmd_pipe(void) > { > - int ret, i; > - > - ret = pipe(relay_cmd_pipe); > - if (ret < 0) { > - PERROR("relay cmd pipe"); > - goto error; > - } > + int ret; > > - for (i = 0; i < 2; i++) { > - ret = fcntl(relay_cmd_pipe[i], F_SETFD, FD_CLOEXEC); > - if (ret < 0) { > - PERROR("fcntl relay_cmd_pipe"); > - goto error; > - } > - } > + ret = utils_create_pipe_cloexec(relay_cmd_pipe); > > -error: > return ret; > } > > @@ -1480,7 +1450,7 @@ int main(int argc, char **argv) > /* Parse arguments */ > progname = argv[0]; > if ((ret = parse_args(argc, argv) < 0)) { > - goto error; > + goto exit; > } > > if ((ret = set_signal_handler()) < 0) { > @@ -1492,7 +1462,7 @@ int main(int argc, char **argv) > ret = daemon(0, 0); > if (ret < 0) { > PERROR("daemon"); > - goto error; > + goto exit; > } > } > > @@ -1503,7 +1473,7 @@ int main(int argc, char **argv) > if (control_uri->port < 1024 || data_uri->port < 1024) { > ERR("Need to be root to use ports < 1024"); > ret = -1; > - goto error; > + goto exit; > } > } > > @@ -1568,6 +1538,7 @@ exit: > if (!ret) { > exit(EXIT_SUCCESS); > } > + > error: > exit(EXIT_FAILURE); > } From Bingfeng.Zhao at emc.com Sun Jul 22 23:27:48 2012 From: Bingfeng.Zhao at emc.com (Bingfeng.Zhao at emc.com) Date: Sun, 22 Jul 2012 23:27:48 -0400 Subject: [lttng-dev] some questions on lttng In-Reply-To: <20120720172618.GA19112@Krystal> References: <4B3E7C3D6AE874479212F4D6AE0AFD1F02C7FF0741@MX28A.corp.emc.com> <4B3E7C3D6AE874479212F4D6AE0AFD1F02C7FF0805@MX28A.corp.emc.com> <20120720172618.GA19112@Krystal> Message-ID: <4B3E7C3D6AE874479212F4D6AE0AFD1F02C7FF08D3@MX28A.corp.emc.com> > -----Original Message----- > From: Mathieu Desnoyers [mailto:mathieu.desnoyers at efficios.com] > Sent: Saturday, July 21, 2012 1:26 AM > To: Zhao, Bingfeng; tglx at linutronix.de > Cc: lttng-dev at lists.lttng.org > Subject: Re: [lttng-dev] some questions on lttng > > * Bingfeng.Zhao at emc.com (Bingfeng.Zhao at emc.com) wrote: > > Anyone can answer our questions? Mathieu? > > sorry for the slow reply, I've been swamped in filtering implementation lately, > > > > > From: Bingfeng.Zhao at emc.com [mailto:Bingfeng.Zhao at emc.com] > > Sent: Wednesday, July 18, 2012 5:54 PM > > To: lttng-dev at lists.lttng.org > > Subject: [lttng-dev] some questions on lttng > > > > Hello the dev list, > > We encounter some basic questions when try to adapt the LTTNG in our poject. > > > > 1. When the trace is enabled and all are well configurated, we get > > trace messages collected under the session folder. The question is > > whether it is possible that some traces will lost when the trace > > messages are huge. How will LTTNG do if the consumer deamon cannot > > fast enough to copy the trace message from trace buffer? > > There are currently two ways to configure the channels: discard and overwrite > mode. > > In discard mode, upon buffer full condition, events are discarded, and we keep > track of the number of events discarded in the packet headers, so the trace viewer > can print warnings about discarded events within a specific time-frame. > > In overwrite mode, upon buffer full condition, the oldest subbuffer > (packet) is overwritten. We will soon add a sequence counter to the packet header, > so the trace viewer can show when a packet is missing in the stream (either due to > being overwritten by the tracer or due to UDP packet loss in network streaming). > > If the message (event) is too large to fit within a packet, it is discarded, > incrementing the event discarded counter accordingly (so the viewer can show this > information from the packet header). > > It would be interesting to implement a "blocking" mode that makes the application > block if buffer is full. This makes the tracer much more intrusive, and if something > goes wrong in the session daemon or consumer daemon, the app hangs, but it > might be interesting for logging purposes, if you care about _never_ losing an > event. I would recommend to use this kind of feature in debugging setups, not in > production, at the beginning, since it would make the sessiond/consumerd critical > (if they die, the application hangs. I don't want to see this happen in production). > Thanks for the explanation, I got you point. However I'm at a different scenario. Normally the trace is off by default, that is there is no session created and started. The trace call definitely should not block anything. Ideally it should not trigger at all and I believe that is what lttng does now. If I find something wrong, I would like enable the trace at once and try to figure out what happen. At this time, (possible) lost event will make the trouble shooting much difficult (example for those rare race condition issues) as you cannot reason about what you collected if there are some messages lost. So all the meaning of static trace may lost and such scenario is not rare in production. > > > > 2. For user space trace, currectly seems we cannot set the flush > > interval. How can we control the flush internal for UST? If no, is > > there hardcoded or random flash interval? Or there is no time based > > flush mechanism at all for UST? > > The flush interval will only be useful for live streaming, which is not supported yet. > Currently, UST does a subbuffer switch (flush) each time the subbuffer cannot hold > the next event to write. I plan to implement this periodic flush at the consumer > daemon level, so it will be less intrusive within the application. Adding timers to a > traced application without its knowledge would likely be a nightware waiting to > happen. > > > > > 3. For a severe kernel panic can we extrace buffered trace messages > > from LTTNG internal buffer in full memory core dump file? Is there > > tools on this we can leverage? > > Not yet, but it's a feature we look forward to see coming. At some point in the past, > I remember there was a patch to lcrash that was supporting extraction of lttng 0.x > buffers from a crashed kernel image. However, LTTng 2.0 data structure layout is > quite different, so this work would have to be redone. I'm aware that Thomas > Gleixner is working on "Shrinking core dump on the fly" (see the Tracing Summit > schedule at http://tracingsummit.org/wiki/TracingSummit2012). Maybe he has a > few words to say on this, and some recommendations. > > One related thing that would be interesting to implement is a libringbuffer backend > that uses video card memory buffers that survive reboots. Given that lttng > libringbuffer is very modular, it should be straightforward to implement. > > Thanks! > > Mathieu > > > > > Thank you, > > - Bingfeng > > > > > _______________________________________________ > > lttng-dev mailing list > > lttng-dev at lists.lttng.org > > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > > -- > Mathieu Desnoyers > Operating System Efficiency R&D Consultant EfficiOS Inc. > http://www.efficios.com From Fredrik_Oestman at mentor.com Mon Jul 23 02:58:08 2012 From: Fredrik_Oestman at mentor.com (Oestman, Fredrik) Date: Mon, 23 Jul 2012 06:58:08 +0000 Subject: [lttng-dev] When is tracepoint registration finished? In-Reply-To: <20120720182101.GD20073@Krystal> References: <524C960C5DFC794E82BE548D825F05CF56CB1DF1@EU-MBX-04.mgc.mentorg.com> <20120720182101.GD20073@Krystal> Message-ID: <524C960C5DFC794E82BE548D825F05CF5BC5D30F@EU-MBX-01.mgc.mentorg.com> Hi, Mathieu Desnoyers wrote: > Oestman, Fredrik (Fredrik_Oestman at mentor.com) wrote: > > Is there any way to know from within the instrumented application > > when tracepoint registration is finished? > > No. OK. Does any internal knowledge about this exist somewhere, which could be externalized? > > On ARM, this messes up LTTng UST and faulty events are recorded. > What do you mean by faulty events ? 1. Wrong trace data type: 1.a) A tracepoint for one type produces events of another type, for which there is a tracepoint. 1.b) A tracepoint produces a non-existing type, which makes babeltrace choke on the data, index out of range 2. Wrong field: Data belonging to field #2 sent in field #1, in combination with 1.a) > Well, if you trace _all_ function calls, then you get all function > calls Yes, this was no surprise, just one more reason to try to find out when tracepoint registration is finished. Cheers, Fredrik ?stman From salman.rafiq at esk.fraunhofer.de Mon Jul 23 07:35:04 2012 From: salman.rafiq at esk.fraunhofer.de (Salman Rafiq) Date: Mon, 23 Jul 2012 13:35:04 +0200 Subject: [lttng-dev] WG: Reading CTF trace using Babeltrace API Message-ID: Hello All, In continuation to my previous questions related to reading CTF traces from particular timestamp, I can now further summarize few problems/questions I have: 1. Is it possible to seek CTF file_stream using 'begin' and 'end' iterator position i.e. BT_SEEK_TIME? a. We cannot use babel trace API for CTF iterator creation using defined start and end position based on time. Seems this is in progress? b. The other possible solution I am using, is to create the iterator using defaults, and then later use API to 'create iterator time position based on Raw Timestamp (only takes raw time)' and then 'set iterator position to that timed position'. 2. But, since the area of interest for me was only the time when user application which I am tracing using Lttng-kernel tracer, started recording events (application use external trace recording format). User application contains a definition file which tells me the epoch time (us resolution) when it started and stopped tracing. I wanted to use this information to set iterator positions. a. Question is Can I convert this time to raw time which babeltrace API takes as an argument? b. Or Is there any way to read Clock struct from CTF metadata file (is there any scope defined for this), so that I can extract offset variable value to convert epoch time from other trace to raw time? It will be really great if I can get few suggestions/help related to these issues. Thanking in anticipation! Best Regards, Salman Rafiq Research Engineer Industrial Communication Fraunhofer-Einrichtung f?r Systeme der Kommunikationstechnik ESK Hansastra?e 32 | 80686 M?nchen Telefon, Fax: +49 89 547088-356 | +49 89 547088-66-356 E-Mail: salman.rafiq at esk.fraunhofer.de Internet: http://www.esk.fraunhofer.de http://www.facebook.com/FraunhoferESK http://www.twitter.com/FraunhoferESK Von: Salman Rafiq [mailto:salman.rafiq at esk.fraunhofer.de] Gesendet: Mittwoch, 18. Juli 2012 15:28 An: lttng-dev at lists.lttng.org Betreff: [lttng-dev] Reading CTF trace from time T Hello All, I am tracing a user application using lttng kernel tracer, i.e., Start lttng kernel trace ./application Stop lttng kernel trace Before I was reading kernel CTF trace using babeltrace API's from beginning of trace, e.g., struct bt_iter_pos begin_pos struct bt_ctf_iter *iterator begin_pos.type = BT_SEEK_BEGIN iterator = create_iterator(context, &begin_pos, NULL) .. and then read events start from that iterator postion. Recently, I have been trying to seek trace using timestamp from when the application started to application end. I would like to know if I am doing it right. Would the method below enough to achieve this? Or I am missing something here :-S begin_pos.type = BT_SEEK_TIME end_pos.type = BT_SEEK_TIME begin_pos.u.seek_time = timestamp1 (for now manually taken from CTF kernel trace when application started) end_pos.u.seek_time = timestamp2 (for now manually taken from CTF kernel trace when application ended) iterator = create_iterator(context, &begin_pos, &end_pos); and then with reading events at iterator position until end_pos. I am using babeltrace package version "1.0.0-pre4". Any help related to achieving this functionality will be highly appreciated. Best Regards, Salman -- Salman Rafiq Industrial Communication Fraunhofer-Einrichtung f?r Systeme der Kommunikationstechnik ESK Hansastra?e 32 | 80686 M?nchen Telefon, Fax: +49 89 547088-356 | +49 89 547088-66-356 E-Mail: salman.rafiq at esk.fraunhofer.de Internet: http://www.esk.fraunhofer.de http://www.facebook.com/FraunhoferESK http://www.twitter.com/FraunhoferESK -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ATT00001.txt URL: From dgoulet at efficios.com Mon Jul 23 07:48:43 2012 From: dgoulet at efficios.com (David Goulet) Date: Mon, 23 Jul 2012 07:48:43 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Fix: relayd relay_cmd_pipe/thread_quit_pipe should be closed on exit/error. In-Reply-To: <1342812407-5225-1-git-send-email-christian.babeux@efficios.com> References: <1342812407-5225-1-git-send-email-christian.babeux@efficios.com> Message-ID: <500D3A1B.3000101@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Merged! Christian Babeux: > Use the utils functions found in common/utils.h on pipes > operations (open/close). > > Signed-off-by: Christian Babeux > --- src/bin/lttng-relayd/main.c | 57 > +++++++++++---------------------------------- 1 file changed, 14 > insertions(+), 43 deletions(-) > > diff --git a/src/bin/lttng-relayd/main.c > b/src/bin/lttng-relayd/main.c index bdefd16..795a694 100644 --- > a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ > -49,6 +49,7 @@ #include #include > #include +#include > > > #include "lttng-relayd.h" > > @@ -228,18 +229,13 @@ exit: static void cleanup(void) { - int i, > ret; - DBG("Cleaning up"); > > - for (i = 0; i < 2; i++) { - if (thread_quit_pipe[i] >= 0) { - > ret = close(thread_quit_pipe[i]); - if (ret) { - > PERROR("close"); - } - } - } + /* Close thread quit pipes */ + > utils_close_pipe(thread_quit_pipe); + + /* Close relay cmd pipes > */ + utils_close_pipe(relay_cmd_pipe); } > > /* @@ -351,23 +347,10 @@ int set_signal_handler(void) static int > init_thread_quit_pipe(void) { - int ret, i; - - ret = > pipe(thread_quit_pipe); - if (ret < 0) { - PERROR("thread quit > pipe"); - goto error; - } + int ret; > > - for (i = 0; i < 2; i++) { - ret = fcntl(thread_quit_pipe[i], > F_SETFD, FD_CLOEXEC); - if (ret < 0) { - PERROR("fcntl"); - > goto error; - } - } + ret = > utils_create_pipe_cloexec(thread_quit_pipe); > > -error: return ret; } > > @@ -1444,23 +1427,10 @@ error_poll_create: */ static int > create_relay_cmd_pipe(void) { - int ret, i; - - ret = > pipe(relay_cmd_pipe); - if (ret < 0) { - PERROR("relay cmd > pipe"); - goto error; - } + int ret; > > - for (i = 0; i < 2; i++) { - ret = fcntl(relay_cmd_pipe[i], > F_SETFD, FD_CLOEXEC); - if (ret < 0) { - PERROR("fcntl > relay_cmd_pipe"); - goto error; - } - } + ret = > utils_create_pipe_cloexec(relay_cmd_pipe); > > -error: return ret; } > > @@ -1480,7 +1450,7 @@ int main(int argc, char **argv) /* Parse > arguments */ progname = argv[0]; if ((ret = parse_args(argc, argv) > < 0)) { - goto error; + goto exit; } > > if ((ret = set_signal_handler()) < 0) { @@ -1492,7 +1462,7 @@ int > main(int argc, char **argv) ret = daemon(0, 0); if (ret < 0) { > PERROR("daemon"); - goto error; + goto exit; } } > > @@ -1503,7 +1473,7 @@ int main(int argc, char **argv) if > (control_uri->port < 1024 || data_uri->port < 1024) { ERR("Need to > be root to use ports < 1024"); ret = -1; - goto error; + goto > exit; } } > > @@ -1568,6 +1538,7 @@ exit: if (!ret) { exit(EXIT_SUCCESS); } + > error: exit(EXIT_FAILURE); } -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQDToYAAoJEELoaioR9I02uocIAKNkQl6WB+UiH6Frtt/StpqX OK2POSZMxBs6HYtC9hGsbRB7CSyotGlo61gys17S2u4MZSdfRspkXu0Kw2qLw44m WVJicHALQdqgBkGISwKtmNzo0GUb8Pi1Sg+ruJ+47VClBheCa0V0S0RfdSCN/TfH lNEEaTHFHxV/YJy8Z3UOAoMuARVzNs6lyktLRHHHFilXuF/hIYlje37YZ0n/CVHq Kk6Xs7nbCh2TnJer46jnhGKO+ykhgZ/Nr75CvtBHK5pcziopJXsKUoVmZM16NBMU PhEZuEMz6l5n8D64z9x0dRBQLw0A4q8f8lem/iW9QH9R0TrDIIgCMKs+bb2cyFc= =+OBV -----END PGP SIGNATURE----- From mathieu.desnoyers at efficios.com Mon Jul 23 10:13:31 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 23 Jul 2012 10:13:31 -0400 Subject: [lttng-dev] some questions on lttng In-Reply-To: <4B3E7C3D6AE874479212F4D6AE0AFD1F02C7FF08D3@MX28A.corp.emc.com> References: <4B3E7C3D6AE874479212F4D6AE0AFD1F02C7FF0741@MX28A.corp.emc.com> <4B3E7C3D6AE874479212F4D6AE0AFD1F02C7FF0805@MX28A.corp.emc.com> <20120720172618.GA19112@Krystal> <4B3E7C3D6AE874479212F4D6AE0AFD1F02C7FF08D3@MX28A.corp.emc.com> Message-ID: <20120723141331.GA1932@Krystal> * Bingfeng.Zhao at emc.com (Bingfeng.Zhao at emc.com) wrote: > > > > -----Original Message----- > > From: Mathieu Desnoyers [mailto:mathieu.desnoyers at efficios.com] > > Sent: Saturday, July 21, 2012 1:26 AM > > To: Zhao, Bingfeng; tglx at linutronix.de > > Cc: lttng-dev at lists.lttng.org > > Subject: Re: [lttng-dev] some questions on lttng > > > > * Bingfeng.Zhao at emc.com (Bingfeng.Zhao at emc.com) wrote: > > > Anyone can answer our questions? Mathieu? > > > > sorry for the slow reply, I've been swamped in filtering implementation lately, > > > > > > > > From: Bingfeng.Zhao at emc.com [mailto:Bingfeng.Zhao at emc.com] > > > Sent: Wednesday, July 18, 2012 5:54 PM > > > To: lttng-dev at lists.lttng.org > > > Subject: [lttng-dev] some questions on lttng > > > > > > Hello the dev list, > > > We encounter some basic questions when try to adapt the LTTNG in our poject. > > > > > > 1. When the trace is enabled and all are well configurated, we get > > > trace messages collected under the session folder. The question is > > > whether it is possible that some traces will lost when the trace > > > messages are huge. How will LTTNG do if the consumer deamon cannot > > > fast enough to copy the trace message from trace buffer? > > > > There are currently two ways to configure the channels: discard and overwrite > > mode. > > > > In discard mode, upon buffer full condition, events are discarded, and we keep > > track of the number of events discarded in the packet headers, so the trace viewer > > can print warnings about discarded events within a specific time-frame. > > > > In overwrite mode, upon buffer full condition, the oldest subbuffer > > (packet) is overwritten. We will soon add a sequence counter to the packet header, > > so the trace viewer can show when a packet is missing in the stream (either due to > > being overwritten by the tracer or due to UDP packet loss in network streaming). > > > > If the message (event) is too large to fit within a packet, it is discarded, > > incrementing the event discarded counter accordingly (so the viewer can show this > > information from the packet header). > > > > It would be interesting to implement a "blocking" mode that makes the application > > block if buffer is full. This makes the tracer much more intrusive, and if something > > goes wrong in the session daemon or consumer daemon, the app hangs, but it > > might be interesting for logging purposes, if you care about _never_ losing an > > event. I would recommend to use this kind of feature in debugging setups, not in > > production, at the beginning, since it would make the sessiond/consumerd critical > > (if they die, the application hangs. I don't want to see this happen in production). > > > Thanks for the explanation, I got you point. However I'm at a > different scenario. Normally the trace is off by default, that is > there is no session created and started. The trace call definitely > should not block anything. Ideally it should not trigger at all and I > believe that is what lttng does now. Indeed. > > If I find something wrong, I would like enable the trace at once and > try to figure out what happen. Yes, but it would be a shame if the tracer, when enabled to diagnose the issue you are encountering, modify the system behavior too much (e.g. by blocking the application), and thus makes the problem disappear under tracing, or worse, triggers other problems. > At this time, (possible) lost event > will make the trouble shooting much difficult (example for those rare > race condition issues) as you cannot reason about what you collected > if there are some messages lost. So all the meaning of static trace > may lost and such scenario is not rare in production. The LTTng kernel and UST tracers provide information about events discarded in the packet headers which help the user understand where the events have been dropped, and what to do about it (increase their buffer size for the next time they trace this workload). That should be sufficient to reproduce issues with a fixed, preallocated amount of resources, without changing the behavior of the traced system too much (without blocking). I think minimizing the impact of a running tracer (no blocking, no system slowdown, no possible application hang due to tracer bug) outweight the downside of having to gather another run of trace for the rare cases where events were discarded. Thoughts ? Thanks, Mathieu -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From tarek.slaymia at gmail.com Mon Jul 23 13:30:53 2012 From: tarek.slaymia at gmail.com (tarek slaymia) Date: Mon, 23 Jul 2012 13:30:53 -0400 Subject: [lttng-dev] security over LTTng Message-ID: Hey all, I'm student , i interessted on security field . I have seen some works talking about pattern abstraction of LTTng traces in order to minimise their size and their easily interpretation . Other works talk about security pattern using these abstracting traces to detect host-based or network intrusion . Did LTTV or TMF eclipse plugin implements theses type of patterns ? Did you invest in security field in your developpment of LTTng , TMF plugin or any other tool ? Best Regards. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu.desnoyers at efficios.com Mon Jul 23 14:00:42 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 23 Jul 2012 14:00:42 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Fix: health monitoring (various fixes) Message-ID: <20120723180041.GA12458@Krystal> * Fix modulo operation bug on #define HEALTH_IS_IN_CODE(x) (x % HEALTH_POLL_VALUE) which is causing the check to think it is never within code. (x % 1 always equals 0). Simplify this by using a simple & on the poll value, and remove the IS_IN_CODE, using ! on IS_IN_POLL instead (which removes nothing to clarity). * Atomic operations should apply to at most "unsigned long" (32-bit on 32-bit arch) rather than uint64_t. * Separate the "error" condition from the counters. We clearly cannot use the "0" value as an error on 32-bit counters anymore, because they can easily wrap. * Introduce "exit" condition, will be useful for state tracking in the future. Error and exit conditions implemented as flags. * Add "APP_MANAGE" in addition to "APP_REG" health check, to monitor the app registration thread (which was missing, only the app manager thread was checked, under the name "APP_REG", which was misleading). * Comment the last, current and flag values in struct health state, especially how they are accessed. * Remove bogus usage of uatomic_xchg() in health_check_state(): It is not needed to update the "last" value, since the last value is read and written to by a single thread. Moreover, this specific use of xchg was not exchanging anything: it was just setting the last value to the "current" one, and doing nothing with the return value. Whatever was expected to be achieved by using uatomic_xchg() clearly wasn't. * Because the health check thread could still be answering a request concurrently sessiond teardown, we need to ensure that all threads only set the "error" condition if they reach teardown paths due to an actual error, not on "normal" teardown condition (thread quit pipe being closed). Flagging threads as being in error condition upon all exit paths would lead to false "errors" sent to the client, which we want to avoid, since the client could then think it needs to kill a sessiond when the sessiond might be in the process of gracefully restarting. Signed-off-by: Mathieu Desnoyers CC: David Goulet --- diff --git a/include/lttng/lttng.h b/include/lttng/lttng.h index 6823579..7754bcd 100644 --- a/include/lttng/lttng.h +++ b/include/lttng/lttng.h @@ -134,6 +134,7 @@ enum lttng_calibrate_type { /* Health component for the health check function. */ enum lttng_health_component { LTTNG_HEALTH_CMD, + LTTNG_HEALTH_APP_MANAGE, LTTNG_HEALTH_APP_REG, LTTNG_HEALTH_KERNEL, LTTNG_HEALTH_CONSUMER, diff --git a/src/bin/lttng-sessiond/health.c b/src/bin/lttng-sessiond/health.c index 58f804e..d7d25cf 100644 --- a/src/bin/lttng-sessiond/health.c +++ b/src/bin/lttng-sessiond/health.c @@ -32,33 +32,29 @@ */ int health_check_state(struct health_state *state) { - int ret; - uint64_t current; - uint64_t last; + unsigned long current, last; + int ret = 1; assert(state); + last = state->last; current = uatomic_read(&state->current); - last = uatomic_read(&state->last); /* - * Here are the conditions for a bad health. Current state set to 0 or the - * current state is the same as the last one and we are NOT waiting for a - * poll() call. + * Here are the conditions for a bad health. Either flag + * HEALTH_ERROR is set, or the progress counter is the same as + * the last one and we are NOT waiting for a poll() call. */ - if (current == 0 || (current == last && HEALTH_IS_IN_CODE(current))) { + if ((uatomic_read(&state->flags) & HEALTH_ERROR) + || (current == last && !HEALTH_IS_IN_POLL(current))) { + /* error */ ret = 0; - goto error; } - /* All good */ - ret = 1; - -error: DBG("Health state current %" PRIu64 ", last %" PRIu64 ", ret %d", current, last, ret); - /* Exchange current state counter into last one */ - uatomic_xchg(&state->last, state->current); + /* update last counter */ + state->last = current; return ret; } diff --git a/src/bin/lttng-sessiond/health.h b/src/bin/lttng-sessiond/health.h index 9a1ef39..b268860 100644 --- a/src/bin/lttng-sessiond/health.h +++ b/src/bin/lttng-sessiond/health.h @@ -25,20 +25,35 @@ * These are the value added to the current state depending of the position in * the thread where is either waiting on a poll() or running in the code. */ -#define HEALTH_POLL_VALUE 1 -#define HEALTH_CODE_VALUE 2 +#define HEALTH_POLL_VALUE (1UL << 0) +#define HEALTH_CODE_VALUE (1UL << 1) -#define HEALTH_IS_IN_POLL(x) (x % HEALTH_CODE_VALUE) -#define HEALTH_IS_IN_CODE(x) (x % HEALTH_POLL_VALUE) +#define HEALTH_IS_IN_POLL(x) ((x) & HEALTH_POLL_VALUE) + +enum health_flags { + HEALTH_EXIT = (1U << 0), + HEALTH_ERROR = (1U << 1), +}; struct health_state { - uint64_t last; - uint64_t current; + /* + * last counter is only read and updated by the health_check + * thread (single updater). + */ + unsigned long last; + /* + * current and flags are updated by multiple threads concurrently. + */ + unsigned long current; /* progress counter, updated atomically */ + enum health_flags flags; /* other flags, updated atomically */ }; /* Health state counters for the client command thread */ extern struct health_state health_thread_cmd; +/* Health state counters for the application management thread */ +extern struct health_state health_thread_app_manage; + /* Health state counters for the application registration thread */ extern struct health_state health_thread_app_reg; @@ -46,36 +61,41 @@ extern struct health_state health_thread_app_reg; extern struct health_state health_thread_kernel; /* - * Update current counter by 1 to indicate that the thread is in a blocking - * state cause by a poll(). + * Update current counter by 1 to indicate that the thread entered or + * left a blocking state caused by a poll(). */ static inline void health_poll_update(struct health_state *state) { assert(state); - uatomic_add(&state->current, HEALTH_POLL_VALUE); } /* - * Update current counter by 2 which indicates that we are currently running in - * a thread and NOT blocked at a poll(). + * Update current counter by 2 indicates progress in execution of a + * thread. */ static inline void health_code_update(struct health_state *state) { assert(state); - uatomic_add(&state->current, HEALTH_CODE_VALUE); } /* - * Reset health state. A value of zero indicate a bad health state. + * Set health "exit" flag. */ -static inline void health_reset(struct health_state *state) +static inline void health_exit(struct health_state *state) { assert(state); + uatomic_or(&state->flags, HEALTH_EXIT); +} - uatomic_set(&state->current, 0); - uatomic_set(&state->last, 0); +/* + * Set health "error" flag. + */ +static inline void health_error(struct health_state *state) +{ + assert(state); + uatomic_or(&state->flags, HEALTH_ERROR); } /* @@ -84,9 +104,9 @@ static inline void health_reset(struct health_state *state) static inline void health_init(struct health_state *state) { assert(state); - uatomic_set(&state->last, 0); - uatomic_set(&state->current, HEALTH_CODE_VALUE); + uatomic_set(&state->current, 0); + uatomic_set(&state->flags, 0); } int health_check_state(struct health_state *state); diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 5664b0b..c699f1b 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -216,6 +216,7 @@ static unsigned int relayd_net_seq_idx; /* Used for the health monitoring of the session daemon. See health.h */ struct health_state health_thread_cmd; +struct health_state health_thread_app_manage; struct health_state health_thread_app_reg; struct health_state health_thread_kernel; @@ -716,7 +717,7 @@ static void update_ust_app(int app_sock) */ static void *thread_manage_kernel(void *data) { - int ret, i, pollfd, update_poll_flag = 1; + int ret, i, pollfd, update_poll_flag = 1, err = -1; uint32_t revents, nb_fd; char tmp; struct lttng_poll_event events; @@ -789,7 +790,8 @@ static void *thread_manage_kernel(void *data) /* Thread quit pipe has been closed. Killing thread. */ ret = check_thread_quit_pipe(pollfd, revents); if (ret) { - goto error; + err = 0; + goto exit; } /* Check for data on kernel pipe */ @@ -817,10 +819,15 @@ static void *thread_manage_kernel(void *data) } } +exit: error: lttng_poll_clean(&events); error_poll_create: - health_reset(&health_thread_kernel); + if (err) { + DBG("An error occurred in %s", __func__); + health_error(&health_thread_kernel); + } + health_exit(&health_thread_kernel); DBG("Kernel thread dying"); return NULL; } @@ -830,7 +837,7 @@ error_poll_create: */ static void *thread_manage_consumer(void *data) { - int sock = -1, i, ret, pollfd; + int sock = -1, i, ret, pollfd, err = -1; uint32_t revents, nb_fd; enum lttcomm_return_code code; struct lttng_poll_event events; @@ -888,7 +895,8 @@ restart: /* Thread quit pipe has been closed. Killing thread. */ ret = check_thread_quit_pipe(pollfd, revents); if (ret) { - goto error; + err = 0; + goto exit; } /* Event on the registration socket */ @@ -976,7 +984,8 @@ restart_poll: /* Thread quit pipe has been closed. Killing thread. */ ret = check_thread_quit_pipe(pollfd, revents); if (ret) { - goto error; + err = 0; + goto exit; } /* Event on the kconsumerd socket */ @@ -1000,6 +1009,7 @@ restart_poll: ERR("consumer return code : %s", lttcomm_get_readable_code(-code)); +exit: error: /* Immediately set the consumerd state to stopped */ if (consumer_data->type == LTTNG_CONSUMER_KERNEL) { @@ -1038,7 +1048,11 @@ error: lttng_poll_clean(&events); error_poll: error_listen: - health_reset(&consumer_data->health); + if (err) { + DBG("An error occurred in %s", __func__); + health_error(&consumer_data->health); + } + health_exit(&consumer_data->health); DBG("consumer thread cleanup completed"); return NULL; @@ -1049,7 +1063,7 @@ error_listen: */ static void *thread_manage_apps(void *data) { - int i, ret, pollfd; + int i, ret, pollfd, err = -1; uint32_t revents, nb_fd; struct ust_command ust_cmd; struct lttng_poll_event events; @@ -1059,7 +1073,7 @@ static void *thread_manage_apps(void *data) rcu_register_thread(); rcu_thread_online(); - health_code_update(&health_thread_app_reg); + health_code_update(&health_thread_app_manage); ret = create_thread_poll_set(&events, 2); if (ret < 0) { @@ -1071,7 +1085,7 @@ static void *thread_manage_apps(void *data) goto error; } - health_code_update(&health_thread_app_reg); + health_code_update(&health_thread_app_manage); while (1) { /* Zeroed the events structure */ @@ -1083,9 +1097,9 @@ static void *thread_manage_apps(void *data) /* Inifinite blocking call, waiting for transmission */ restart: - health_poll_update(&health_thread_app_reg); + health_poll_update(&health_thread_app_manage); ret = lttng_poll_wait(&events, -1); - health_poll_update(&health_thread_app_reg); + health_poll_update(&health_thread_app_manage); if (ret < 0) { /* * Restart interrupted system call. @@ -1101,12 +1115,13 @@ static void *thread_manage_apps(void *data) revents = LTTNG_POLL_GETEV(&events, i); pollfd = LTTNG_POLL_GETFD(&events, i); - health_code_update(&health_thread_app_reg); + health_code_update(&health_thread_app_manage); /* Thread quit pipe has been closed. Killing thread. */ ret = check_thread_quit_pipe(pollfd, revents); if (ret) { - goto error; + err = 0; + goto exit; } /* Inspect the apps cmd pipe */ @@ -1122,7 +1137,7 @@ static void *thread_manage_apps(void *data) goto error; } - health_code_update(&health_thread_app_reg); + health_code_update(&health_thread_app_manage); /* Register applicaton to the session daemon */ ret = ust_app_register(&ust_cmd.reg_msg, @@ -1133,7 +1148,7 @@ static void *thread_manage_apps(void *data) break; } - health_code_update(&health_thread_app_reg); + health_code_update(&health_thread_app_manage); /* * Validate UST version compatibility. @@ -1147,7 +1162,7 @@ static void *thread_manage_apps(void *data) update_ust_app(ust_cmd.sock); } - health_code_update(&health_thread_app_reg); + health_code_update(&health_thread_app_manage); ret = ust_app_register_done(ust_cmd.sock); if (ret < 0) { @@ -1172,7 +1187,7 @@ static void *thread_manage_apps(void *data) ust_cmd.sock); } - health_code_update(&health_thread_app_reg); + health_code_update(&health_thread_app_manage); break; } @@ -1194,14 +1209,19 @@ static void *thread_manage_apps(void *data) } } - health_code_update(&health_thread_app_reg); + health_code_update(&health_thread_app_manage); } } +exit: error: lttng_poll_clean(&events); error_poll_create: - health_reset(&health_thread_app_reg); + if (err) { + DBG("An error occurred in %s", __func__); + health_error(&health_thread_app_manage); + } + health_exit(&health_thread_app_manage); DBG("Application communication apps thread cleanup complete"); rcu_thread_offline(); rcu_unregister_thread(); @@ -1277,7 +1297,7 @@ error: */ static void *thread_registration_apps(void *data) { - int sock = -1, i, ret, pollfd; + int sock = -1, i, ret, pollfd, err = -1; uint32_t revents, nb_fd; struct lttng_poll_event events; /* @@ -1323,7 +1343,9 @@ static void *thread_registration_apps(void *data) /* Inifinite blocking call, waiting for transmission */ restart: + health_poll_update(&health_thread_app_reg); ret = lttng_poll_wait(&events, -1); + health_poll_update(&health_thread_app_reg); if (ret < 0) { /* * Restart interrupted system call. @@ -1335,6 +1357,8 @@ static void *thread_registration_apps(void *data) } for (i = 0; i < nb_fd; i++) { + health_code_update(&health_thread_app_reg); + /* Fetch once the poll data */ revents = LTTNG_POLL_GETEV(&events, i); pollfd = LTTNG_POLL_GETFD(&events, i); @@ -1342,7 +1366,8 @@ static void *thread_registration_apps(void *data) /* Thread quit pipe has been closed. Killing thread. */ ret = check_thread_quit_pipe(pollfd, revents); if (ret) { - goto error; + err = 0; + goto exit; } /* Event on the registration socket */ @@ -1378,6 +1403,7 @@ static void *thread_registration_apps(void *data) sock = -1; continue; } + health_code_update(&health_thread_app_reg); ret = lttcomm_recv_unix_sock(sock, &ust_cmd->reg_msg, sizeof(struct ust_register_msg)); if (ret < 0 || ret < sizeof(struct ust_register_msg)) { @@ -1395,6 +1421,7 @@ static void *thread_registration_apps(void *data) sock = -1; continue; } + health_code_update(&health_thread_app_reg); ust_cmd->sock = sock; sock = -1; @@ -1422,7 +1449,14 @@ static void *thread_registration_apps(void *data) } } +exit: error: + if (err) { + DBG("An error occurred in %s", __func__); + health_error(&health_thread_app_reg); + } + health_exit(&health_thread_app_reg); + /* Notify that the registration thread is gone */ notify_ust_apps(0); @@ -1742,15 +1776,15 @@ error: } /* - * Compute health status of each consumer. + * Compute health status of each consumer. If one of them is zero (bad + * state), we return 0. */ static int check_consumer_health(void) { int ret; - ret = - health_check_state(&kconsumer_data.health) & - health_check_state(&ustconsumer32_data.health) & + ret = health_check_state(&kconsumer_data.health) && + health_check_state(&ustconsumer32_data.health) && health_check_state(&ustconsumer64_data.health); DBG3("Health consumer check %d", ret); @@ -4627,7 +4661,7 @@ init_setup_error: */ static void *thread_manage_health(void *data) { - int sock = -1, new_sock, ret, i, pollfd; + int sock = -1, new_sock, ret, i, pollfd, err = -1; uint32_t revents, nb_fd; struct lttng_poll_event events; struct lttcomm_health_msg msg; @@ -4691,7 +4725,8 @@ restart: /* Thread quit pipe has been closed. Killing thread. */ ret = check_thread_quit_pipe(pollfd, revents); if (ret) { - goto error; + err = 0; + goto exit; } /* Event on the registration socket */ @@ -4726,6 +4761,9 @@ restart: case LTTNG_HEALTH_CMD: reply.ret_code = health_check_state(&health_thread_cmd); break; + case LTTNG_HEALTH_APP_MANAGE: + reply.ret_code = health_check_state(&health_thread_app_manage); + break; case LTTNG_HEALTH_APP_REG: reply.ret_code = health_check_state(&health_thread_app_reg); break; @@ -4736,13 +4774,12 @@ restart: reply.ret_code = check_consumer_health(); break; case LTTNG_HEALTH_ALL: - ret = check_consumer_health(); - reply.ret_code = - health_check_state(&health_thread_app_reg) & - health_check_state(&health_thread_cmd) & - health_check_state(&health_thread_kernel) & - ret; + health_check_state(&health_thread_app_manage) && + health_check_state(&health_thread_app_reg) && + health_check_state(&health_thread_cmd) && + health_check_state(&health_thread_kernel) && + check_consumer_health(); break; default: reply.ret_code = LTTCOMM_UND; @@ -4774,7 +4811,11 @@ restart: new_sock = -1; } +exit: error: + if (err) { + DBG("An error occurred in %s", __func__); + } DBG("Health check thread dying"); unlink(health_unix_sock_path); if (sock >= 0) { @@ -4802,7 +4843,7 @@ error: */ static void *thread_manage_clients(void *data) { - int sock = -1, ret, i, pollfd; + int sock = -1, ret, i, pollfd, err = -1; int sock_error; uint32_t revents, nb_fd; struct command_ctx *cmd_ctx = NULL; @@ -4873,7 +4914,8 @@ static void *thread_manage_clients(void *data) /* Thread quit pipe has been closed. Killing thread. */ ret = check_thread_quit_pipe(pollfd, revents); if (ret) { - goto error; + err = 0; + goto exit; } /* Event on the registration socket */ @@ -4993,8 +5035,13 @@ static void *thread_manage_clients(void *data) health_code_update(&health_thread_cmd); } +exit: error: - health_reset(&health_thread_cmd); + if (err) { + DBG("An error occurred in %s", __func__); + health_error(&health_thread_cmd); + } + health_exit(&health_thread_cmd); DBG("Client thread dying"); unlink(client_unix_sock_path); @@ -5740,6 +5787,7 @@ int main(int argc, char **argv) /* Init all health thread counters. */ health_init(&health_thread_cmd); health_init(&health_thread_kernel); + health_init(&health_thread_app_manage); health_init(&health_thread_app_reg); /* -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Mon Jul 23 15:12:05 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 23 Jul 2012 15:12:05 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Fix: health check and time Message-ID: <20120723191204.GA12711@Krystal> I notice that currently, the health check code does not have a notion of "time flow": therefore, two consecutive calls to lttng_health_check() might end up returning a bad state (0) just because there was too little time between the invocations. However, the lttng.h documentation states: /* * Check session daemon health for a specific component. * * Return 0 if health is OK or 1 if BAD. A returned value of -1 indicate that * the control library was not able to connect to the session daemon health * socket. * * Any other positive value is an lttcomm error which can be translate with * lttng_strerror(). */ extern int lttng_health_check(enum lttng_health_component c); Therefore, the user would expect that handling the time flow in between the invocation is dealth with internally, which is what I remember we agreed on. So we would need to add some time information to the "last" snapshot, so we can do a time delta between the current and last snapshot to figure out if we need to report the thread as stalled or not. Signed-off-by: Mathieu Desnoyers CC: David Goulet --- diff --git a/src/bin/lttng-sessiond/health.c b/src/bin/lttng-sessiond/health.c index d7d25cf..cbda651 100644 --- a/src/bin/lttng-sessiond/health.c +++ b/src/bin/lttng-sessiond/health.c @@ -20,12 +20,58 @@ #include #include #include +#include #include #include "health.h" /* + * If a thread stalls for this amount of time, it will be considered + * bogus (bad health). + */ +#define HEALTH_CHECK_DELTA_S 20 +#define HEALTH_CHECK_DELTA_NS 0 + +static const struct timespec time_delta = { + .tv_sec = HEALTH_CHECK_DELTA_S, + .tv_nsec = HEALTH_CHECK_DELTA_NS, +}; + +static +void time_diff(const struct timespec *time_a, const struct timespec *time_b, + struct timespec *res) +{ + if (time_a->tv_nsec - time_b->tv_nsec < 0) { + res->tv_sec = time_a->tv_sec - time_b->tv_sec - 1; + res->tv_nsec = 1000000000L + time_a->tv_sec - time_b->tv_sec; + } else { + res->tv_sec = time_a->tv_sec - time_b->tv_sec; + res->tv_nsec = time_a->tv_sec - time_b->tv_sec; + } +} + +/* + * Return true if time_a - time_b > diff, else false. + */ +static +int time_diff_gt(const struct timespec *time_a, const struct timespec *time_b, + const struct timespec *diff) +{ + struct timespec res; + + time_diff(time_a, time_b, &res); + time_diff(&res, diff, &res); + if (res.tv_sec > 0) { + return 1; + } + if (res.tv_sec == 0 && res.tv_nsec > 0) { + return 1; + } + return 0; +} + +/* * Check health of a specific health state counter. * * Return 0 if health is bad or else 1. @@ -33,28 +79,55 @@ int health_check_state(struct health_state *state) { unsigned long current, last; - int ret = 1; + struct timespec current_time; + int retval = 1, ret; assert(state); last = state->last; current = uatomic_read(&state->current); + ret = clock_gettime(CLOCK_MONOTONIC, ¤t_time); + if (ret) { + PERROR("Error reading time\n"); + /* error */ + retval = 0; + goto end; + } /* - * Here are the conditions for a bad health. Either flag - * HEALTH_ERROR is set, or the progress counter is the same as - * the last one and we are NOT waiting for a poll() call. + * Thread is in are in bad health if flag HEALTH_ERROR is set. It + * is also in bad health if, after the delta delay has passed, + * its the progress counter has not moved and it has NOT been + * waiting for a poll() call. */ - if ((uatomic_read(&state->flags) & HEALTH_ERROR) - || (current == last && !HEALTH_IS_IN_POLL(current))) { - /* error */ - ret = 0; + if (uatomic_read(&state->flags) & HEALTH_ERROR) { + retval = 0; + goto end; + } + + /* + * Initial condition need to update the last counter and sample + * time, but should not check health in this initial case, + * because we don't know how much time has passed. + */ + if (state->last_time.tv_sec == 0 && state->last_time.tv_nsec == 0) { + /* update last counter and last sample time */ + state->last = current; + memcpy(&state->last_time, ¤t_time, sizeof(current_time)); + } else { + if (time_diff_gt(¤t_time, &state->last_time, &time_delta)) { + if (current == last && !HEALTH_IS_IN_POLL(current)) { + /* error */ + retval = 0; + } + /* update last counter and last sample time */ + state->last = current; + memcpy(&state->last_time, ¤t_time, sizeof(current_time)); + } } +end: DBG("Health state current %" PRIu64 ", last %" PRIu64 ", ret %d", current, last, ret); - - /* update last counter */ - state->last = current; - return ret; + return retval; } diff --git a/src/bin/lttng-sessiond/health.h b/src/bin/lttng-sessiond/health.h index b268860..8f19fe8 100644 --- a/src/bin/lttng-sessiond/health.h +++ b/src/bin/lttng-sessiond/health.h @@ -20,6 +20,7 @@ #include #include +#include /* * These are the value added to the current state depending of the position in @@ -37,10 +38,12 @@ enum health_flags { struct health_state { /* - * last counter is only read and updated by the health_check - * thread (single updater). + * last counter and last_time are only read and updated by the + * health_check thread (single updater). */ unsigned long last; + struct timespec last_time; + /* * current and flags are updated by multiple threads concurrently. */ @@ -104,7 +107,9 @@ static inline void health_error(struct health_state *state) static inline void health_init(struct health_state *state) { assert(state); - uatomic_set(&state->last, 0); + state->last = 0; + state->last_time.tv_sec = 0; + state->last_time.tv_nsec = 0; uatomic_set(&state->current, 0); uatomic_set(&state->flags, 0); } -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From tarek.slaymia at gmail.com Mon Jul 23 15:12:49 2012 From: tarek.slaymia at gmail.com (tarek slaymia) Date: Mon, 23 Jul 2012 15:12:49 -0400 Subject: [lttng-dev] security over LTTng In-Reply-To: References: Message-ID: Hey all, I'm student , i interested on security field . I have seen some works talking about pattern abstraction of LTTng traces in order to minimise their size and their easily interpretation . Other works talk about security pattern using these abstracting traces to detect host-based or network intrusion . Did LTTV or TMF eclipse plugin implements theses type of patterns ? Did you invest in security field in your development of LTTng , TMF plugin or any other tool ? Best Regards. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tarek.slaymia at gmail.com Tue Jul 24 11:23:53 2012 From: tarek.slaymia at gmail.com (tarek slaymia) Date: Tue, 24 Jul 2012 11:23:53 -0400 Subject: [lttng-dev] Fwd: security over LTTng In-Reply-To: References: Message-ID: Anyone can answer me please ? thank you . -------------- next part -------------- An HTML attachment was scrubbed... URL: From dgoulet at efficios.com Tue Jul 24 12:19:45 2012 From: dgoulet at efficios.com (David Goulet) Date: Tue, 24 Jul 2012 12:19:45 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Fix: health monitoring (various fixes) In-Reply-To: <20120723180041.GA12458@Krystal> References: <20120723180041.GA12458@Krystal> Message-ID: <500ECB21.8030204@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 I just merged this commit with small modifications here and there on the comments and error messages but all in all, these fixes are the same and upstream. Thanks! David Mathieu Desnoyers: > * Fix modulo operation bug on #define HEALTH_IS_IN_CODE(x) (x % > HEALTH_POLL_VALUE) which is causing the check to think it is never > within code. (x % 1 always equals 0). Simplify this by using a > simple & on the poll value, and remove the IS_IN_CODE, using ! on > IS_IN_POLL instead (which removes nothing to clarity). * Atomic > operations should apply to at most "unsigned long" (32-bit on > 32-bit arch) rather than uint64_t. * Separate the "error" condition > from the counters. We clearly cannot use the "0" value as an error > on 32-bit counters anymore, because they can easily wrap. * > Introduce "exit" condition, will be useful for state tracking in > the future. Error and exit conditions implemented as flags. * Add > "APP_MANAGE" in addition to "APP_REG" health check, to monitor the > app registration thread (which was missing, only the app manager > thread was checked, under the name "APP_REG", which was > misleading). * Comment the last, current and flag values in struct > health state, especially how they are accessed. * Remove bogus > usage of uatomic_xchg() in health_check_state(): It is not needed > to update the "last" value, since the last value is read and > written to by a single thread. Moreover, this specific use of xchg > was not exchanging anything: it was just setting the last value to > the "current" one, and doing nothing with the return value. > Whatever was expected to be achieved by using uatomic_xchg() > clearly wasn't. * Because the health check thread could still be > answering a request concurrently sessiond teardown, we need to > ensure that all threads only set the "error" condition if they > reach teardown paths due to an actual error, not on "normal" > teardown condition (thread quit pipe being closed). Flagging > threads as being in error condition upon all exit paths would lead > to false "errors" sent to the client, which we want to avoid, since > the client could then think it needs to kill a sessiond when the > sessiond might be in the process of gracefully restarting. > > Signed-off-by: Mathieu Desnoyers > CC: David Goulet --- diff --git > a/include/lttng/lttng.h b/include/lttng/lttng.h index > 6823579..7754bcd 100644 --- a/include/lttng/lttng.h +++ > b/include/lttng/lttng.h @@ -134,6 +134,7 @@ enum > lttng_calibrate_type { /* Health component for the health check > function. */ enum lttng_health_component { LTTNG_HEALTH_CMD, + > LTTNG_HEALTH_APP_MANAGE, LTTNG_HEALTH_APP_REG, > LTTNG_HEALTH_KERNEL, LTTNG_HEALTH_CONSUMER, diff --git > a/src/bin/lttng-sessiond/health.c > b/src/bin/lttng-sessiond/health.c index 58f804e..d7d25cf 100644 --- > a/src/bin/lttng-sessiond/health.c +++ > b/src/bin/lttng-sessiond/health.c @@ -32,33 +32,29 @@ */ int > health_check_state(struct health_state *state) { - int ret; - > uint64_t current; - uint64_t last; + unsigned long current, last; + > int ret = 1; > > assert(state); > > + last = state->last; current = uatomic_read(&state->current); - > last = uatomic_read(&state->last); > > /* - * Here are the conditions for a bad health. Current state set > to 0 or the - * current state is the same as the last one and we > are NOT waiting for a - * poll() call. + * Here are the > conditions for a bad health. Either flag + * HEALTH_ERROR is set, > or the progress counter is the same as + * the last one and we are > NOT waiting for a poll() call. */ - if (current == 0 || (current == > last && HEALTH_IS_IN_CODE(current))) { + if > ((uatomic_read(&state->flags) & HEALTH_ERROR) + || (current == > last && !HEALTH_IS_IN_POLL(current))) { + /* error */ ret = 0; - > goto error; } > > - /* All good */ - ret = 1; - -error: DBG("Health state current %" > PRIu64 ", last %" PRIu64 ", ret %d", current, last, ret); > > - /* Exchange current state counter into last one */ - > uatomic_xchg(&state->last, state->current); + /* update last > counter */ + state->last = current; return ret; } diff --git > a/src/bin/lttng-sessiond/health.h > b/src/bin/lttng-sessiond/health.h index 9a1ef39..b268860 100644 --- > a/src/bin/lttng-sessiond/health.h +++ > b/src/bin/lttng-sessiond/health.h @@ -25,20 +25,35 @@ * These are > the value added to the current state depending of the position in * > the thread where is either waiting on a poll() or running in the > code. */ -#define HEALTH_POLL_VALUE 1 -#define HEALTH_CODE_VALUE 2 > +#define HEALTH_POLL_VALUE (1UL << 0) +#define HEALTH_CODE_VALUE > (1UL << 1) > > -#define HEALTH_IS_IN_POLL(x) (x % HEALTH_CODE_VALUE) -#define > HEALTH_IS_IN_CODE(x) (x % HEALTH_POLL_VALUE) +#define > HEALTH_IS_IN_POLL(x) ((x) & HEALTH_POLL_VALUE) + +enum health_flags > { + HEALTH_EXIT = (1U << 0), + HEALTH_ERROR = (1U << 1), +}; > > struct health_state { - uint64_t last; - uint64_t current; + /* + > * last counter is only read and updated by the health_check + * > thread (single updater). + */ + unsigned long last; + /* + * > current and flags are updated by multiple threads concurrently. + > */ + unsigned long current; /* progress counter, updated > atomically */ + enum health_flags flags; /* other flags, updated > atomically */ }; > > /* Health state counters for the client command thread */ extern > struct health_state health_thread_cmd; > > +/* Health state counters for the application management thread */ > +extern struct health_state health_thread_app_manage; + /* Health > state counters for the application registration thread */ extern > struct health_state health_thread_app_reg; > > @@ -46,36 +61,41 @@ extern struct health_state > health_thread_app_reg; extern struct health_state > health_thread_kernel; > > /* - * Update current counter by 1 to indicate that the thread is > in a blocking - * state cause by a poll(). + * Update current > counter by 1 to indicate that the thread entered or + * left a > blocking state caused by a poll(). */ static inline void > health_poll_update(struct health_state *state) { assert(state); - > uatomic_add(&state->current, HEALTH_POLL_VALUE); } > > /* - * Update current counter by 2 which indicates that we are > currently running in - * a thread and NOT blocked at a poll(). + * > Update current counter by 2 indicates progress in execution of a + > * thread. */ static inline void health_code_update(struct > health_state *state) { assert(state); - > uatomic_add(&state->current, HEALTH_CODE_VALUE); } > > /* - * Reset health state. A value of zero indicate a bad health > state. + * Set health "exit" flag. */ -static inline void > health_reset(struct health_state *state) +static inline void > health_exit(struct health_state *state) { assert(state); + > uatomic_or(&state->flags, HEALTH_EXIT); +} > > - uatomic_set(&state->current, 0); - uatomic_set(&state->last, 0); > +/* + * Set health "error" flag. + */ +static inline void > health_error(struct health_state *state) +{ + assert(state); + > uatomic_or(&state->flags, HEALTH_ERROR); } > > /* @@ -84,9 +104,9 @@ static inline void health_reset(struct > health_state *state) static inline void health_init(struct > health_state *state) { assert(state); - uatomic_set(&state->last, > 0); - uatomic_set(&state->current, HEALTH_CODE_VALUE); + > uatomic_set(&state->current, 0); + uatomic_set(&state->flags, 0); > } > > int health_check_state(struct health_state *state); diff --git > a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c > index 5664b0b..c699f1b 100644 --- a/src/bin/lttng-sessiond/main.c > +++ b/src/bin/lttng-sessiond/main.c @@ -216,6 +216,7 @@ static > unsigned int relayd_net_seq_idx; > > /* Used for the health monitoring of the session daemon. See > health.h */ struct health_state health_thread_cmd; +struct > health_state health_thread_app_manage; struct health_state > health_thread_app_reg; struct health_state health_thread_kernel; > > @@ -716,7 +717,7 @@ static void update_ust_app(int app_sock) */ > static void *thread_manage_kernel(void *data) { - int ret, i, > pollfd, update_poll_flag = 1; + int ret, i, pollfd, > update_poll_flag = 1, err = -1; uint32_t revents, nb_fd; char tmp; > struct lttng_poll_event events; @@ -789,7 +790,8 @@ static void > *thread_manage_kernel(void *data) /* Thread quit pipe has been > closed. Killing thread. */ ret = check_thread_quit_pipe(pollfd, > revents); if (ret) { - goto error; + err = 0; + goto > exit; } > > /* Check for data on kernel pipe */ @@ -817,10 +819,15 @@ static > void *thread_manage_kernel(void *data) } } > > +exit: error: lttng_poll_clean(&events); error_poll_create: - > health_reset(&health_thread_kernel); + if (err) { + DBG("An error > occurred in %s", __func__); + > health_error(&health_thread_kernel); + } + > health_exit(&health_thread_kernel); DBG("Kernel thread dying"); > return NULL; } @@ -830,7 +837,7 @@ error_poll_create: */ static > void *thread_manage_consumer(void *data) { - int sock = -1, i, ret, > pollfd; + int sock = -1, i, ret, pollfd, err = -1; uint32_t > revents, nb_fd; enum lttcomm_return_code code; struct > lttng_poll_event events; @@ -888,7 +895,8 @@ restart: /* Thread > quit pipe has been closed. Killing thread. */ ret = > check_thread_quit_pipe(pollfd, revents); if (ret) { - goto > error; + err = 0; + goto exit; } > > /* Event on the registration socket */ @@ -976,7 +984,8 @@ > restart_poll: /* Thread quit pipe has been closed. Killing thread. > */ ret = check_thread_quit_pipe(pollfd, revents); if (ret) { - > goto error; + err = 0; + goto exit; } > > /* Event on the kconsumerd socket */ @@ -1000,6 +1009,7 @@ > restart_poll: > > ERR("consumer return code : %s", > lttcomm_get_readable_code(-code)); > > +exit: error: /* Immediately set the consumerd state to stopped */ > if (consumer_data->type == LTTNG_CONSUMER_KERNEL) { @@ -1038,7 > +1048,11 @@ error: lttng_poll_clean(&events); error_poll: > error_listen: - health_reset(&consumer_data->health); + if (err) { > + DBG("An error occurred in %s", __func__); + > health_error(&consumer_data->health); + } + > health_exit(&consumer_data->health); DBG("consumer thread cleanup > completed"); > > return NULL; @@ -1049,7 +1063,7 @@ error_listen: */ static void > *thread_manage_apps(void *data) { - int i, ret, pollfd; + int i, > ret, pollfd, err = -1; uint32_t revents, nb_fd; struct ust_command > ust_cmd; struct lttng_poll_event events; @@ -1059,7 +1073,7 @@ > static void *thread_manage_apps(void *data) rcu_register_thread(); > rcu_thread_online(); > > - health_code_update(&health_thread_app_reg); + > health_code_update(&health_thread_app_manage); > > ret = create_thread_poll_set(&events, 2); if (ret < 0) { @@ -1071,7 > +1085,7 @@ static void *thread_manage_apps(void *data) goto error; > } > > - health_code_update(&health_thread_app_reg); + > health_code_update(&health_thread_app_manage); > > while (1) { /* Zeroed the events structure */ @@ -1083,9 +1097,9 @@ > static void *thread_manage_apps(void *data) > > /* Inifinite blocking call, waiting for transmission */ restart: - > health_poll_update(&health_thread_app_reg); + > health_poll_update(&health_thread_app_manage); ret = > lttng_poll_wait(&events, -1); - > health_poll_update(&health_thread_app_reg); + > health_poll_update(&health_thread_app_manage); if (ret < 0) { /* * > Restart interrupted system call. @@ -1101,12 +1115,13 @@ static > void *thread_manage_apps(void *data) revents = > LTTNG_POLL_GETEV(&events, i); pollfd = LTTNG_POLL_GETFD(&events, > i); > > - health_code_update(&health_thread_app_reg); + > health_code_update(&health_thread_app_manage); > > /* Thread quit pipe has been closed. Killing thread. */ ret = > check_thread_quit_pipe(pollfd, revents); if (ret) { - goto > error; + err = 0; + goto exit; } > > /* Inspect the apps cmd pipe */ @@ -1122,7 +1137,7 @@ static void > *thread_manage_apps(void *data) goto error; } > > - health_code_update(&health_thread_app_reg); + > health_code_update(&health_thread_app_manage); > > /* Register applicaton to the session daemon */ ret = > ust_app_register(&ust_cmd.reg_msg, @@ -1133,7 +1148,7 @@ static > void *thread_manage_apps(void *data) break; } > > - health_code_update(&health_thread_app_reg); + > health_code_update(&health_thread_app_manage); > > /* * Validate UST version compatibility. @@ -1147,7 +1162,7 @@ > static void *thread_manage_apps(void *data) > update_ust_app(ust_cmd.sock); } > > - health_code_update(&health_thread_app_reg); + > health_code_update(&health_thread_app_manage); > > ret = ust_app_register_done(ust_cmd.sock); if (ret < 0) { @@ > -1172,7 +1187,7 @@ static void *thread_manage_apps(void *data) > ust_cmd.sock); } > > - health_code_update(&health_thread_app_reg); + > health_code_update(&health_thread_app_manage); > > break; } @@ -1194,14 +1209,19 @@ static void > *thread_manage_apps(void *data) } } > > - health_code_update(&health_thread_app_reg); + > health_code_update(&health_thread_app_manage); } } > > +exit: error: lttng_poll_clean(&events); error_poll_create: - > health_reset(&health_thread_app_reg); + if (err) { + DBG("An error > occurred in %s", __func__); + > health_error(&health_thread_app_manage); + } + > health_exit(&health_thread_app_manage); DBG("Application > communication apps thread cleanup complete"); > rcu_thread_offline(); rcu_unregister_thread(); @@ -1277,7 +1297,7 > @@ error: */ static void *thread_registration_apps(void *data) { - > int sock = -1, i, ret, pollfd; + int sock = -1, i, ret, pollfd, err > = -1; uint32_t revents, nb_fd; struct lttng_poll_event events; /* > @@ -1323,7 +1343,9 @@ static void *thread_registration_apps(void > *data) > > /* Inifinite blocking call, waiting for transmission */ restart: + > health_poll_update(&health_thread_app_reg); ret = > lttng_poll_wait(&events, -1); + > health_poll_update(&health_thread_app_reg); if (ret < 0) { /* * > Restart interrupted system call. @@ -1335,6 +1357,8 @@ static void > *thread_registration_apps(void *data) } > > for (i = 0; i < nb_fd; i++) { + > health_code_update(&health_thread_app_reg); + /* Fetch once the > poll data */ revents = LTTNG_POLL_GETEV(&events, i); pollfd = > LTTNG_POLL_GETFD(&events, i); @@ -1342,7 +1366,8 @@ static void > *thread_registration_apps(void *data) /* Thread quit pipe has been > closed. Killing thread. */ ret = check_thread_quit_pipe(pollfd, > revents); if (ret) { - goto error; + err = 0; + goto > exit; } > > /* Event on the registration socket */ @@ -1378,6 +1403,7 @@ static > void *thread_registration_apps(void *data) sock = -1; continue; } + > health_code_update(&health_thread_app_reg); ret = > lttcomm_recv_unix_sock(sock, &ust_cmd->reg_msg, sizeof(struct > ust_register_msg)); if (ret < 0 || ret < sizeof(struct > ust_register_msg)) { @@ -1395,6 +1421,7 @@ static void > *thread_registration_apps(void *data) sock = -1; continue; } + > health_code_update(&health_thread_app_reg); > > ust_cmd->sock = sock; sock = -1; @@ -1422,7 +1449,14 @@ static void > *thread_registration_apps(void *data) } } > > +exit: error: + if (err) { + DBG("An error occurred in %s", > __func__); + health_error(&health_thread_app_reg); + } + > health_exit(&health_thread_app_reg); + /* Notify that the > registration thread is gone */ notify_ust_apps(0); > > @@ -1742,15 +1776,15 @@ error: } > > /* - * Compute health status of each consumer. + * Compute health > status of each consumer. If one of them is zero (bad + * state), we > return 0. */ static int check_consumer_health(void) { int ret; > > - ret = - health_check_state(&kconsumer_data.health) & - > health_check_state(&ustconsumer32_data.health) & + ret = > health_check_state(&kconsumer_data.health) && + > health_check_state(&ustconsumer32_data.health) && > health_check_state(&ustconsumer64_data.health); > > DBG3("Health consumer check %d", ret); @@ -4627,7 +4661,7 @@ > init_setup_error: */ static void *thread_manage_health(void *data) > { - int sock = -1, new_sock, ret, i, pollfd; + int sock = -1, > new_sock, ret, i, pollfd, err = -1; uint32_t revents, nb_fd; struct > lttng_poll_event events; struct lttcomm_health_msg msg; @@ -4691,7 > +4725,8 @@ restart: /* Thread quit pipe has been closed. Killing > thread. */ ret = check_thread_quit_pipe(pollfd, revents); if (ret) > { - goto error; + err = 0; + goto exit; } > > /* Event on the registration socket */ @@ -4726,6 +4761,9 @@ > restart: case LTTNG_HEALTH_CMD: reply.ret_code = > health_check_state(&health_thread_cmd); break; + case > LTTNG_HEALTH_APP_MANAGE: + reply.ret_code = > health_check_state(&health_thread_app_manage); + break; case > LTTNG_HEALTH_APP_REG: reply.ret_code = > health_check_state(&health_thread_app_reg); break; @@ -4736,13 > +4774,12 @@ restart: reply.ret_code = check_consumer_health(); > break; case LTTNG_HEALTH_ALL: - ret = check_consumer_health(); - > reply.ret_code = - health_check_state(&health_thread_app_reg) & > - health_check_state(&health_thread_cmd) & - > health_check_state(&health_thread_kernel) & - ret; + > health_check_state(&health_thread_app_manage) && + > health_check_state(&health_thread_app_reg) && + > health_check_state(&health_thread_cmd) && + > health_check_state(&health_thread_kernel) && + > check_consumer_health(); break; default: reply.ret_code = > LTTCOMM_UND; @@ -4774,7 +4811,11 @@ restart: new_sock = -1; } > > +exit: error: + if (err) { + DBG("An error occurred in %s", > __func__); + } DBG("Health check thread dying"); > unlink(health_unix_sock_path); if (sock >= 0) { @@ -4802,7 +4843,7 > @@ error: */ static void *thread_manage_clients(void *data) { - int > sock = -1, ret, i, pollfd; + int sock = -1, ret, i, pollfd, err = > -1; int sock_error; uint32_t revents, nb_fd; struct command_ctx > *cmd_ctx = NULL; @@ -4873,7 +4914,8 @@ static void > *thread_manage_clients(void *data) /* Thread quit pipe has been > closed. Killing thread. */ ret = check_thread_quit_pipe(pollfd, > revents); if (ret) { - goto error; + err = 0; + goto > exit; } > > /* Event on the registration socket */ @@ -4993,8 +5035,13 @@ > static void *thread_manage_clients(void *data) > health_code_update(&health_thread_cmd); } > > +exit: error: - health_reset(&health_thread_cmd); + if (err) { + > DBG("An error occurred in %s", __func__); + > health_error(&health_thread_cmd); + } + > health_exit(&health_thread_cmd); > > DBG("Client thread dying"); unlink(client_unix_sock_path); @@ > -5740,6 +5787,7 @@ int main(int argc, char **argv) /* Init all > health thread counters. */ health_init(&health_thread_cmd); > health_init(&health_thread_kernel); + > health_init(&health_thread_app_manage); > health_init(&health_thread_app_reg); > > /* > -----BEGIN PGP SIGNATURE----- iQEbBAEBCgAGBQJQDsshAAoJEELoaioR9I025PIH+K9c/w3jrNU+Uw9ML3EpBaiP yqVPzUUVvR0Om3PnAHmAxYgtCDLTI1s7bV71RCyAX9BZvYYsGaWRtM9rOq+lit0y k9hmj0UNpLdHj9yHFhtXRiumTcnGvj0Nzp4wAF1Co0/T7v7MPWDr6IcoZsyS4Hkw XIJBe6kbT84sz4ioCl2O2lqLT/QyolZMF7fRzRqik+uIFD28ZFYsncnNaZ91V0TO Q2ZrPTfvPEyIUo89tMTY+2GE7uLHN0PXySFXadWri0fkUdT2Myw1x9aVf3fzxUPa ZKIfHH7QXj4fh2Ka6U/TUJkvtNirIdy8l6oFLt4Gew3285BFQN0kZsnIxwzZmg== =gUIY -----END PGP SIGNATURE----- From dgoulet at efficios.com Tue Jul 24 12:20:14 2012 From: dgoulet at efficios.com (David Goulet) Date: Tue, 24 Jul 2012 12:20:14 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Fix: health check and time In-Reply-To: <20120723191204.GA12711@Krystal> References: <20120723191204.GA12711@Krystal> Message-ID: <500ECB3E.80405@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Merged! Thanks Mathieu Desnoyers: > I notice that currently, the health check code does not have a > notion of "time flow": therefore, two consecutive calls to > lttng_health_check() might end up returning a bad state (0) just > because there was too little time between the invocations. > > However, the lttng.h documentation states: > > /* * Check session daemon health for a specific component. * * > Return 0 if health is OK or 1 if BAD. A returned value of -1 > indicate that * the control library was not able to connect to the > session daemon health * socket. * * Any other positive value is an > lttcomm error which can be translate with * lttng_strerror(). */ > extern int lttng_health_check(enum lttng_health_component c); > > Therefore, the user would expect that handling the time flow in > between the invocation is dealth with internally, which is what I > remember we agreed on. > > So we would need to add some time information to the "last" > snapshot, so we can do a time delta between the current and last > snapshot to figure out if we need to report the thread as stalled > or not. > > Signed-off-by: Mathieu Desnoyers > CC: David Goulet --- diff --git > a/src/bin/lttng-sessiond/health.c > b/src/bin/lttng-sessiond/health.c index d7d25cf..cbda651 100644 --- > a/src/bin/lttng-sessiond/health.c +++ > b/src/bin/lttng-sessiond/health.c @@ -20,12 +20,58 @@ #include > #include #include +#include > > > #include > > #include "health.h" > > /* + * If a thread stalls for this amount of time, it will be > considered + * bogus (bad health). + */ +#define > HEALTH_CHECK_DELTA_S 20 +#define HEALTH_CHECK_DELTA_NS 0 + +static > const struct timespec time_delta = { + .tv_sec = > HEALTH_CHECK_DELTA_S, + .tv_nsec = HEALTH_CHECK_DELTA_NS, +}; + > +static +void time_diff(const struct timespec *time_a, const struct > timespec *time_b, + struct timespec *res) +{ + if (time_a->tv_nsec > - time_b->tv_nsec < 0) { + res->tv_sec = time_a->tv_sec - > time_b->tv_sec - 1; + res->tv_nsec = 1000000000L + time_a->tv_sec > - time_b->tv_sec; + } else { + res->tv_sec = time_a->tv_sec - > time_b->tv_sec; + res->tv_nsec = time_a->tv_sec - time_b->tv_sec; > + } +} + +/* + * Return true if time_a - time_b > diff, else > false. + */ +static +int time_diff_gt(const struct timespec > *time_a, const struct timespec *time_b, + const struct timespec > *diff) +{ + struct timespec res; + + time_diff(time_a, time_b, > &res); + time_diff(&res, diff, &res); + if (res.tv_sec > 0) { + > return 1; + } + if (res.tv_sec == 0 && res.tv_nsec > 0) { + return > 1; + } + return 0; +} + +/* * Check health of a specific health > state counter. * * Return 0 if health is bad or else 1. @@ -33,28 > +79,55 @@ int health_check_state(struct health_state *state) { > unsigned long current, last; - int ret = 1; + struct timespec > current_time; + int retval = 1, ret; > > assert(state); > > last = state->last; current = uatomic_read(&state->current); + ret > = clock_gettime(CLOCK_MONOTONIC, ¤t_time); + if (ret) { + > PERROR("Error reading time\n"); + /* error */ + retval = 0; + > goto end; + } > > /* - * Here are the conditions for a bad health. Either flag - * > HEALTH_ERROR is set, or the progress counter is the same as - * > the last one and we are NOT waiting for a poll() call. + * Thread > is in are in bad health if flag HEALTH_ERROR is set. It + * is > also in bad health if, after the delta delay has passed, + * its > the progress counter has not moved and it has NOT been + * waiting > for a poll() call. */ - if ((uatomic_read(&state->flags) & > HEALTH_ERROR) - || (current == last && > !HEALTH_IS_IN_POLL(current))) { - /* error */ - ret = 0; + if > (uatomic_read(&state->flags) & HEALTH_ERROR) { + retval = 0; + > goto end; + } + + /* + * Initial condition need to update the last > counter and sample + * time, but should not check health in this > initial case, + * because we don't know how much time has passed. > + */ + if (state->last_time.tv_sec == 0 && > state->last_time.tv_nsec == 0) { + /* update last counter and last > sample time */ + state->last = current; + > memcpy(&state->last_time, ¤t_time, sizeof(current_time)); + } > else { + if (time_diff_gt(¤t_time, &state->last_time, > &time_delta)) { + if (current == last && > !HEALTH_IS_IN_POLL(current)) { + /* error */ + retval = 0; + > } + /* update last counter and last sample time */ + > state->last = current; + memcpy(&state->last_time, ¤t_time, > sizeof(current_time)); + } } > > +end: DBG("Health state current %" PRIu64 ", last %" PRIu64 ", ret > %d", current, last, ret); - - /* update last counter */ - > state->last = current; - return ret; + return retval; } diff --git > a/src/bin/lttng-sessiond/health.h > b/src/bin/lttng-sessiond/health.h index b268860..8f19fe8 100644 --- > a/src/bin/lttng-sessiond/health.h +++ > b/src/bin/lttng-sessiond/health.h @@ -20,6 +20,7 @@ > > #include #include +#include > > /* * These are the value added to the current state depending of > the position in @@ -37,10 +38,12 @@ enum health_flags { > > struct health_state { /* - * last counter is only read and updated > by the health_check - * thread (single updater). + * last counter > and last_time are only read and updated by the + * health_check > thread (single updater). */ unsigned long last; + struct timespec > last_time; + /* * current and flags are updated by multiple threads > concurrently. */ @@ -104,7 +107,9 @@ static inline void > health_error(struct health_state *state) static inline void > health_init(struct health_state *state) { assert(state); - > uatomic_set(&state->last, 0); + state->last = 0; + > state->last_time.tv_sec = 0; + state->last_time.tv_nsec = 0; > uatomic_set(&state->current, 0); uatomic_set(&state->flags, 0); } > > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQDss+AAoJEELoaioR9I02KGUH/R6EkV8c59V0VEbzvrJ+dYNv ThlZxdbxmPqT3w7PCr+1suZ1S3itQ3+R2zx+IxCMdz4rUFinypRG2Y/CmaXRkh+G aROxwB50z01cWMR94qblGzsY7j0LGUeQSOSFdDNeRqJkZCi4ROZaDszQ3XQu/iUM MLKcEQL1ER/wZdKwH3S2oTztuhlXEEG6QgdEbyclIWhzAc2WT+Nc34c3rwdCn3HZ tvtLy89PAmm7YGZby4GJZ/l5JNL9y+wNEXUXVFm5G02WkccJPQr7ZMKletSnRgqx F2GqXLJ6H9nDc8y7KvsXaSWHVB2d854rZ2gbXBvReBz8FrxWjXa42TTFPY4uByY= =57O1 -----END PGP SIGNATURE----- From dgoulet at efficios.com Tue Jul 24 13:32:12 2012 From: dgoulet at efficios.com (David Goulet) Date: Tue, 24 Jul 2012 13:32:12 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Fix: health check and time In-Reply-To: <20120723191204.GA12711@Krystal> References: <20120723191204.GA12711@Krystal> Message-ID: <500EDC1C.1030803@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 I've just notice something here during testing. Refer to the comment below. > +/* * Check health of a specific health state counter. * * Return 0 > if health is bad or else 1. @@ -33,28 +79,55 @@ int > health_check_state(struct health_state *state) { unsigned long > current, last; - int ret = 1; + struct timespec current_time; + int > retval = 1, ret; > > assert(state); > > last = state->last; current = uatomic_read(&state->current); + ret > = clock_gettime(CLOCK_MONOTONIC, ¤t_time); + if (ret) { + > PERROR("Error reading time\n"); + /* error */ + retval = 0; + > goto end; + } > > /* - * Here are the conditions for a bad health. Either flag - * > HEALTH_ERROR is set, or the progress counter is the same as - * > the last one and we are NOT waiting for a poll() call. + * Thread > is in are in bad health if flag HEALTH_ERROR is set. It + * is > also in bad health if, after the delta delay has passed, + * its > the progress counter has not moved and it has NOT been + * waiting > for a poll() call. */ - if ((uatomic_read(&state->flags) & > HEALTH_ERROR) - || (current == last && > !HEALTH_IS_IN_POLL(current))) { - /* error */ - ret = 0; + if > (uatomic_read(&state->flags) & HEALTH_ERROR) { + retval = 0; + > goto end; + } + + /* + * Initial condition need to update the last > counter and sample + * time, but should not check health in this > initial case, + * because we don't know how much time has passed. > + */ + if (state->last_time.tv_sec == 0 && > state->last_time.tv_nsec == 0) { + /* update last counter and last > sample time */ + state->last = current; + > memcpy(&state->last_time, ¤t_time, sizeof(current_time)); + } > else { + if (time_diff_gt(¤t_time, &state->last_time, > &time_delta)) { + if (current == last && > !HEALTH_IS_IN_POLL(current)) { + /* error */ + retval = 0; I think this should "goto end" and NOT followed by an update to the last counter and time since this makes two health_check return respectively BAD and OK. Considering two health check made by let say two applications or/and users, the second one will indicate a good health which is not true. Cheers! David > + } + /* update last counter and last sample time */ + > state->last = current; + memcpy(&state->last_time, ¤t_time, > sizeof(current_time)); + } } > > +end: DBG("Health state current %" PRIu64 ", last %" PRIu64 ", ret > %d", current, last, ret); - - /* update last counter */ - > state->last = current; - return ret; + return retval; } diff --git > a/src/bin/lttng-sessiond/health.h > b/src/bin/lttng-sessiond/health.h index b268860..8f19fe8 100644 --- > a/src/bin/lttng-sessiond/health.h +++ > b/src/bin/lttng-sessiond/health.h @@ -20,6 +20,7 @@ > > #include #include +#include > > /* * These are the value added to the current state depending of > the position in @@ -37,10 +38,12 @@ enum health_flags { > > struct health_state { /* - * last counter is only read and updated > by the health_check - * thread (single updater). + * last counter > and last_time are only read and updated by the + * health_check > thread (single updater). */ unsigned long last; + struct timespec > last_time; + /* * current and flags are updated by multiple threads > concurrently. */ @@ -104,7 +107,9 @@ static inline void > health_error(struct health_state *state) static inline void > health_init(struct health_state *state) { assert(state); - > uatomic_set(&state->last, 0); + state->last = 0; + > state->last_time.tv_sec = 0; + state->last_time.tv_nsec = 0; > uatomic_set(&state->current, 0); uatomic_set(&state->flags, 0); } > > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQDtwXAAoJEELoaioR9I02lDAIAIbNRBj+dB2/mn1RSM22j6hI fnXckqmHkmdKqsw4UZUHGjrhFqlluwBggXjgQG9KEqZXdCrmv0x5+zam4cqMfHuU Cu0d8qiqgjnYFtxvftI7FWR7lxOZu3r8r4OtNi27XcyAmKh76+eZc/izLOa8bUOh keDnY0HYvxL5J4TBECrFdH+GzpMCtwE1zoc0uzp4YaQcXg+83We+KfPg8kCKJK/f epxVRjsQzz44j1Rr+OcgTfGubAAxT6Tf+ziNu8U7GxFSwciJizVapqbGnj1V6SGs BRj53xvqrW+DtIROWb/PIDKfddfkjhtWyou1CbkLHUxMEOEKTVnpFuIWSHQEoZk= =roW8 -----END PGP SIGNATURE----- From mathieu.desnoyers at efficios.com Tue Jul 24 14:16:29 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 24 Jul 2012 14:16:29 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Fix: health check and time In-Reply-To: <500EDC1C.1030803@efficios.com> References: <20120723191204.GA12711@Krystal> <500EDC1C.1030803@efficios.com> Message-ID: <20120724181629.GA2285@Krystal> * David Goulet (dgoulet at efficios.com) wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > I've just notice something here during testing. > > Refer to the comment below. > [...] > I think this should "goto end" and NOT followed by an update to the > last counter and time since this makes two health_check return > respectively BAD and OK. > > Considering two health check made by let say two applications or/and > users, the second one will indicate a good health which is not true. > > Cheers! > David How about the following fix ? Fix: set health to bad state for good when error state detected Signed-off-by: Mathieu Desnoyers --- diff --git a/src/bin/lttng-sessiond/health.c b/src/bin/lttng-sessiond/health.c index 7bf41c8..3637225 100644 --- a/src/bin/lttng-sessiond/health.c +++ b/src/bin/lttng-sessiond/health.c @@ -114,6 +114,7 @@ int health_check_state(struct health_state *state) if (time_diff_gt(¤t_time, &state->last_time, &time_delta)) { if (current == last && !HEALTH_IS_IN_POLL(current)) { /* error */ + uatomic_or(&state->flags, HEALTH_ERROR); retval = 0; } /* update last counter and last sample time */ -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Tue Jul 24 14:19:22 2012 From: dgoulet at efficios.com (David Goulet) Date: Tue, 24 Jul 2012 14:19:22 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Fix: health check and time In-Reply-To: <20120724181629.GA2285@Krystal> References: <20120723191204.GA12711@Krystal> <500EDC1C.1030803@efficios.com> <20120724181629.GA2285@Krystal> Message-ID: <500EE72A.8050907@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Makes sense to me. I'll push that! Thanks! David Mathieu Desnoyers: > * David Goulet (dgoulet at efficios.com) wrote: >> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 >> >> I've just notice something here during testing. >> >> Refer to the comment below. >> > [...] >> I think this should "goto end" and NOT followed by an update to >> the last counter and time since this makes two health_check >> return respectively BAD and OK. >> >> Considering two health check made by let say two applications >> or/and users, the second one will indicate a good health which is >> not true. >> >> Cheers! David > > How about the following fix ? > > Fix: set health to bad state for good when error state detected > > Signed-off-by: Mathieu Desnoyers > --- diff --git a/src/bin/lttng-sessiond/health.c > b/src/bin/lttng-sessiond/health.c index 7bf41c8..3637225 100644 --- > a/src/bin/lttng-sessiond/health.c +++ > b/src/bin/lttng-sessiond/health.c @@ -114,6 +114,7 @@ int > health_check_state(struct health_state *state) if > (time_diff_gt(¤t_time, &state->last_time, &time_delta)) { if > (current == last && !HEALTH_IS_IN_POLL(current)) { /* error */ + > uatomic_or(&state->flags, HEALTH_ERROR); retval = 0; } /* update > last counter and last sample time */ > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQDucnAAoJEELoaioR9I027TMIAKzW18p6B8q/ZvJzzjsQ6Je3 sspGevoHwxMydjuoVA8fuVHp/+IwN1g4SFGfROXHdNP8736PFYopjKDSI1L4gFFA au2jGgYVoMWvbQoyqVnlaLayE+g9EvlQQPkNdDYVSFQEeqOpfCICvhGBboZYRuwa bFPyId6mgJQtMEAdut2dh8J79qUzw0pqsKTXs7hSZsaXjGowU6GvrL7QGe/mtQlL jhWlLd4KrwxHaTpCutfdjQJEe1bpyaniBMKT84k3eWPYX4aguoMtJ7QgYw5db5iL dKy+Elpd4vRkVnr9R9ZL+jIWzlYi3EJ6gb0zfYBijwfecxEzQ9Jq6top04Uubok= =21s5 -----END PGP SIGNATURE----- From zheng.chang at emc.com Wed Jul 25 05:38:59 2012 From: zheng.chang at emc.com (changz) Date: Wed, 25 Jul 2012 17:38:59 +0800 Subject: [lttng-dev] Question about the performance of LTTng-UST Message-ID: <500FBEB3.8070106@emc.com> Hi All, I wrote a very simple test code like this: for (i = 0; i < 0xffffff; i++) { tracepoint(sample_component, message, "This is a performance test:","main",i); } And then I started lttng and ran the test code: time ./test real0m16.120s user0m8.280s sys0m7.789s From the result of time output, you can see sys time is about half of the whole run-time. I wondered where the cost was from. So I used strace to track it and found amount of system calls (get_cpu and clock_gettime) during the run-time. I know these system calls are used for ring-buffer. But I just think the cost is a little heavy. What do you think? BR Zheng -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu.desnoyers at efficios.com Wed Jul 25 09:29:37 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Wed, 25 Jul 2012 09:29:37 -0400 Subject: [lttng-dev] Question about the performance of LTTng-UST In-Reply-To: <500FBEB3.8070106@emc.com> References: <500FBEB3.8070106@emc.com> Message-ID: <20120725132937.GA14530@Krystal> * changz (zheng.chang at emc.com) wrote: > Hi All, > > I wrote a very simple test code like this: > > for (i = 0; i < 0xffffff; i++) { > tracepoint(sample_component, message, "This is a > performance test:","main",i); > } > > And then I started lttng and ran the test code: > time ./test > real0m16.120s This is indeed very high (96 microsecond per event). There is something wrong with your system (what architecture, kernel version do you use ? Getting you dmesg log would be useful too, especially to find out which clock source your kernel uses. Also, are you in a virtualized environment ? If yes, which ?) > user0m8.280s > sys0m7.789s > > From the result of time output, you can see sys time is about half of > the whole run-time. I wondered where the cost was from. > So I used strace to track it and found amount of system calls (get_cpu > and clock_gettime) during the run-time. > I know these system calls are used for ring-buffer. But I just think the > cost is a little heavy. > > What do you think? On x86, these calls are done through a kernel vDSO. Having those showing up in strace tells me that you kernel might be quite old, or use use an architecture that implements those as standard system calls rather than vDSO. Thanks, Mathieu > > BR > Zheng > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Wed Jul 25 11:33:44 2012 From: dgoulet at efficios.com (David Goulet) Date: Wed, 25 Jul 2012 11:33:44 -0400 Subject: [lttng-dev] [RELEASE] LTTng-tools 2.0.4 Message-ID: <501011D8.2090504@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Greetings everyone, The lttng-tools project provides a session daemon (lttng-sessiond) that acts as a tracing registry, the "lttng" command line for tracing control and the liblttng-ctl library also for tracing control. This release fixes an important bug in the UST and Kernel mmap() buffer extraction mechanism. 2012-07-25 lttng-tools 2.0.4 * Fix: support large files on 32-bit systems * Fix: mmap write() for large subbuffers and handle EINTR (v2) * Fix: The session list count should provide unique identifiers * Fix: test: session list count cannot use "count" unique id * Fix typo: utils.sh Project website: http://lttng.org/lttng2.0 Download link: http://lttng.org/files/lttng-tools/lttng-tools-2.0.4.tar.bz2 Cheers! David -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQEBHYAAoJEELoaioR9I02gU4H/iMT0H+wlNhYyK26HTWmsiXF snR6nKdp+8fp/QHQ4tjY1fQPZZ29pFVuPNASryo1sclMH/1WzSN2iSJGrqQZ3XiP PKzWg5GNo9S6nnJRVG7feKNM+iHR7qIWwuuufaARXXOudlkh0JdsTa3gK5dX9kOI WKpdV0Q/Mln3VEf3falYcVkebHRrAbSL6xKVkQ7T7k0gU6KN1/42ud5jL8Zbwdvw nJIadnpRax+B4YEVzjY/OMCMTKxYo5VfHdGCxccRUL6i7LqDQXdyqYt3+MDM6fWL qablHcl360xYbIkD3uE9ucyG9IRqQhiPT+X1+xPujB9RH9PlJ1eeSBeUbxzX6VQ= =W6gL -----END PGP SIGNATURE----- From zheng.chang at emc.com Thu Jul 26 00:54:27 2012 From: zheng.chang at emc.com (changz) Date: Thu, 26 Jul 2012 12:54:27 +0800 Subject: [lttng-dev] Question about the performance of LTTng-UST In-Reply-To: <20120725132937.GA14530@Krystal> References: <500FBEB3.8070106@emc.com> <20120725132937.GA14530@Krystal> Message-ID: <5010CD83.9050501@emc.com> On 7/25/2012 21:29 PM, Mathieu Desnoyers wrote: > * changz (zheng.chang at emc.com) wrote: >> Hi All, >> >> I wrote a very simple test code like this: >> >> for (i = 0; i < 0xffffff; i++) { >> tracepoint(sample_component, message, "This is a >> performance test:","main",i); >> } >> >> And then I started lttng and ran the test code: >> time ./test >> real0m16.120s > This is indeed very high (96 microsecond per event). There is something > wrong with your system (what architecture, kernel version do you use ? > Getting you dmesg log would be useful too, especially to find out which > clock source your kernel uses. Also, are you in a virtualized > environment ? If yes, which ?) Mathieu, My OS is a X86 linux kernel 2.6.38 running on Vmware workstation for windows. linux-gate.so was linked to my test code. And here is a message found in dmesg output: [2.228750] Switching to clocksource tsc I found a benchmark data about vmware system call. It says the virtualization can cause ten times delay than it runs on host directly. So I guess that's the reason why my test code ran slowly. Could you provide more info about the impact introduced by different clock sources? Thanks Zheng >> user0m8.280s >> sys0m7.789s >> >> From the result of time output, you can see sys time is about half of >> the whole run-time. I wondered where the cost was from. >> So I used strace to track it and found amount of system calls (get_cpu >> and clock_gettime) during the run-time. >> I know these system calls are used for ring-buffer. But I just think the >> cost is a little heavy. >> >> What do you think? > On x86, these calls are done through a kernel vDSO. Having those showing > up in strace tells me that you kernel might be quite old, or use use an > architecture that implements those as standard system calls rather than > vDSO. > > Thanks, > > Mathieu > >> BR >> Zheng >> _______________________________________________ >> lttng-dev mailing list >> lttng-dev at lists.lttng.org >> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > From zheng.chang at emc.com Thu Jul 26 04:28:24 2012 From: zheng.chang at emc.com (changz) Date: Thu, 26 Jul 2012 16:28:24 +0800 Subject: [lttng-dev] Question about lttng daemons Message-ID: <5010FFA8.9000706@emc.com> Hi all, Is that possible to launch lttng daemons as a system service? i.e. we can start/stop/restart it like the services under /etc/init.d. Another concern is if here is a way to recover or continue the dataflow once the daemons get crashed. I hope some vital trace info can be still kept even if daemon crashes. BR zheng From alexmonthy at voxpopuli.im Thu Jul 26 10:41:18 2012 From: alexmonthy at voxpopuli.im (Alexandre Montplaisir) Date: Thu, 26 Jul 2012 10:41:18 -0400 Subject: [lttng-dev] Question about lttng daemons In-Reply-To: <5010FFA8.9000706@emc.com> References: <5010FFA8.9000706@emc.com> Message-ID: <5011570E.3060200@voxpopuli.im> Hi, I can answer your first question ;) On 12-07-26 04:28 AM, changz wrote: > Hi all, > > Is that possible to launch lttng daemons as a system service? i.e. we > can start/stop/restart it like the services under /etc/init.d. Absolutely. Note that you only need to auto-start the lttng-sessiond. The consumerd daemons get started automatically by the sessiond when trace sessions are created. This is a nice way to start a root session daemon at boot time, which then allows users in the "tracing" group to use the kernel tracer without being root themselves. We don't ship an example in the source tree, since this is usually distro-specific, but for reference you can look at the Upstart script that is available in the Ubuntu package: http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/quantal/lttng-tools/quantal/view/head:/debian/lttng-tools.lttng-sessiond.upstart Alex > Another concern is if here is a way to recover or continue the > dataflow once the daemons get crashed. > I hope some vital trace info can be still kept even if daemon crashes. > > BR > zheng > > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev From dgoulet at efficios.com Thu Jul 26 10:54:55 2012 From: dgoulet at efficios.com (David Goulet) Date: Thu, 26 Jul 2012 10:54:55 -0400 Subject: [lttng-dev] Question about lttng daemons In-Reply-To: <5011570E.3060200@voxpopuli.im> References: <5010FFA8.9000706@emc.com> <5011570E.3060200@voxpopuli.im> Message-ID: <50115A3F.5010402@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hi guys, Alexandre Montplaisir: > Hi, > > I can answer your first question ;) > > > On 12-07-26 04:28 AM, changz wrote: >> Hi all, >> >> Is that possible to launch lttng daemons as a system service? >> i.e. we can start/stop/restart it like the services under >> /etc/init.d. > > Absolutely. Note that you only need to auto-start the > lttng-sessiond. The consumerd daemons get started automatically by > the sessiond when trace sessions are created. This is a nice way to > start a root session daemon at boot time, which then allows users > in the "tracing" group to use the kernel tracer without being root > themselves. > > We don't ship an example in the source tree, since this is usually > distro-specific, but for reference you can look at the Upstart > script that is available in the Ubuntu package: > http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/quantal/lttng-tools/quantal/view/head:/debian/lttng-tools.lttng-sessiond.upstart > > We could maybe provide this upstart script in extras/ ? > > Alex > >> Another concern is if here is a way to recover or continue the >> dataflow once the daemons get crashed. I hope some vital trace >> info can be still kept even if daemon crashes. Right now we *don't* have this kind of feature. We are hoping someday that we'll be able to dump the state or configuration of tracing session onto disk that can be later on loaded by another daemon for instance. However, we do offer (upstream master not yet released) a health check API call which return the health status of the session daemon (lttng-sessiond). So for now, you can at least monitor the daemon but still no mechanism to save tracing session info. Please note that if the daemon crashes, the tracers are NOT impacted meaning that user space applications don't crash, they will simply continue their way without tracing and the kernel tracing will also stop. Cheers! David >> >> BR zheng >> >> >> >> _______________________________________________ lttng-dev mailing >> list lttng-dev at lists.lttng.org >> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > > _______________________________________________ lttng-dev mailing > list lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQEVo8AAoJEELoaioR9I029xgIAMnnjcKFJHjTXpTECXIWToHr 8YcksDEowDiIrqzIJiDIWisxgCs285QuLaA+NMYb7zlyQ9MLSq9JcmFNfNW5s0aG MmCSDpq50gg+g7OZH7wKMrEl+te3g8Cu3ZEOktHG8R+LCEExiawVockuYFHBmfL9 rXOa3imt4rUn2LW8428JvSwbkQxS6kknR12GH594YOqPxrGxTBvSlTukBCECPREj Ng2s1DMCcGHav1vXo1+W1rftv+n85C9Uih369ay+J8dISU5almSJxbH9E/QWhF0u 2ghSkoit2+09Vr6xMGKUcEuAZkJ+Vu/BZB4SybwVZay8df3GZ1Fkfe1IsW3/Mnk= =OeB0 -----END PGP SIGNATURE----- From yannick.brosseau at gmail.com Thu Jul 26 10:59:32 2012 From: yannick.brosseau at gmail.com (Yannick Brosseau) Date: Thu, 26 Jul 2012 10:59:32 -0400 Subject: [lttng-dev] Question about lttng daemons In-Reply-To: <50115A3F.5010402@efficios.com> References: <5010FFA8.9000706@emc.com> <5011570E.3060200@voxpopuli.im> <50115A3F.5010402@efficios.com> Message-ID: <50115B54.60909@gmail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > > > We don't ship an example in the source tree, since this is usually > > distro-specific, but for reference you can look at the Upstart > > script that is available in the Ubuntu package: > > http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/quantal/lttng-tools/quantal/view/head:/debian/lttng-tools.lttng-sessiond.upstart > > > We could maybe provide this upstart script in extras/ ? Yes, probably, with also the systemd script and the old style initscript. (I've made both) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlARW0sACgkQFQrZ7GzHX2qV4gCg50X4koCVPUft///BIdFy0wBi gmEAn1c0JN9Rv4BFecT75Kp1DaXUYLAw =EH/p -----END PGP SIGNATURE----- From dgoulet at efficios.com Thu Jul 26 11:02:01 2012 From: dgoulet at efficios.com (David Goulet) Date: Thu, 26 Jul 2012 11:02:01 -0400 Subject: [lttng-dev] Question about lttng daemons In-Reply-To: <50115B54.60909@gmail.com> References: <5010FFA8.9000706@emc.com> <5011570E.3060200@voxpopuli.im> <50115A3F.5010402@efficios.com> <50115B54.60909@gmail.com> Message-ID: <50115BE9.6000106@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Yannick Brosseau: > > > >>> We don't ship an example in the source tree, since this is >>> usually distro-specific, but for reference you can look at the >>> Upstart script that is available in the Ubuntu package: >>> > http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/quantal/lttng-tools/quantal/view/head:/debian/lttng-tools.lttng-sessiond.upstart > > > >> We could maybe provide this upstart script in extras/ ? > > Yes, probably, with also the systemd script and the old style > initscript. (I've made both) Great! Send me that as a patch or pull request, I'll be glad to merge that! David > > > _______________________________________________ lttng-dev mailing > list lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQEVvpAAoJEELoaioR9I028VsIALVpAuI7hzHHrNjNHTLdGJBy eTg+tTN2EpWRg+nBAYTWBHfrY+ZYmzdvl2gaXNDTzJm7nMTKEzdYbgIAkYH5FwM6 2Mi4eg8oKC96wnEisEW+328aI17FIevclapHv7Ky816g6YFSnJ/L5Rbu/VRoJFoU QMY+cINDt9Sbx0y4heLRYED9pEFBu2PMfmf3RVXh76A/J0vcbWB8u9Pmi9GCloEI dKGURUbXhLVb9WxoJI2zosmYyJWwe6b2o+xA98wvFx+MYpVOGC4t3aOWb1Zra0dL rddQPo+XuM2ldDVn89Qt45c2KXouTk+1W0CjTm5ffpZMPoioGkvob5cC3aDcFFk= =NuDF -----END PGP SIGNATURE----- From danny.serres at efficios.com Thu Jul 26 14:09:27 2012 From: danny.serres at efficios.com (Danny Serres) Date: Thu, 26 Jul 2012 14:09:27 -0400 Subject: [lttng-dev] [lttng-tools PATCH] lttng-tools python module Message-ID: <1343326167-11522-1-git-send-email-danny.serres@efficios.com> The lttng-tools Python module can be used to directly control the lttng-tools API inside Python, using 'import lttng'. Therefore, it becomes possible to create a trace, add events, start/stop tracing, destroy a session and so on from within Python. The module does not include URI-related functions. SWIG >= 2.0 is used to create the wrapper and its 'warning md variable unused' bug is patched in Makefile.am. In the interface file, struct and enum are directly copied from lttng.h (all changes must be made in both files). Signed-off-by: Danny Serres Signed-off-by: Yannick Brosseau --- config/ax_pkg_swig.m4 | 135 ++++++ configure.ac | 43 ++ src/Makefile.am | 4 + src/python/Makefile.am | 25 ++ src/python/lttng.i.in | 1023 +++++++++++++++++++++++++++++++++++++++++++ src/python/tests/example.py | 109 +++++ src/python/tests/run.sh | 1 + src/python/tests/tests.py | 310 +++++++++++++ 8 files changed, 1650 insertions(+) create mode 100644 config/ax_pkg_swig.m4 create mode 100644 src/python/Makefile.am create mode 100644 src/python/lttng.i.in create mode 100644 src/python/tests/example.py create mode 100644 src/python/tests/run.sh create mode 100644 src/python/tests/tests.py diff --git a/config/ax_pkg_swig.m4 b/config/ax_pkg_swig.m4 new file mode 100644 index 0000000..e112f3d --- /dev/null +++ b/config/ax_pkg_swig.m4 @@ -0,0 +1,135 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_pkg_swig.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PKG_SWIG([major.minor.micro], [action-if-found], [action-if-not-found]) +# +# DESCRIPTION +# +# This macro searches for a SWIG installation on your system. If found, +# then SWIG is AC_SUBST'd; if not found, then $SWIG is empty. If SWIG is +# found, then SWIG_LIB is set to the SWIG library path, and AC_SUBST'd. +# +# You can use the optional first argument to check if the version of the +# available SWIG is greater than or equal to the value of the argument. It +# should have the format: N[.N[.N]] (N is a number between 0 and 999. Only +# the first N is mandatory.) If the version argument is given (e.g. +# 1.3.17), AX_PKG_SWIG checks that the swig package is this version number +# or higher. +# +# As usual, action-if-found is executed if SWIG is found, otherwise +# action-if-not-found is executed. +# +# In configure.in, use as: +# +# AX_PKG_SWIG(1.3.17, [], [ AC_MSG_ERROR([SWIG is required to build..]) ]) +# AX_SWIG_ENABLE_CXX +# AX_SWIG_MULTI_MODULE_SUPPORT +# AX_SWIG_PYTHON +# +# LICENSE +# +# Copyright (c) 2008 Sebastian Huber +# Copyright (c) 2008 Alan W. Irwin +# Copyright (c) 2008 Rafael Laboissiere +# Copyright (c) 2008 Andrew Collier +# Copyright (c) 2011 Murray Cumming +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 8 + +AC_DEFUN([AX_PKG_SWIG],[ + # Ubuntu has swig 2.0 as /usr/bin/swig2.0 + AC_PATH_PROGS([SWIG],[swig swig2.0]) + if test -z "$SWIG" ; then + m4_ifval([$3],[$3],[:]) + elif test -n "$1" ; then + AC_MSG_CHECKING([SWIG version]) + [swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`] + AC_MSG_RESULT([$swig_version]) + if test -n "$swig_version" ; then + # Calculate the required version number components + [required=$1] + [required_major=`echo $required | sed 's/[^0-9].*//'`] + if test -z "$required_major" ; then + [required_major=0] + fi + [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] + [required_minor=`echo $required | sed 's/[^0-9].*//'`] + if test -z "$required_minor" ; then + [required_minor=0] + fi + [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] + [required_patch=`echo $required | sed 's/[^0-9].*//'`] + if test -z "$required_patch" ; then + [required_patch=0] + fi + # Calculate the available version number components + [available=$swig_version] + [available_major=`echo $available | sed 's/[^0-9].*//'`] + if test -z "$available_major" ; then + [available_major=0] + fi + [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] + [available_minor=`echo $available | sed 's/[^0-9].*//'`] + if test -z "$available_minor" ; then + [available_minor=0] + fi + [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] + [available_patch=`echo $available | sed 's/[^0-9].*//'`] + if test -z "$available_patch" ; then + [available_patch=0] + fi + # Convert the version tuple into a single number for easier comparison. + # Using base 100 should be safe since SWIG internally uses BCD values + # to encode its version number. + required_swig_vernum=`expr $required_major \* 10000 \ + \+ $required_minor \* 100 \+ $required_patch` + available_swig_vernum=`expr $available_major \* 10000 \ + \+ $available_minor \* 100 \+ $available_patch` + + if test $available_swig_vernum -lt $required_swig_vernum; then + AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version.]) + SWIG='' + m4_ifval([$3],[$3],[]) + else + AC_MSG_CHECKING([for SWIG library]) + SWIG_LIB=`$SWIG -swiglib` + AC_MSG_RESULT([$SWIG_LIB]) + m4_ifval([$2],[$2],[]) + fi + else + AC_MSG_WARN([cannot determine SWIG version]) + SWIG='' + m4_ifval([$3],[$3],[]) + fi + fi + AC_SUBST([SWIG_LIB]) +]) diff --git a/configure.ac b/configure.ac index 17e6b67..97167de 100644 --- a/configure.ac +++ b/configure.ac @@ -154,6 +154,40 @@ AC_CHECK_LIB([c], [open_memstream], ] ) +# For Python +# SWIG version needed or newer: +swig_version=2.0.0 + +AC_ARG_ENABLE([python], + [AC_HELP_STRING([--disable-python], + [do not compile Python bindings])], + [], [enable_python=yes]) + +AM_CONDITIONAL([USE_PYTHON], [test "x${enable_python:-yes}" = xyes]) + +if test "x${enable_python:-yes}" = xyes; then + AC_MSG_NOTICE([You may configure with --disable-python ]dnl +[if you do not need Python bindings.]) + + AX_PKG_SWIG($swig_version, [], [ AC_MSG_ERROR([SWIG $swig_version or newer is needed]) ]) + AM_PATH_PYTHON + + AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for python, bypassing python-config]) + AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config]) + AS_IF([test -z "$PYTHON_INCLUDE"], [ + AS_IF([test -z "$PYTHON_CONFIG"], [ + AC_PATH_PROGS([PYTHON_CONFIG], + [python$PYTHON_VERSION-config python-config], + [no], + [`dirname $PYTHON`]) + AS_IF([test "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find python-config for $PYTHON.])]) + ]) + AC_MSG_CHECKING([python include flags]) + PYTHON_INCLUDE=`$PYTHON_CONFIG --includes` + AC_MSG_RESULT([$PYTHON_INCLUDE]) + ]) +fi + # Option to only build the consumer daemon and its libraries AC_ARG_WITH([consumerd-only], AS_HELP_STRING([--with-consumerd-only],[Only build the consumer daemon [default=no]]), @@ -214,6 +248,7 @@ AC_CONFIG_FILES([ src/bin/lttng-sessiond/Makefile src/bin/lttng-relayd/Makefile src/bin/lttng/Makefile + src/python/Makefile tests/Makefile tests/kernel/Makefile tests/tools/Makefile @@ -260,6 +295,14 @@ AS_IF([test "x$lttng_ust_support" = "xyes"],[ AS_ECHO("Disabled") ]) +#Python binding enabled/disabled +AS_ECHO_N("Python binding: ") +AS_IF([test "x${enable_python:-yes}" = xyes], [ + AS_ECHO("Enabled") +],[ + AS_ECHO("Disabled") +]) + # Do we build only the consumerd, or everything AS_IF([test "x$consumerd_only" = "xyes"],[ AS_ECHO("Only the consumerd daemon will be built.") diff --git a/src/Makefile.am b/src/Makefile.am index 103337c..a65a5c1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1 +1,5 @@ SUBDIRS = common lib bin + +if USE_PYTHON +SUBDIRS += python +endif diff --git a/src/python/Makefile.am b/src/python/Makefile.am new file mode 100644 index 0000000..b67d550 --- /dev/null +++ b/src/python/Makefile.am @@ -0,0 +1,25 @@ +lttng.i: lttng.i.in + sed "s/LTTNG_VERSION_STR/LTTng $(PACKAGE_VERSION)/g" lttng.i + +AM_CFLAGS = -I$(PYTHONINC) -I../lib/lttng-ctl -I../common \ + $(BUDDY_CFLAGS) + +EXTRA_DIST = lttng.i +python_PYTHON = lttng.py +pyexec_LTLIBRARIES = _lttng.la + +MAINTAINERCLEANFILES = lttng_wrap.c lttng.py + +_lttng_la_SOURCES = lttng_wrap.c + +_lttng_la_LDFLAGS = -module + +_lttng_la_LIBADD = ../lib/lttng-ctl/liblttng-ctl.la \ + ../common/sessiond-comm/libsessiond-comm.la + +lttng_wrap.c: lttng.i + $(SWIG) -python -I. -I$(top_srcdir)/src/common/sessiond-comm lttng.i + sed -i "s/Python.h/python$(PYTHON_VERSION)\/Python.h/g" lttng_wrap.c + sed -i "s/PyObject \*m, \*d, \*md;/PyObject \*m, \*d;\n#if defined(SWIGPYTHON_BUILTIN)\nPyObject *md;\n#endif/g" lttng_wrap.c + sed -i "s/md = d/d/g" lttng_wrap.c + sed -i "s/(void)public_symbol;/(void)public_symbol;\n md = d;/g" lttng_wrap.c diff --git a/src/python/lttng.i.in b/src/python/lttng.i.in new file mode 100644 index 0000000..4f3cfeb --- /dev/null +++ b/src/python/lttng.i.in @@ -0,0 +1,1023 @@ +%define DOCSTRING +"LTTNG_VERSION_STR + +The LTTng project aims at providing highly efficient tracing tools for Linux. +It's tracers help tracking down performance issues and debugging problems involving +multiple concurrent processes and threads. Tracing across multiple systems is also possible." +%enddef + +%module(docstring=DOCSTRING) lttng + +%include "typemaps.i" +%include "pyabc.i" +%{ +#define SWIG_FILE_WITH_INIT +#include +%} + +typedef unsigned int uint32_t; +typedef int int32_t; +typedef unsigned long long uint64_t; +typedef long pid_t; + + +// ============================================= +// ENUMS +// ============================================= + +%rename("DOMAIN_KERNEL") LTTNG_DOMAIN_KERNEL; +%rename("DOMAIN_UST") LTTNG_DOMAIN_UST; +enum lttng_domain_type { + LTTNG_DOMAIN_KERNEL = 1, + LTTNG_DOMAIN_UST = 2, +}; + +%rename("EVENT_ALL") LTTNG_EVENT_ALL; +%rename("EVENT_TRACEPOINT") LTTNG_EVENT_TRACEPOINT; +%rename("EVENT_PROBE") LTTNG_EVENT_PROBE; +%rename("EVENT_FUNCTION")LTTNG_EVENT_FUNCTION; +%rename("EVENT_FUNCTION_ENTRY") LTTNG_EVENT_FUNCTION_ENTRY; +%rename("EVENT_NOOP") LTTNG_EVENT_NOOP; +%rename("EVENT_SYSCALL") LTTNG_EVENT_SYSCALL; +enum lttng_event_type { + 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, +}; + +%rename("EVENT_LOGLEVEL_ALL") LTTNG_EVENT_LOGLEVEL_ALL; +%rename("EVENT_LOGLEVEL_RANGE") LTTNG_EVENT_LOGLEVEL_RANGE; +%rename("EVENT_LOGLEVEL_SINGLE") LTTNG_EVENT_LOGLEVEL_SINGLE; +enum lttng_loglevel_type { + LTTNG_EVENT_LOGLEVEL_ALL = 0, + LTTNG_EVENT_LOGLEVEL_RANGE = 1, + LTTNG_EVENT_LOGLEVEL_SINGLE = 2, +}; + +%rename("LOGLEVEL_EMERG") LTTNG_LOGLEVEL_EMERG; +%rename("LOGLEVEL_ALERT") LTTNG_LOGLEVEL_ALERT; +%rename("LOGLEVEL_CRIT") LTTNG_LOGLEVEL_CRIT; +%rename("LOGLEVEL_ERR") LTTNG_LOGLEVEL_ERR; +%rename("LOGLEVEL_WARNING") LTTNG_LOGLEVEL_WARNING; +%rename("LOGLEVEL_NOTICE") LTTNG_LOGLEVEL_NOTICE; +%rename("LOGLEVEL_INFO") LTTNG_LOGLEVEL_INFO; +%rename("LOGLEVEL_DEBUG_SYSTEM") LTTNG_LOGLEVEL_DEBUG_SYSTEM; +%rename("LOGLEVEL_DEBUG_PROGRAM") LTTNG_LOGLEVEL_DEBUG_PROGRAM; +%rename("LOGLEVEL_DEBUG_PROCESS") LTTNG_LOGLEVEL_DEBUG_PROCESS; +%rename("LOGLEVEL_DEBUG_MODULE") LTTNG_LOGLEVEL_DEBUG_MODULE; +%rename("LOGLEVEL_DEBUG_UNIT") LTTNG_LOGLEVEL_DEBUG_UNIT; +%rename("LOGLEVEL_DEBUG_FUNCTION") LTTNG_LOGLEVEL_DEBUG_FUNCTION; +%rename("LOGLEVEL_DEBUG_LINE") LTTNG_LOGLEVEL_DEBUG_LINE; +%rename("LOGLEVEL_DEBUG") LTTNG_LOGLEVEL_DEBUG; +enum lttng_loglevel { + LTTNG_LOGLEVEL_EMERG = 0, + LTTNG_LOGLEVEL_ALERT = 1, + LTTNG_LOGLEVEL_CRIT = 2, + LTTNG_LOGLEVEL_ERR = 3, + LTTNG_LOGLEVEL_WARNING = 4, + LTTNG_LOGLEVEL_NOTICE = 5, + LTTNG_LOGLEVEL_INFO = 6, + LTTNG_LOGLEVEL_DEBUG_SYSTEM = 7, + LTTNG_LOGLEVEL_DEBUG_PROGRAM = 8, + LTTNG_LOGLEVEL_DEBUG_PROCESS = 9, + LTTNG_LOGLEVEL_DEBUG_MODULE = 10, + LTTNG_LOGLEVEL_DEBUG_UNIT = 11, + LTTNG_LOGLEVEL_DEBUG_FUNCTION = 12, + LTTNG_LOGLEVEL_DEBUG_LINE = 13, + LTTNG_LOGLEVEL_DEBUG = 14, +}; + +%rename("EVENT_SPLICE") LTTNG_EVENT_SPLICE; +%rename("EVENT_MMAP") LTTNG_EVENT_MMAP; +enum lttng_event_output { + LTTNG_EVENT_SPLICE = 0, + LTTNG_EVENT_MMAP = 1, +}; + +%rename("EVENT_CONTEXT_PID") LTTNG_EVENT_CONTEXT_PID; +%rename("EVENT_CONTEXT_PERF_COUNTER") LTTNG_EVENT_CONTEXT_PERF_COUNTER; +%rename("EVENT_CONTEXT_PROCNAME") LTTNG_EVENT_CONTEXT_PROCNAME; +%rename("EVENT_CONTEXT_PRIO") LTTNG_EVENT_CONTEXT_PRIO; +%rename("EVENT_CONTEXT_NICE") LTTNG_EVENT_CONTEXT_NICE; +%rename("EVENT_CONTEXT_VPID") LTTNG_EVENT_CONTEXT_VPID; +%rename("EVENT_CONTEXT_TID") LTTNG_EVENT_CONTEXT_TID; +%rename("EVENT_CONTEXT_VTID") LTTNG_EVENT_CONTEXT_VTID; +%rename("EVENT_CONTEXT_PPID") LTTNG_EVENT_CONTEXT_PPID; +%rename("EVENT_CONTEXT_VPPID") LTTNG_EVENT_CONTEXT_VPPID; +%rename("EVENT_CONTEXT_PTHREAD_ID") LTTNG_EVENT_CONTEXT_PTHREAD_ID; +enum lttng_event_context_type { + LTTNG_EVENT_CONTEXT_PID = 0, + LTTNG_EVENT_CONTEXT_PERF_COUNTER = 1, + LTTNG_EVENT_CONTEXT_PROCNAME = 2, + LTTNG_EVENT_CONTEXT_PRIO = 3, + LTTNG_EVENT_CONTEXT_NICE = 4, + LTTNG_EVENT_CONTEXT_VPID = 5, + LTTNG_EVENT_CONTEXT_TID = 6, + LTTNG_EVENT_CONTEXT_VTID = 7, + LTTNG_EVENT_CONTEXT_PPID = 8, + LTTNG_EVENT_CONTEXT_VPPID = 9, + LTTNG_EVENT_CONTEXT_PTHREAD_ID = 10, +}; + +%rename("CALIBRATE_FUNCTION") LTTNG_CALIBRATE_FUNCTION; +enum lttng_calibrate_type { + LTTNG_CALIBRATE_FUNCTION = 0, +}; + + + +// ============================================= +// TYPEMAPS +// ============================================= + +//list_sessions +%typemap(argout) struct lttng_session **sessions{ + + int l = PyInt_AsSsize_t($result); + if (l >= 0) + { + PyObject *sessions = PyList_New(0); + int i; + for(i=0; i= 0) + { + PyObject *dom = PyList_New(0); + int i; + for(i=0; i= 0) + { + PyObject *chan = PyList_New(0); + int i; + for(i=0; i= 0) + { + PyObject *events = PyList_New(0); + int i; + for(i=0; i int + +Create a new tracing session using name and path. +Returns size of returned session payload data or a negative error code." +int lttng_create_session(const char *name, const char *path); + + +%feature("docstring")"destroy(str name) -> int + +Tear down tracing session using name. +Returns size of returned session payload data or a negative error code." +int lttng_destroy_session(const char *name); + + +%feature("docstring")"session_daemon_alive() -> int + +Check if session daemon is alive. +Return 1 if alive or 0 if not. +On error returns a negative value." +int lttng_session_daemon_alive(void); + + +%feature("docstring")"set_tracing_group(str name) -> int + +Sets the tracing_group variable with name. +This function allocates memory pointed to by tracing_group. +On success, returns 0, on error, returns -1 (null name) or -ENOMEM." +int lttng_set_tracing_group(const char *name); + + +%feature("docstring")"strerror(int code) -> char + +Returns a human readable string describing +the error code (a negative value)." +const char *lttng_strerror(int code); + + +%feature("docstring")"start(str session_name) -> int + +Start tracing for all traces of the session. +Returns size of returned session payload data or a negative error code." +int lttng_start_tracing(const char *session_name); + + +%feature("docstring")"stop(str session_name) -> int + +Stop tracing for all traces of the session. +Returns size of returned session payload data or a negative error code." +int lttng_stop_tracing(const char *session_name); + + +%feature("docstring")"channel_set_default_attr(Domain domain, ChannelAttr attr) + +Set default channel attributes. +If either or both of the arguments are null, attr content is zeroe'd." +void lttng_channel_set_default_attr(struct lttng_domain *domain, struct lttng_channel_attr *attr); + + +// ============================================= +// Python redefinition of some functions +// (List and Handle-related) +// ============================================= + +%feature("docstring")"" +%pythoncode %{ + +def list_sessions(): + """ + list_sessions() -> dict + + Ask the session daemon for all available sessions. + Returns a dict of Session instances, the key is the name; + on error, returns a negative value. + """ + + ses_list = _lttng_list_sessions() + if type(ses_list) is int: + return ses_list + + sessions = {} + + for ses_elements in ses_list: + ses = Session() + ses.name = ses_elements[0] + ses.path = ses_elements[1] + ses.enabled = ses_elements[2] + ses.padding = ses_elements[3] + + sessions[ses.name] = ses + + return sessions + + +def list_domains(session_name): + """ + list_domains(str session_name) -> list + + Ask the session daemon for all available domains of a session. + Returns a list of Domain instances; + on error, returns a negative value. + """ + + dom_list = _lttng_list_domains(session_name) + if type(dom_list) is int: + return dom_list + + domains = [] + + for dom_elements in dom_list: + dom = Domain() + dom.type = dom_elements[0] + dom.paddinf = dom_elements[1] + dom.attr.pid = dom_elements[2] + dom.attr.exec_name = dom_elements[3] + dom.attr.padding = dom_elements[4] + + domains.append(dom) + + return domains + + +def list_channels(handle): + """ + list_channels(Handle handle) -> dict + + Ask the session daemon for all available channels of a session. + Returns a dict of Channel instances, the key is the name; + on error, returns a negative value. + """ + + try: + chan_list = _lttng_list_channels(handle._h) + except AttributeError: + raise TypeError("in method 'list_channels', argument 1 must be a Handle instance") + + if type(chan_list) is int: + return chan_list + + channels = {} + + for channel_elements in chan_list: + chan = Channel() + chan.name = channel_elements[0] + chan.enabled = channel_elements[1] + chan.padding = channel_elements[2] + chan.attr.overwrite = channel_elements[3][0] + chan.attr.subbuf_size = channel_elements[3][1] + chan.attr.num_subbuf = channel_elements[3][2] + chan.attr.switch_timer_interval = channel_elements[3][3] + chan.attr.read_timer_interval = channel_elements[3][4] + chan.attr.output = channel_elements[3][5] + chan.attr.padding = channel_elements[3][6] + + channels[chan.name] = chan + + return channels + + +def list_events(handle, channel_name): + """ + list_events(Handle handle, str channel_name) -> dict + + Ask the session daemon for all available events of a session channel. + Returns a dict of Event instances, the key is the name; + on error, returns a negative value. + """ + + try: + ev_list = _lttng_list_events(handle._h, channel_name) + except AttributeError: + raise TypeError("in method 'list_events', argument 1 must be a Handle instance") + + if type(ev_list) is int: + return ev_list + + events = {} + + for ev_elements in ev_list: + ev = Event() + ev.name = ev_elements[0] + ev.type = ev_elements[1] + ev.loglevel_type = ev_elements[2] + ev.loglevel = ev_elements[3] + ev.enabled = ev_elements[4] + ev.pid = ev_elements[5] + ev.attr.padding = ev_elements[6] + ev.attr.probe.addr = ev_elements[7][0] + ev.attr.probe.offset = ev_elements[7][1] + ev.attr.probe.symbol_name = ev_elements[7][2] + ev.attr.probe.padding = ev_elements[7][3] + ev.attr.ftrace.symbol_name = ev_elements[8][0] + ev.attr.ftrace.padding = ev_elements[8][1] + ev.attr.padding = ev_elements[9] + + events[ev.name] = ev + + return events + + +def list_tracepoints(handle): + """ + list_tracepoints(Handle handle) -> dict + + Returns a dict of Event instances, the key is the name; + on error, returns a negative value. + """ + + try: + ev_list = _lttng_list_tracepoints(handle._h) + except AttributeError: + raise TypeError("in method 'list_tracepoints', argument 1 must be a Handle instance") + + if type(ev_list) is int: + return ev_list + + events = {} + + for ev_elements in ev_list: + ev = Event() + ev.name = ev_elements[0] + ev.type = ev_elements[1] + ev.loglevel_type = ev_elements[2] + ev.loglevel = ev_elements[3] + ev.enabled = ev_elements[4] + ev.pid = ev_elements[5] + ev.attr.padding = ev_elements[6] + ev.attr.probe.addr = ev_elements[7][0] + ev.attr.probe.offset = ev_elements[7][1] + ev.attr.probe.symbol_name = ev_elements[7][2] + ev.attr.probe.padding = ev_elements[7][3] + ev.attr.ftrace.symbol_name = ev_elements[8][0] + ev.attr.ftrace.padding = ev_elements[8][1] + ev.attr.padding = ev_elements[9] + + events[ev.name] = ev + + return events + + +def register_consumer(handle, socket_path): + """ + register_consumer(Handle handle, str socket_path) -> int + + Register an outside consumer. + Returns size of returned session payload data or a negative error code. + """ + + try: + return _lttng_register_consumer(handle._h, socket_path) + except AttributeError: + raise TypeError("in method 'register_consumer', argument 1 must be a Handle instance") + + +def add_context(handle, event_context, event_name, channel_name): + """ + add_context(Handle handle, EventContext ctx, + str event_name, str channel_name) -> int + + Add context to event and/or channel. + If event_name is None, the context is applied to all events of the channel. + If channel_name is None, a lookup of the event's channel is done. + If both are None, the context is applied to all events of all channels. + Returns the size of the returned payload data or a negative error code. + """ + + try: + return _lttng_add_context(handle._h, event_context, event_name, channel_name) + except AttributeError: + raise TypeError("in method 'add_context', argument 1 must be a Handle instance") + + +def enable_event(handle, event, channel_name): + """ + enable_event(Handle handle, Event event, + str channel_name) -> int + + Enable event(s) for a channel. + If no event name is specified, all events are enabled. + If no channel name is specified, the default 'channel0' is used. + Returns size of returned session payload data or a negative error code. + """ + + try: + return _lttng_enable_event(handle._h, event, channel_name) + except AttributeError: + raise TypeError("in method 'enable_event', argument 1 must be a Handle instance") + + +def enable_channel(handle, channel): + """ + enable_channel(Handle handle, Channel channel -> int + + Enable channel per domain + Returns size of returned session payload data or a negative error code. + """ + + try: + return _lttng_enable_channel(handle._h, channel) + except AttributeError: + raise TypeError("in method 'enable_channel', argument 1 must be a Handle instance") + + +def disable_event(handle, name, channel_name): + """ + disable_event(Handle handle, str name, str channel_name) -> int + + Disable event(s) of a channel and domain. + If no event name is specified, all events are disabled. + If no channel name is specified, the default 'channel0' is used. + Returns size of returned session payload data or a negative error code + """ + + try: + return _lttng_disable_event(handle._h, name, channel_name) + except AttributeError: + raise TypeError("in method 'disable_event', argument 1 must be a Handle instance") + + +def disable_channel(handle, name): + """ + disable_channel(Handle handle, str name) -> int + + All tracing will be stopped for registered events of the channel. + Returns size of returned session payload data or a negative error code. + """ + + try: + return _lttng_disable_channel(handle._h, name) + except AttributeError: + raise TypeError("in method 'disable_channel', argument 1 must be a Handle instance") + + +def calibrate(handle, calibrate): + """ + calibrate(Handle handle, Calibrate calibrate) -> int + + Quantify LTTng overhead. + Returns size of returned session payload data or a negative error code. + """ + + try: + return _lttng_calibrate(handle._h, calibrate) + except AttributeError: + raise TypeError("in method 'calibrate', argument 1 must be a Handle instance") +%} + + +// ============================================= +// Handle class +// Used to prevent freeing unallocated memory +// ============================================= + +%feature("docstring")"" +%feature("autodoc", "1"); + +%pythoncode %{ +class Handle: + """ + Manages a handle. + Takes two arguments: (str session_name, Domain domain) + """ + + __frozen = False + + def __init__(self, session_name, domain): + if type(session_name) is not str: + raise TypeError("in method '__init__', argument 2 of type 'str'") + if type(domain) is not Domain and domain is not None: + raise TypeError("in method '__init__', argument 3 of type 'lttng.Domain'") + + self._sname = session_name + if domain is None: + self._domtype = None + else: + self._domtype = domain.type + self._h = _lttng_create_handle(session_name, domain) + self.__frozen = True + + def __del__(self): + _lttng_destroy_handle(self._h) + + def __repr__(self): + if self._domtype == 1: + domstr = "DOMAIN_KERNEL" + elif self._domtype == 2: + domstr = "DOMAIN_UST" + else: + domstr = self._domtype + + return "lttng.Handle; session('{}'), domain.type({})".format( + self._sname, domstr) + + def __setattr__(self, attr, val): + if self.__frozen: + raise NotImplementedError("cannot modify attributes") + else: + self.__dict__[attr] = val +%} + + +// ============================================= +// STRUCTURES +// ============================================= + +%rename("Domain") lttng_domain; +%rename("EventContext") lttng_event_context; +%rename("Event") lttng_event; +%rename("Calibrate") lttng_calibrate; +%rename("ChannelAttr") lttng_channel_attr; +%rename("Channel") lttng_channel; +%rename("Session") lttng_session; + +struct lttng_domain{ + enum lttng_domain_type type; + char padding[LTTNG_DOMAIN_PADDING1]; + + union { + pid_t pid; + char exec_name[NAME_MAX]; + char padding[LTTNG_DOMAIN_PADDING2]; + } attr; + + %extend { + char *__repr__() { + static char temp[256]; + switch ( $self->type ) { + case 1: + sprintf(temp, "lttng.Domain; type(DOMAIN_KERNEL)"); + break; + case 2: + sprintf(temp, "lttng.Domain; type(DOMAIN_UST)"); + break; + default: + sprintf(temp, "lttng.Domain; type(%i)", $self->type); + break; + } + return &temp[0]; + } + } +}; + +struct lttng_event_context { + enum lttng_event_context_type ctx; + char padding[LTTNG_EVENT_CONTEXT_PADDING1]; + + union { + struct lttng_event_perf_counter_ctx perf_counter; + char padding[LTTNG_EVENT_CONTEXT_PADDING2]; + } u; + + %extend { + char *__repr__() { + static char temp[256]; + switch ( $self->ctx ) { + case 0: + sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_PID)"); + break; + case 1: + sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_PERF_COUNTER)"); + break; + case 2: + sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_PROCNAME)"); + break; + case 3: + sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_PRIO)"); + break; + case 4: + sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_NICE)"); + break; + case 5: + sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_VPID)"); + break; + case 6: + sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_TID)"); + break; + case 7: + sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_VTID)"); + break; + case 8: + sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_PPID)"); + break; + case 9: + sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_VPPID)"); + break; + case 10: + sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_PTHREAD_ID)"); + break; + default: + sprintf(temp, "lttng.EventContext; type(%i)", $self->ctx); + break; + } + return &temp[0]; + } + } +}; + +struct lttng_event_probe_attr { + uint64_t addr; + uint64_t offset; + char symbol_name[LTTNG_SYMBOL_NAME_LEN]; + char padding[LTTNG_EVENT_PROBE_PADDING1]; +}; + +struct lttng_event_function_attr { + char symbol_name[LTTNG_SYMBOL_NAME_LEN]; + char padding[LTTNG_EVENT_FUNCTION_PADDING1]; +}; + +struct lttng_event { + enum lttng_event_type type; + char name[LTTNG_SYMBOL_NAME_LEN]; + + enum lttng_loglevel_type loglevel_type; + int loglevel; + + int32_t enabled; + pid_t pid; + + char padding[LTTNG_EVENT_PADDING1]; + + union { + struct lttng_event_probe_attr probe; + struct lttng_event_function_attr ftrace; + + char padding[LTTNG_EVENT_PADDING2]; + } attr; + + %extend { + char *__repr__() { + static char temp[512]; + char evtype[50]; + char logtype[50]; + + switch ( $self->type ) { + case -1: + sprintf(evtype, "EVENT_ALL"); + break; + case 0: + sprintf(evtype, "EVENT_TRACEPOINT"); + break; + case 1: + sprintf(evtype, "EVENT_PROBE"); + break; + case 2: + sprintf(evtype, "EVENT_FUNCTION"); + break; + case 3: + sprintf(evtype, "EVENT_FUNCTION_ENTRY"); + break; + case 4: + sprintf(evtype, "EVENT_NOOP"); + break; + case 5: + sprintf(evtype, "EVENT_SYSCALL"); + break; + default: + sprintf(evtype, "%i", $self->type); + break; + } + + switch ( $self->loglevel_type ) { + case 0: + sprintf(logtype, "EVENT_LOGLEVEL_ALL"); + break; + case 1: + sprintf(logtype, "EVENT_LOGLEVEL_RANGE"); + break; + case 2: + sprintf(logtype, "EVENT_LOGLEVEL_SINGLE"); + break; + default: + sprintf(logtype, "%i", $self->loglevel_type); + break; + } + + sprintf(temp, "lttng.Event; name('%s'), type(%s), " + "loglevel_type(%s), loglevel(%i), " + "enabled(%s), pid(%i)", + $self->name, evtype, logtype, $self->loglevel, + $self->enabled ? "True" : "False", $self->pid); + return &temp[0]; + } + } +}; + +struct lttng_calibrate { + enum lttng_calibrate_type type; + char padding[LTTNG_CALIBRATE_PADDING1]; + + %extend { + char *__repr__() { + static char temp[256]; + switch ( $self->type ) { + case 0: + sprintf(temp, "lttng.Calibrate; type(CALIBRATE_FUNCTION)"); + break; + default: + sprintf(temp, "lttng.Calibrate; type(%i)", $self->type); + break; + } + return &temp[0]; + } + } +}; + +struct lttng_channel_attr { + int overwrite; + uint64_t subbuf_size; + uint64_t num_subbuf; + unsigned int switch_timer_interval; + unsigned int read_timer_interval; + enum lttng_event_output output; + + char padding[LTTNG_CHANNEL_ATTR_PADDING1]; + + %extend { + char *__repr__() { + static char temp[256]; + char evout[25]; + + switch ( $self->output ) { + case 0: + sprintf(evout, "EVENT_SPLICE"); + break; + case 1: + sprintf(evout, "EVENT_MMAP"); + break; + default: + sprintf(evout, "%i", $self->output); + break; + } + sprintf(temp, "lttng.ChannelAttr; overwrite(%i), subbuf_size(%lu), " + "num_subbuf(%lu), switch_timer_interval(%u), " + "read_timer_interval(%u), output(%s)", + $self->overwrite, $self->subbuf_size, $self->num_subbuf, + $self->switch_timer_interval, $self->read_timer_interval, + evout); + return &temp[0]; + } + } +}; + +struct lttng_channel { + char name[LTTNG_SYMBOL_NAME_LEN]; + uint32_t enabled; + struct lttng_channel_attr attr; + char padding[LTTNG_CHANNEL_PADDING1]; + + %extend { + char *__repr__() { + static char temp[512]; + sprintf(temp, "lttng.Channel; name('%s'), enabled(%s)", + $self->name, $self->enabled ? "True" : "False"); + return &temp[0]; + } + } +}; + +struct lttng_session { + char name[NAME_MAX]; + char path[PATH_MAX]; + uint32_t enabled; + char padding[LTTNG_SESSION_PADDING1]; + + %extend { + char *__repr__() { + static char temp[512]; + sprintf(temp, "lttng.Session; name('%s'), path('%s'), enabled(%s)", + $self->name, $self->path, + $self->enabled ? "True" : "False"); + return &temp[0]; + } + } +}; diff --git a/src/python/tests/example.py b/src/python/tests/example.py new file mode 100644 index 0000000..9703170 --- /dev/null +++ b/src/python/tests/example.py @@ -0,0 +1,109 @@ +#This example shows basically how to use the lttng-tools python module + +from lttng import * + +# This error will be raised is something goes wrong +class LTTngError(Exception): + def __init__(self, value): + self.value = value + def __str__(self): + return repr(self.value) + +#Setting up the domain to use +dom = Domain() +dom.type = DOMAIN_KERNEL + +#Setting up a channel to use +channel = Channel() +channel.name = "mychan" +channel.attr.overwrite = 0 +channel.attr.subbuf_size = 4096 +channel.attr.num_subbuf = 8 +channel.attr.switch_timer_interval = 0 +channel.attr.read_timer_interval = 200 +channel.attr.output = EVENT_SPLICE + +#Setting up some events that will be used +event = Event() +event.type = EVENT_TRACEPOINT +event.loglevel_type = EVENT_LOGLEVEL_ALL + +sched_switch = Event() +sched_switch.name = "sched_switch" +sched_switch.type = EVENT_TRACEPOINT +sched_switch.loglevel_type = EVENT_LOGLEVEL_ALL + +sched_process_exit = Event() +sched_process_exit.name = "sched_process_exit" +sched_process_exit.type = EVENT_TRACEPOINT +sched_process_exit.loglevel_type = EVENT_LOGLEVEL_ALL + +sched_process_free = Event() +sched_process_free.name = "sched_process_free" +sched_process_free.type = EVENT_TRACEPOINT +sched_process_free.loglevel_type = EVENT_LOGLEVEL_ALL + + +#Creating a new session +res = create("test","/lttng-traces/test") +if res<0: + raise LTTngError(strerror(res)) + +#Creating handle +han = None +han = Handle("test", dom) +if han is None: + raise LTTngError("Handle not created") + +#Enabling the kernel channel +res = enable_channel(han, channel) +if res<0: + raise LTTngError(strerror(res)) + +#Enabling some events in given channel +#To enable all events in default channel, use +#enable_event(han, event, None) +res = enable_event(han, sched_switch, channel.name) +if res<0: + raise LTTngError(strerror(res)) + +res = enable_event(han, sched_process_exit, channel.name) +if res<0: + raise LTTngError(strerror(res)) + +res = enable_event(han, sched_process_free, channel.name) +if res<0: + raise LTTngError(strerror(res)) + +#Disabling an event +res = disable_event(han, sched_switch.name, channel.name) +if res<0: + raise LTTngError(strerror(res)) + +#Getting a list of the channels +l = list_channels(han) +if type(l) is int: + raise LTTngError(strerror(l)) + +#Starting the trace +res = start("test") +if res<0: + raise LTTngError(strerror(res)) + +#Stopping the trace +res = stop("test") +if res<0: + raise LTTngError(strerror(res)) + +#Disabling a channel +res = disable_channel(han, channel.name) +if res<0: + raise LTTngError(strerror(res)) + +#Destroying the handle +del han + +#Destroying the session +res = destroy("test") +if res<0: + raise LTTngError(strerror(res)) diff --git a/src/python/tests/run.sh b/src/python/tests/run.sh new file mode 100644 index 0000000..7de819b --- /dev/null +++ b/src/python/tests/run.sh @@ -0,0 +1 @@ +python tests.py diff --git a/src/python/tests/tests.py b/src/python/tests/tests.py new file mode 100644 index 0000000..a4be981 --- /dev/null +++ b/src/python/tests/tests.py @@ -0,0 +1,310 @@ +import unittest +import os +import time +from lttng import * + +class TestLttngPythonModule (unittest.TestCase): + + def test_kernel_all_events(self): + dom = Domain() + dom.type = DOMAIN_KERNEL + + event = Event() + event.type = EVENT_TRACEPOINT + event.loglevel_type = EVENT_LOGLEVEL_ALL + + han = Handle("test_kernel_all_ev", dom) + + r = create("test_kernel_all_ev","/lttng-traces/test") + self.assertGreaterEqual(r, 0, strerror(r)) + + r = enable_event(han, event, None) + self.assertGreaterEqual(r, 0, strerror(r)) + + r = start("test_kernel_all_ev") + self.assertGreaterEqual(r, 0, strerror(r)) + time.sleep(2) + + r = stop("test_kernel_all_ev") + self.assertGreaterEqual(r, 0, strerror(r)) + + r = destroy("test_kernel_all_ev") + self.assertGreaterEqual(r, 0, strerror(r)) + + + def test_kernel_event(self): + + dom = Domain() + dom.type = DOMAIN_KERNEL + + channel = Channel() + channel.name="mychan" + channel.attr.overwrite = 0 + channel.attr.subbuf_size = 4096 + channel.attr.num_subbuf = 8 + channel.attr.switch_timer_interval = 0 + channel.attr.read_timer_interval = 200 + channel.attr.output = EVENT_SPLICE + + sched_switch = Event() + sched_switch.name = "sched_switch" + sched_switch.type = EVENT_TRACEPOINT + sched_switch.loglevel_type = EVENT_LOGLEVEL_ALL + + sched_process_exit = Event() + sched_process_exit.name = "sched_process_exit" + sched_process_exit.type = EVENT_TRACEPOINT + sched_process_exit.loglevel_type = EVENT_LOGLEVEL_ALL + + sched_process_free = Event() + sched_process_free.name = "sched_process_free" + sched_process_free.type = EVENT_TRACEPOINT + sched_process_free.loglevel_type = EVENT_LOGLEVEL_ALL + + han = Handle("test_kernel_event", dom) + + #Create session test + r = create("test_kernel_event","/lttng-traces/test") + self.assertGreaterEqual(r, 0, strerror(r)) + + #Enabling channel tests + r = enable_channel(han, channel) + self.assertGreaterEqual(r, 0, strerror(r)) + + #Enabling events tests + r = enable_event(han, sched_switch, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + r = enable_event(han, sched_process_exit, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + r = enable_event(han, sched_process_free, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + #Disabling events tests + r = disable_event(han, sched_switch.name, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + r = disable_event(han, sched_process_free.name, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + #Renabling events tests + r = enable_event(han, sched_switch, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + r = enable_event(han, sched_process_free, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + #Start, stop, destroy + r = start("test_kernel_event") + self.assertGreaterEqual(r, 0, strerror(r)) + time.sleep(2) + + r = stop("test_kernel_event") + self.assertGreaterEqual(r, 0, strerror(r)) + + r=disable_channel(han, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + r=destroy("test_kernel_event") + self.assertGreaterEqual(r, 0, strerror(r)) + + + + def test_ust_all_events(self): + dom = Domain() + dom.type = DOMAIN_UST + + event = Event() + event.type = EVENT_TRACEPOINT + event.loglevel_type = EVENT_LOGLEVEL_ALL + + han = Handle("test_ust_all_ev", dom) + + r = create("test_ust_all_ev","/lttng-traces/test") + self.assertGreaterEqual(r, 0, strerror(r)) + + r = enable_event(han, event, None) + self.assertGreaterEqual(r, 0, strerror(r)) + + r = start("test_ust_all_ev") + self.assertGreaterEqual(r, 0, strerror(r)) + time.sleep(2) + + r = stop("test_ust_all_ev") + self.assertGreaterEqual(r, 0, strerror(r)) + + r = destroy("test_ust_all_ev") + self.assertGreaterEqual(r, 0, strerror(r)) + + + def test_ust_event(self): + + dom = Domain() + dom.type = DOMAIN_UST + + channel = Channel() + channel.name="mychan" + channel.attr.overwrite = 0 + channel.attr.subbuf_size = 4096 + channel.attr.num_subbuf = 8 + channel.attr.switch_timer_interval = 0 + channel.attr.read_timer_interval = 200 + channel.attr.output = EVENT_MMAP + + ev1 = Event() + ev1.name = "tp1" + ev1.type = EVENT_TRACEPOINT + ev1.loglevel_type = EVENT_LOGLEVEL_ALL + + ev2 = Event() + ev2.name = "ev2" + ev2.type = EVENT_TRACEPOINT + ev2.loglevel_type = EVENT_LOGLEVEL_ALL + + ev3 = Event() + ev3.name = "ev3" + ev3.type = EVENT_TRACEPOINT + ev3.loglevel_type = EVENT_LOGLEVEL_ALL + + han = Handle("test_ust_event", dom) + + #Create session test + r = create("test_ust_event","/lttng-traces/test") + self.assertGreaterEqual(r, 0, strerror(r)) + + #Enabling channel tests + r = enable_channel(han, channel) + self.assertGreaterEqual(r, 0, strerror(r)) + + #Enabling events tests + r = enable_event(han, ev1, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + r = enable_event(han, ev2, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + r = enable_event(han, ev3, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + #Disabling events tests + r = disable_event(han, ev1.name, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + r = disable_event(han, ev3.name, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + #Renabling events tests + r = enable_event(han, ev1, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + r = enable_event(han, ev3, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + #Start, stop + r = start("test_ust_event") + self.assertGreaterEqual(r, 0, strerror(r)) + time.sleep(2) + + r = stop("test_ust_event") + self.assertGreaterEqual(r, 0, strerror(r)) + + #Restart/restop + r = start("test_ust_event") + self.assertGreaterEqual(r, 0, strerror(r)) + time.sleep(2) + + r = stop("test_ust_event") + self.assertGreaterEqual(r, 0, strerror(r)) + + #Disabling channel and destroy + r=disable_channel(han, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + r=destroy("test_ust_event") + self.assertGreaterEqual(r, 0, strerror(r)) + + + def test_other_functions(self): + dom = Domain() + dom.type=DOMAIN_KERNEL + + event=Event() + event.type=EVENT_TRACEPOINT + event.loglevel_type=EVENT_LOGLEVEL_ALL + + calib = Calibrate() + calib.type = CALIBRATE_FUNCTION + + ctx = EventContext() + ctx.type=EVENT_CONTEXT_PID + + chattr = ChannelAttr() + chattr.overwrite = 0 + chattr.subbuf_size = 4096 + chattr.num_subbuf = 8 + chattr.switch_timer_interval = 0 + chattr.read_timer_interval = 200 + chattr.output = EVENT_SPLICE + + han = Handle("test_otherf" , dom) + + r = create("test_otherf","/lttng-traces/test") + self.assertGreaterEqual(r, 0, strerror(r)) + + r = enable_event(han, event, None) + self.assertGreaterEqual(r, 0, strerror(r)) + + #Calibrate test + r = calibrate(han , calib) + self.assertGreaterEqual(r, 0, strerror(r)) + + #Context test + r = add_context(han, ctx, "sched_switch", "channel0") + self.assertGreaterEqual(r, 0, strerror(r)) + #Any channel + r = add_context(han, ctx, "sched_wakeup", None) + self.assertGreaterEqual(r, 0, strerror(r)) + #All events + r = add_context(han, ctx, None, None) + self.assertGreaterEqual(r, 0, strerror(r)) + + #Def. channel attr + channel_set_default_attr(dom, chattr) + channel_set_default_attr(None, None) + + #Ses Daemon alive + r = session_daemon_alive() + self.assertTrue(r == 1 or r == 0, strerror(r)) + + #Setting trace group + r = set_tracing_group("testing") + self.assertGreaterEqual(r, 0, strerror(r)) + + + r = start("test_otherf") + self.assertGreaterEqual(r, 0, strerror(r)) + time.sleep(2) + + r = stop("test_otherf") + self.assertGreaterEqual(r, 0, strerror(r)) + + del han + + r = destroy("test_otherf") + self.assertGreaterEqual(r, 0, strerror(r)) + + +if __name__ == "__main__": + # CHECK IF ROOT + if os.geteuid() == 0: + #Make sure session names don't already exist: + destroy("test_kernel_event") + destroy("test_kernel_all_events") + destroy("test_ust_all_events") + destroy("test_ust_event") + destroy("test_otherf") + + unittest.main() + else: + print('Script must be run as root') -- 1.7.9.5 From montarcyber at gmail.com Fri Jul 27 11:32:21 2012 From: montarcyber at gmail.com (tchak adim) Date: Fri, 27 Jul 2012 11:32:21 -0400 Subject: [lttng-dev] syscall options Message-ID: Hi , i wanna display channel name (kernel,fs,status) and File name (for example :in the case of sys-open or sys-close) for differents syscall traces generated by Lttng2.0 . i didn't find any indication of what should i do to add these information . thanks in advance ! -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.han at umiami.edu Sun Jul 29 16:26:12 2012 From: r.han at umiami.edu (Rui Han) Date: Sun, 29 Jul 2012 16:26:12 -0400 Subject: [lttng-dev] Module lttng_tracer not found. Message-ID: Hi, I used lttng last week and didn't touch it ever since. I am trying to use it again. I use lttng list -k, it give me error messages: FATAL: Module lttng_tracer not found. Error: Unable to load module lttng-tracer Error: Unable to remove module lttng-tracer Warning: No kernel tracer available Error: Unable to list kernel events I run kernel tracing as root. At first, I thought I have to start the daemon by lttng-sessiond command. It gave me the error: "Error: Already running daemon." At this time, I can create session, it gave "Session session created. Traces will be written in /root/lttng-traces/session-20120729-160806". However, it failed to generate a single term of tracing. While I tried lsmod, there are no lttng related module in the list. Which I remember there were several. The same thing happened to my two ubuntu systems. I restarted the system, it still doesn't work. Does any one know how to make lttng work again in this situation? Thank you very much. Best regards, Rui -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexmonthy at voxpopuli.im Mon Jul 30 10:16:23 2012 From: alexmonthy at voxpopuli.im (Alexandre Montplaisir) Date: Mon, 30 Jul 2012 10:16:23 -0400 Subject: [lttng-dev] Module lttng_tracer not found. In-Reply-To: References: Message-ID: <50169737.5010805@voxpopuli.im> Hi, What steps did you use to install LTTng? Also can you please paste the output of: $ apt-cache policy lttng-modules-dkms Thanks, -- Alexandre Montplaisir DORSAL lab, ?cole Polytechnique de Montr?al On 12-07-29 04:26 PM, Rui Han wrote: > Hi, > > I used lttng last week and didn't touch it ever since. I am trying to use > it again. I use lttng list -k, it give me error messages: > > FATAL: Module lttng_tracer not found. > Error: Unable to load module lttng-tracer > Error: Unable to remove module lttng-tracer > Warning: No kernel tracer available > Error: Unable to list kernel events > > I run kernel tracing as root. At first, I thought I have to start the > daemon by lttng-sessiond command. It gave me the error: "Error: Already > running daemon." At this time, I can create session, it gave "Session > session created. Traces will be written in > /root/lttng-traces/session-20120729-160806". However, it failed to generate > a single term of tracing. While I tried lsmod, there are no lttng related > module in the list. Which I remember there were several. The same thing > happened to my two ubuntu systems. I restarted the system, it still doesn't > work. Does any one know how to make lttng work again in this situation? > > Thank you very much. > > Best regards, > Rui From david.goulet at polymtl.ca Mon Jul 30 10:18:58 2012 From: david.goulet at polymtl.ca (David Goulet) Date: Mon, 30 Jul 2012 10:18:58 -0400 Subject: [lttng-dev] Module lttng_tracer not found. In-Reply-To: <50169737.5010805@voxpopuli.im> References: <50169737.5010805@voxpopuli.im> Message-ID: <501697D2.1000401@polymtl.ca> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 And I would also make sure you start the lttng session daemon as root. David On 30/07/12 10:16 AM, Alexandre Montplaisir wrote: > Hi, > > What steps did you use to install LTTng? > > Also can you please paste the output of: $ apt-cache policy > lttng-modules-dkms > > > Thanks, > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAEBAgAGBQJQFpfSAAoJEELoaioR9I02j24H/1trzQRWn9nh6EPiEZhCbVos DYc3t6Qa56S66UWbTPZp0TpBSIqpw27gDMyeavKIe5CmsSfIvN5XqNgBAa+aX47m pO+sJ6jqAARwZjXoowJPgwivifM6qnDYDAAUmrvjjcqfC+4IMpemIdRNZzhUGbm/ GRHOgiDM4g8VO55LODUP/FUBtKlbZsWmJ95zxaDGYo1ZAszLbCwDSp++Nhvg0Yzi fnyj16ajoZdHnTiarK5ymVqeDE/1SX9fiWUWQvTysnz/EE5niaEtuWa7pRFs/ISq 042YBw0oS8afZarPLvIeKoPB3Dr4379yEWg88qH5lYfzvNicn+ZKUHoEyAu/FcY= =TX+s -----END PGP SIGNATURE----- From Paul_Woegerer at mentor.com Mon Jul 30 10:51:00 2012 From: Paul_Woegerer at mentor.com (Woegerer, Paul) Date: Mon, 30 Jul 2012 16:51:00 +0200 Subject: [lttng-dev] Module lttng_tracer not found. In-Reply-To: References: Message-ID: <50169F54.9060807@mentor.com> Sorry, I forgot to CC the list. On 07/29/2012 10:26 PM, Rui Han wrote: > Hi, > > I used lttng last week and didn't touch it ever since. I am trying to > use it again. I use lttng list -k, it give me error messages: > > FATAL: Module lttng_tracer not found. > Error: Unable to load module lttng-tracer > Error: Unable to remove module lttng-tracer > Warning: No kernel tracer available > Error: Unable to list kernel events > > I run kernel tracing as root. At first, I thought I have to start the > daemon by lttng-sessiond command. It gave me the error: "Error: > Already running daemon." At this time, I can create session, it gave > "Session session created. Traces will be written in > /root/lttng-traces/session-20120729-160806". However, it failed to > generate a single term of tracing. While I tried lsmod, there are no > lttng related module in the list. Which I remember there were several. > The same thing happened to my two ubuntu systems. I restarted the > system, it still doesn't work. Does any one know how to make lttng > work again in this situation? > > Thank you very much. > > Best regards, > Rui > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Paul Woegerer | SW Development Engineer Mentor Embedded(tm) | Prinz Eugen Stra?e 72/2/4, Vienna, 1040 Austria P 43.1.535991320 Nucleus? | Linux? | Android(tm) | Services | UI | Multi-OS Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded message was scrubbed... From: Rui Han Subject: Re: [lttng-dev] Module lttng_tracer not found. Date: Mon, 30 Jul 2012 10:27:16 -0400 Size: 8732 URL: From r.han at umiami.edu Mon Jul 30 10:54:47 2012 From: r.han at umiami.edu (Rui Han) Date: Mon, 30 Jul 2012 10:54:47 -0400 Subject: [lttng-dev] Module lttng_tracer not found. In-Reply-To: References: Message-ID: Thansks. I downloaded the packages and followed the README to install. My problem has been solved, it turns out the kernel got updated since my last use of lttng. Regards, Rui On Mon, Jul 30, 2012 at 10:16 AM, Alexandre Montplaisir < alexmonthy at voxpopuli.im> wrote: > Hi, > > What steps did you use to install LTTng? > > Also can you please paste the output of: > $ apt-cache policy lttng-modules-dkms > > > Thanks, > > -- > Alexandre Montplaisir > DORSAL lab, > ?cole Polytechnique de Montr?al > > > > On 12-07-29 04:26 PM, Rui Han wrote: > > Hi, > > > > I used lttng last week and didn't touch it ever since. I am trying to use > > it again. I use lttng list -k, it give me error messages: > > > > FATAL: Module lttng_tracer not found. > > Error: Unable to load module lttng-tracer > > Error: Unable to remove module lttng-tracer > > Warning: No kernel tracer available > > Error: Unable to list kernel events > > > > I run kernel tracing as root. At first, I thought I have to start the > > daemon by lttng-sessiond command. It gave me the error: "Error: Already > > running daemon." At this time, I can create session, it gave "Session > > session created. Traces will be written in > > /root/lttng-traces/session-20120729-160806". However, it failed to > generate > > a single term of tracing. While I tried lsmod, there are no lttng related > > module in the list. Which I remember there were several. The same thing > > happened to my two ubuntu systems. I restarted the system, it still > doesn't > > work. Does any one know how to make lttng work again in this situation? > > > > Thank you very much. > > > > Best regards, > > Rui > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From christian.babeux at efficios.com Mon Jul 30 11:57:17 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Mon, 30 Jul 2012 11:57:17 -0400 Subject: [lttng-dev] lttng-ust, libtool and cross-compilation Message-ID: Hi all, When cross-compiling lttng-ust, some users might encounter an issue regarding missing libraries like this one: /usr/lib/gcc/powerpc-linux-gnu/4.4.5/../../../../powerpc-linux-gnu/bin/ld: warning: liblttng-ust-tracepoint.so.0, needed by ../../liblttng-ust/.libs/liblttng-ust.so, not found (try using -rpath or -rpath-link) ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to `init_tracepoint' ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to `__tracepoint_probe_unregister' ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to `__tracepoint_probe_register' ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to `exit_tracepoint' After some digging, this issue seems to appear only in cross-compilation setup, especially on Debian based system. The lttng-ust libraries dependencies can be summarized as follow: +-----------------+ -> liblttng-ust-tracepoint.so -> liburcu-bp.so | liblttng-ust.so | -> liblttng-ust-runtime.so +-----------------+ -> liblttng-ust-support.so -> libringbuffer.so The problem arise when linking libraries with indirect libraries dependencies. Other project have had this issue in the past [1]. This "bug" is caused by an upstream modification in the libtool package on Debian system [2]. The libtool "link_all_deplibs" flag is set to "no" by default on linux targets (AFAIK, other distros set it to unknown). This has the unfortunate consequence of breaking cross-compilation builds because gnu-ld doesn't use rpath on cross-compilation targets. Hence the undefined reference errors messages. Here are some possible ways to handle this problematic situation: 1 - Cook our own libtool.m4 in the lttng-ust tree with the libtool link_all_deplibs flag set to 'unknown'. Pro: No action required on the user side. Con: Additional work for the maintainer to ensure that the proper libtool.m4 is present in sources packages. Additionnal maintenance. 2 - Add explicit dependencies to indirect libraries in the appropriates Makefile.am (such as the ones found in tests/{hello, hello.cxx, fork}). Pro: No action required on the user side. Con: Tedious. 3 - Add a configure flag to detect bogus version of libtool and automagically fix it. Pro: Less maintenance. Con: Require user interaction when cross-compiling. Other components of LTTng might be affected be the same issue. Any thoughts or additional input is quite welcome! Thanks, Christian [1] - https://lists.isc.org/pipermail/bind10-dev/2011-August/002535.html [2] - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=297726 From mathieu.desnoyers at efficios.com Mon Jul 30 12:07:00 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 30 Jul 2012 12:07:00 -0400 Subject: [lttng-dev] lttng-ust, libtool and cross-compilation In-Reply-To: References: Message-ID: <20120730160700.GA11557@Krystal> * Christian Babeux (christian.babeux at efficios.com) wrote: > Hi all, > > When cross-compiling lttng-ust, some users might encounter an issue > regarding missing libraries like this one: > > /usr/lib/gcc/powerpc-linux-gnu/4.4.5/../../../../powerpc-linux-gnu/bin/ld: > warning: liblttng-ust-tracepoint.so.0, needed by > ../../liblttng-ust/.libs/liblttng-ust.so, not found (try using -rpath > or -rpath-link) > ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to > `init_tracepoint' > ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to > `__tracepoint_probe_unregister' > ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to > `__tracepoint_probe_register' > ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to > `exit_tracepoint' > > After some digging, this issue seems to appear only in cross-compilation > setup, especially on Debian based system. > > The lttng-ust libraries dependencies can be summarized as follow: > > +-----------------+ -> liblttng-ust-tracepoint.so -> liburcu-bp.so > | liblttng-ust.so | -> liblttng-ust-runtime.so > +-----------------+ -> liblttng-ust-support.so -> libringbuffer.so > > The problem arise when linking libraries with indirect libraries dependencies. > Other project have had this issue in the past [1]. > > This "bug" is caused by an upstream modification in the libtool package > on Debian system [2]. The libtool "link_all_deplibs" flag is set to "no" > by default on linux targets (AFAIK, other distros set it to unknown). > > This has the unfortunate consequence of breaking cross-compilation > builds because gnu-ld doesn't use rpath on cross-compilation targets. > Hence the undefined reference errors messages. > > Here are some possible ways to handle this problematic situation: > > 1 - Cook our own libtool.m4 in the lttng-ust tree with the > libtool link_all_deplibs flag set to 'unknown'. > > Pro: No action required on the user side. > Con: Additional work for the maintainer to ensure that the proper > libtool.m4 is present in sources packages. Additionnal maintenance. > > 2 - Add explicit dependencies to indirect libraries in the appropriates > Makefile.am (such as the ones found in tests/{hello, hello.cxx, fork}). > > Pro: No action required on the user side. > Con: Tedious. > > 3 - Add a configure flag to detect bogus version of libtool and automagically > fix it. > > Pro: Less maintenance. > Con: Require user interaction when cross-compiling. could we do a variant of (3) ? We could automagically change the link_all_deplibs flag in our libtool.m4 in configure, and add a "--disable-libtool-cross-compile-fixup" (or something shorter) to disable running that script. So typically it will require no interaction from users, except when they "know what they are doing" and want to explicitely disable our work-around. Thoughts ? Mathieu > > Other components of LTTng might be affected be the same issue. > > Any thoughts or additional input is quite welcome! > > Thanks, > > Christian > > [1] - https://lists.isc.org/pipermail/bind10-dev/2011-August/002535.html > [2] - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=297726 -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From r.han at umiami.edu Mon Jul 30 23:22:24 2012 From: r.han at umiami.edu (Rui Han) Date: Mon, 30 Jul 2012 23:22:24 -0400 Subject: [lttng-dev] how to get the sockaddr struct from its pointer in kernel tracing Message-ID: Hi, In the sys_connect and sys_bind kernel tracing, a pointer to the socdaddr struct has been dumped. (i.e. the second argument in sys_bind: { cpu_id = 0 }, { fd = 39, umyaddr = 0x7FE18E3D0B80, addrlen = 0xC }). What if I want to access the struct for the IP and port number related to the socket? Is there an easy way to do this? Please give me some hints. Thank you very much. Regards, Rui -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.goulet at polymtl.ca Tue Jul 31 12:13:12 2012 From: david.goulet at polymtl.ca (David Goulet) Date: Tue, 31 Jul 2012 12:13:12 -0400 Subject: [lttng-dev] [RFC] LTTng address API proposal Message-ID: <50180418.5020904@polymtl.ca> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This follows the discussion on IRC #lttng which aims at removing the lttng_uri structure from the public API. Cheers! David -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAEBAgAGBQJQGAQYAAoJEELoaioR9I02lUYH/i/8/ynJKBbCbKd7JGG4hKwo QG1ECZvbujSLkZPAG81sYtrj1kPlDC54Bu+rajTcMeusJ937o2AXvjT+KgesZF0P 4cGHM64WQ7wK4Y/nJE3JQ2dHdytP2KEizN4YWW8MERgKdx/TlN28wL08zRGxKC19 /Lo51OS3lpYgAUmezNWjncQ/xBmlsW6zFzGPgPt6jmN3rfKdgXVE+ArWStUOn9uk BwfXT+hk0WGt/8ykG7qxPDAyBeS1dH1lJpCrjcZKEBUBXose85JvtioI1b5nkX1F YHQM7IFH9PpykYLqVhCVTe/0ukjIl9zyBBhTak4l+ShGeGYR0M8rLdXUbQDDriU= =m3Bn -----END PGP SIGNATURE----- -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0004-lttng-address-api.txt URL: From mathieu.desnoyers at efficios.com Tue Jul 31 12:29:08 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 31 Jul 2012 12:29:08 -0400 Subject: [lttng-dev] how to get the sockaddr struct from its pointer in kernel tracing In-Reply-To: References: Message-ID: <20120731162907.GA32234@Krystal> * Rui Han (r.han at umiami.edu) wrote: > Hi, > > In the sys_connect and sys_bind kernel tracing, a pointer to the socdaddr > struct has been dumped. (i.e. the second argument in sys_bind: { cpu_id = 0 > }, { fd = 39, umyaddr = 0x7FE18E3D0B80, addrlen = 0xC }). What if I want to > access the struct for the IP and port number related to the socket? Is > there an easy way to do this? Please give me some hints. Thank you very > much. current, none. A "quick" way to do this might be to add a tracepoint into these system calls. Eventually, we might look into supporting writing complex data structures into lttng-modules, but this would require close integration with the Linux kernel sources. Thanks, Mathieu > > Regards, > Rui > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Tue Jul 31 13:26:22 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 31 Jul 2012 13:26:22 -0400 Subject: [lttng-dev] how to get the sockaddr struct from its pointer in kernel tracing In-Reply-To: References: Message-ID: <20120731172622.GA2674@Krystal> By close integration, I mean that we would have to change the in-kernel structure declarations and wrap them into macros, so we can re-use those headers within the TRACE_EVENT code to serialize the events and express the event metadata. Mathieu * Rui Han (r.han at umiami.edu) wrote: > Hi Mathieu, > > Thank you very much for your reply. I'll look into that solution. By "close > integration", do you mean minimum overhead? Could you be more > specific about the issue that prevent it from being implemented in current > version. So that I can tell whether I am be able to do it or not within > time constrain. > > Regards, > Rui > > On Tue, Jul 31, 2012 at 12:29 PM, Mathieu Desnoyers < > mathieu.desnoyers at efficios.com> wrote: > > > * Rui Han (r.han at umiami.edu) wrote: > > > Hi, > > > > > > In the sys_connect and sys_bind kernel tracing, a pointer to the socdaddr > > > struct has been dumped. (i.e. the second argument in sys_bind: { cpu_id > > = 0 > > > }, { fd = 39, umyaddr = 0x7FE18E3D0B80, addrlen = 0xC }). What if I want > > to > > > access the struct for the IP and port number related to the socket? Is > > > there an easy way to do this? Please give me some hints. Thank you very > > > much. > > > > current, none. > > > > A "quick" way to do this might be to add a tracepoint into these system > > calls. > > > > Eventually, we might look into supporting writing complex data > > structures into lttng-modules, but this would require close integration > > with the Linux kernel sources. > > > > Thanks, > > > > Mathieu > > > > > > > > Regards, > > > Rui > > > > > _______________________________________________ > > > lttng-dev mailing list > > > lttng-dev at lists.lttng.org > > > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > > > > > -- > > Mathieu Desnoyers > > Operating System Efficiency R&D Consultant > > EfficiOS Inc. > > http://www.efficios.com > > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From r.han at umiami.edu Tue Jul 31 13:33:44 2012 From: r.han at umiami.edu (Rui Han) Date: Tue, 31 Jul 2012 13:33:44 -0400 Subject: [lttng-dev] how to get the sockaddr struct from its pointer in kernel tracing In-Reply-To: <3d151a9bb8af4f308b099a482117a498@UMEX001.cgcent.miami.edu> References: <3d151a9bb8af4f308b099a482117a498@UMEX001.cgcent.miami.edu> Message-ID: Great! Got it. Thank you. Rui On Tue, Jul 31, 2012 at 1:26 PM, Mathieu Desnoyers < mathieu.desnoyers at efficios.com> wrote: > By close integration, I mean that we would have to change the in-kernel > structure declarations and wrap them into macros, so we can re-use those > headers within the TRACE_EVENT code to serialize the events and express > the event metadata. > > Mathieu > > * Rui Han (r.han at umiami.edu) wrote: > > Hi Mathieu, > > > > Thank you very much for your reply. I'll look into that solution. By > "close > > integration", do you mean minimum overhead? Could you be more > > specific about the issue that prevent it from being implemented in > current > > version. So that I can tell whether I am be able to do it or not within > > time constrain. > > > > Regards, > > Rui > > > > On Tue, Jul 31, 2012 at 12:29 PM, Mathieu Desnoyers < > > mathieu.desnoyers at efficios.com> wrote: > > > > > * Rui Han (r.han at umiami.edu) wrote: > > > > Hi, > > > > > > > > In the sys_connect and sys_bind kernel tracing, a pointer to the > socdaddr > > > > struct has been dumped. (i.e. the second argument in sys_bind: { > cpu_id > > > = 0 > > > > }, { fd = 39, umyaddr = 0x7FE18E3D0B80, addrlen = 0xC }). What if I > want > > > to > > > > access the struct for the IP and port number related to the socket? > Is > > > > there an easy way to do this? Please give me some hints. Thank you > very > > > > much. > > > > > > current, none. > > > > > > A "quick" way to do this might be to add a tracepoint into these system > > > calls. > > > > > > Eventually, we might look into supporting writing complex data > > > structures into lttng-modules, but this would require close integration > > > with the Linux kernel sources. > > > > > > Thanks, > > > > > > Mathieu > > > > > > > > > > > Regards, > > > > Rui > > > > > > > _______________________________________________ > > > > lttng-dev mailing list > > > > lttng-dev at lists.lttng.org > > > > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > > > > > > > > -- > > > Mathieu Desnoyers > > > Operating System Efficiency R&D Consultant > > > EfficiOS Inc. > > > http://www.efficios.com > > > > > -- > Mathieu Desnoyers > Operating System Efficiency R&D Consultant > EfficiOS Inc. > http://www.efficios.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.goulet at polymtl.ca Tue Jul 31 14:43:05 2012 From: david.goulet at polymtl.ca (David Goulet) Date: Tue, 31 Jul 2012 14:43:05 -0400 Subject: [lttng-dev] [lttng-tools PATCH] lttng-tools python module In-Reply-To: <1343326167-11522-1-git-send-email-danny.serres@efficios.com> References: <1343326167-11522-1-git-send-email-danny.serres@efficios.com> Message-ID: <50182739.3030604@polymtl.ca> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Danny, Sorry for the delay! First, thanks for this great work. I have a couple of "requests" before I put all that upstream. Can you add the generated files into .gitignore please. I get this: # src/python/lttng.i # src/python/lttng.py # src/python/lttng_wrap.c There is also forgotten whitespaces in src/python/lttng.i.in (first carac.) + char *__repr__() { (times 5) Apart from those minor issues, I have two questions about this patch. First, why is the python module in src/ and not in extras/ ? I consider src/ to be supported and stable code shipped with the installation and/or in packages. Also, the src/ directory is the core code of lttng-tools and this module is more an extra useful tool. Second, _IF_ this goes into src/, please move the tests to the tests/ directory else we are going to make it self contained in extras/ which is good right now. Last thing, could it be possible to have a small how-to/tutorial in the doc/ directory so people know that this exist and how to install it and use it ? (Also add it to the README in PACKAGE CONTENTS). A swig2 dependency will be added with this module so this howto should mention that this depends on that software. (swig2.0 package on Debian/Ubuntu). I might be wrong on some point so don't hesitate to argue and comment! :) Cheers! David On 26/07/12 02:09 PM, Danny Serres wrote: > The lttng-tools Python module can be used to directly control the > lttng-tools API inside Python, using 'import lttng'. > > Therefore, it becomes possible to create a trace, add events, start/stop > tracing, destroy a session and so on from within Python. > > The module does not include URI-related functions. > > SWIG >= 2.0 is used to create the wrapper and its 'warning md variable > unused' bug is patched in Makefile.am. > > In the interface file, struct and enum are directly copied from lttng.h > (all changes must be made in both files). > > Signed-off-by: Danny Serres Signed-off-by: > Yannick Brosseau --- config/ax_pkg_swig.m4 > | 135 ++++++ configure.ac | 43 ++ src/Makefile.am > | 4 + src/python/Makefile.am | 25 ++ src/python/lttng.i.in > | 1023 +++++++++++++++++++++++++++++++++++++++++++ > src/python/tests/example.py | 109 +++++ src/python/tests/run.sh | 1 > + src/python/tests/tests.py | 310 +++++++++++++ 8 files changed, 1650 > insertions(+) create mode 100644 config/ax_pkg_swig.m4 create mode 100644 > src/python/Makefile.am create mode 100644 src/python/lttng.i.in create mode > 100644 src/python/tests/example.py create mode 100644 > src/python/tests/run.sh create mode 100644 src/python/tests/tests.py > > diff --git a/config/ax_pkg_swig.m4 b/config/ax_pkg_swig.m4 new file mode > 100644 index 0000000..e112f3d --- /dev/null +++ b/config/ax_pkg_swig.m4 @@ > -0,0 +1,135 @@ +# > =========================================================================== > > +# http://www.gnu.org/software/autoconf-archive/ax_pkg_swig.html > +# > =========================================================================== > > +# > +# SYNOPSIS +# +# AX_PKG_SWIG([major.minor.micro], [action-if-found], > [action-if-not-found]) +# +# DESCRIPTION +# +# This macro searches for a > SWIG installation on your system. If found, +# then SWIG is AC_SUBST'd; > if not found, then $SWIG is empty. If SWIG is +# found, then SWIG_LIB is > set to the SWIG library path, and AC_SUBST'd. +# +# You can use the > optional first argument to check if the version of the +# available SWIG > is greater than or equal to the value of the argument. It +# should have > the format: N[.N[.N]] (N is a number between 0 and 999. Only +# the first > N is mandatory.) If the version argument is given (e.g. +# 1.3.17), > AX_PKG_SWIG checks that the swig package is this version number +# or > higher. +# +# As usual, action-if-found is executed if SWIG is found, > otherwise +# action-if-not-found is executed. +# +# In configure.in, > use as: +# +# AX_PKG_SWIG(1.3.17, [], [ AC_MSG_ERROR([SWIG is required > to build..]) ]) +# AX_SWIG_ENABLE_CXX +# > AX_SWIG_MULTI_MODULE_SUPPORT +# AX_SWIG_PYTHON +# +# LICENSE +# +# > Copyright (c) 2008 Sebastian Huber +# Copyright > (c) 2008 Alan W. Irwin +# Copyright (c) 2008 > Rafael Laboissiere +# Copyright (c) 2008 Andrew > Collier +# Copyright (c) 2011 Murray Cumming > +# +# This program is free software; you can > redistribute it and/or modify it +# under the terms of the GNU General > Public License as published by the +# Free Software Foundation; either > version 2 of the License, or (at your +# option) any later version. +# +# > This program is distributed in the hope that it will be useful, but +# > WITHOUT ANY WARRANTY; without even the implied warranty of +# > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# > Public License for more details. +# +# You should have received a copy of > the GNU General Public License along +# with this program. If not, see > . +# +# As a special exception, the > respective Autoconf Macro's copyright owner +# gives unlimited permission > to copy, distribute and modify the configure +# scripts that are the > output of Autoconf when processing the Macro. You +# need not follow the > terms of the GNU General Public License when using +# or distributing > such scripts, even though portions of the text of the +# Macro appear in > them. The GNU General Public License (GPL) does govern +# all other use > of the material that constitutes the Autoconf Macro. +# +# This special > exception to the GPL applies to versions of the Autoconf +# Macro > released by the Autoconf Archive. When you make and distribute a +# > modified version of the Autoconf Macro, you may extend this special +# > exception to the GPL to apply to your modified version as well. + +#serial > 8 + +AC_DEFUN([AX_PKG_SWIG],[ + # Ubuntu has swig 2.0 as > /usr/bin/swig2.0 + AC_PATH_PROGS([SWIG],[swig swig2.0]) + if > test -z "$SWIG" ; then + m4_ifval([$3],[$3],[:]) + > elif test -n "$1" ; then + AC_MSG_CHECKING([SWIG version]) + > [swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed > 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`] + > AC_MSG_RESULT([$swig_version]) + if test -n "$swig_version" > ; then + # Calculate the required version number > components + [required=$1] + > [required_major=`echo $required | sed 's/[^0-9].*//'`] + > if test -z "$required_major" ; then + > [required_major=0] + fi + > [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] + > [required_minor=`echo $required | sed 's/[^0-9].*//'`] + > if test -z "$required_minor" ; then + > [required_minor=0] + fi + > [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] + > [required_patch=`echo $required | sed 's/[^0-9].*//'`] + > if test -z "$required_patch" ; then + > [required_patch=0] + fi + # > Calculate the available version number components + > [available=$swig_version] + [available_major=`echo > $available | sed 's/[^0-9].*//'`] + if test -z > "$available_major" ; then + > [available_major=0] + fi + > [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] + > [available_minor=`echo $available | sed 's/[^0-9].*//'`] + > if test -z "$available_minor" ; then + > [available_minor=0] + fi + > [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] + > [available_patch=`echo $available | sed 's/[^0-9].*//'`] + > if test -z "$available_patch" ; then + > [available_patch=0] + fi + # > Convert the version tuple into a single number for easier comparison. + > # Using base 100 should be safe since SWIG internally uses BCD values + > # to encode its version number. + > required_swig_vernum=`expr $required_major \* 10000 \ + > \+ $required_minor \* 100 \+ $required_patch` + > available_swig_vernum=`expr $available_major \* 10000 \ + > \+ $available_minor \* 100 \+ $available_patch` + + > if test $available_swig_vernum -lt $required_swig_vernum; then + > AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version.]) + > SWIG='' + m4_ifval([$3],[$3],[]) + > else + AC_MSG_CHECKING([for SWIG library]) + > SWIG_LIB=`$SWIG -swiglib` + > AC_MSG_RESULT([$SWIG_LIB]) + > m4_ifval([$2],[$2],[]) + fi + else + > AC_MSG_WARN([cannot determine SWIG version]) + > SWIG='' + m4_ifval([$3],[$3],[]) + > fi + fi + AC_SUBST([SWIG_LIB]) +]) diff --git a/configure.ac > b/configure.ac index 17e6b67..97167de 100644 --- a/configure.ac +++ > b/configure.ac @@ -154,6 +154,40 @@ AC_CHECK_LIB([c], [open_memstream], ] > ) > > +# For Python +# SWIG version needed or newer: +swig_version=2.0.0 + > +AC_ARG_ENABLE([python], + > [AC_HELP_STRING([--disable-python], + [do not > compile Python bindings])], + [], [enable_python=yes]) + > +AM_CONDITIONAL([USE_PYTHON], [test "x${enable_python:-yes}" = xyes]) + +if > test "x${enable_python:-yes}" = xyes; then + AC_MSG_NOTICE([You may > configure with --disable-python ]dnl +[if you do not need Python > bindings.]) + + AX_PKG_SWIG($swig_version, [], [ AC_MSG_ERROR([SWIG > $swig_version or newer is needed]) ]) + AM_PATH_PYTHON + + > AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for python, bypassing > python-config]) + AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config]) + > AS_IF([test -z "$PYTHON_INCLUDE"], [ + AS_IF([test -z "$PYTHON_CONFIG"], > [ + AC_PATH_PROGS([PYTHON_CONFIG], + > [python$PYTHON_VERSION-config python-config], + [no], + > [`dirname $PYTHON`]) + AS_IF([test "$PYTHON_CONFIG" = no], > [AC_MSG_ERROR([cannot find python-config for $PYTHON.])]) + ]) + > AC_MSG_CHECKING([python include flags]) + PYTHON_INCLUDE=`$PYTHON_CONFIG > --includes` + AC_MSG_RESULT([$PYTHON_INCLUDE]) + ]) +fi + # Option to > only build the consumer daemon and its libraries > AC_ARG_WITH([consumerd-only], AS_HELP_STRING([--with-consumerd-only],[Only > build the consumer daemon [default=no]]), @@ -214,6 +248,7 @@ > AC_CONFIG_FILES([ src/bin/lttng-sessiond/Makefile > src/bin/lttng-relayd/Makefile src/bin/lttng/Makefile + src/python/Makefile > tests/Makefile tests/kernel/Makefile tests/tools/Makefile @@ -260,6 +295,14 > @@ AS_IF([test "x$lttng_ust_support" = "xyes"],[ AS_ECHO("Disabled") ]) > > +#Python binding enabled/disabled +AS_ECHO_N("Python binding: ") > +AS_IF([test "x${enable_python:-yes}" = xyes], [ + AS_ECHO("Enabled") +],[ > + AS_ECHO("Disabled") +]) + # Do we build only the consumerd, or > everything AS_IF([test "x$consumerd_only" = "xyes"],[ AS_ECHO("Only the > consumerd daemon will be built.") diff --git a/src/Makefile.am > b/src/Makefile.am index 103337c..a65a5c1 100644 --- a/src/Makefile.am +++ > b/src/Makefile.am @@ -1 +1,5 @@ SUBDIRS = common lib bin + +if USE_PYTHON > +SUBDIRS += python +endif diff --git a/src/python/Makefile.am > b/src/python/Makefile.am new file mode 100644 index 0000000..b67d550 --- > /dev/null +++ b/src/python/Makefile.am @@ -0,0 +1,25 @@ +lttng.i: > lttng.i.in + sed "s/LTTNG_VERSION_STR/LTTng $(PACKAGE_VERSION)/g" > lttng.i + +AM_CFLAGS = -I$(PYTHONINC) -I../lib/lttng-ctl > -I../common \ + $(BUDDY_CFLAGS) + +EXTRA_DIST = lttng.i > +python_PYTHON = lttng.py +pyexec_LTLIBRARIES = _lttng.la + > +MAINTAINERCLEANFILES = lttng_wrap.c lttng.py + +_lttng_la_SOURCES = > lttng_wrap.c + +_lttng_la_LDFLAGS = -module + +_lttng_la_LIBADD = > ../lib/lttng-ctl/liblttng-ctl.la \ + > ../common/sessiond-comm/libsessiond-comm.la + +lttng_wrap.c: lttng.i + > $(SWIG) -python -I. -I$(top_srcdir)/src/common/sessiond-comm lttng.i + sed > -i "s/Python.h/python$(PYTHON_VERSION)\/Python.h/g" lttng_wrap.c + sed -i > "s/PyObject \*m, \*d, \*md;/PyObject \*m, \*d;\n#if > defined(SWIGPYTHON_BUILTIN)\nPyObject *md;\n#endif/g" lttng_wrap.c + sed -i > "s/md = d/d/g" lttng_wrap.c + sed -i > "s/(void)public_symbol;/(void)public_symbol;\n md = d;/g" lttng_wrap.c > diff --git a/src/python/lttng.i.in b/src/python/lttng.i.in new file mode > 100644 index 0000000..4f3cfeb --- /dev/null +++ b/src/python/lttng.i.in @@ > -0,0 +1,1023 @@ +%define DOCSTRING +"LTTNG_VERSION_STR + +The LTTng > project aims at providing highly efficient tracing tools for Linux. +It's > tracers help tracking down performance issues and debugging problems > involving +multiple concurrent processes and threads. Tracing across > multiple systems is also possible." +%enddef + > +%module(docstring=DOCSTRING) lttng + +%include "typemaps.i" +%include > "pyabc.i" +%{ +#define SWIG_FILE_WITH_INIT +#include +%} + > +typedef unsigned int uint32_t; +typedef int int32_t; +typedef unsigned > long long uint64_t; +typedef long pid_t; + + +// > ============================================= +// ENUMS +// > ============================================= + +%rename("DOMAIN_KERNEL") > LTTNG_DOMAIN_KERNEL; +%rename("DOMAIN_UST") LTTNG_DOMAIN_UST; +enum > lttng_domain_type { + LTTNG_DOMAIN_KERNEL = 1, + > LTTNG_DOMAIN_UST = 2, +}; + +%rename("EVENT_ALL") > LTTNG_EVENT_ALL; +%rename("EVENT_TRACEPOINT") LTTNG_EVENT_TRACEPOINT; > +%rename("EVENT_PROBE") LTTNG_EVENT_PROBE; > +%rename("EVENT_FUNCTION")LTTNG_EVENT_FUNCTION; > +%rename("EVENT_FUNCTION_ENTRY") LTTNG_EVENT_FUNCTION_ENTRY; > +%rename("EVENT_NOOP") LTTNG_EVENT_NOOP; +%rename("EVENT_SYSCALL") > LTTNG_EVENT_SYSCALL; +enum lttng_event_type { + 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, +}; + > +%rename("EVENT_LOGLEVEL_ALL") LTTNG_EVENT_LOGLEVEL_ALL; > +%rename("EVENT_LOGLEVEL_RANGE") LTTNG_EVENT_LOGLEVEL_RANGE; > +%rename("EVENT_LOGLEVEL_SINGLE") LTTNG_EVENT_LOGLEVEL_SINGLE; +enum > lttng_loglevel_type { + LTTNG_EVENT_LOGLEVEL_ALL = 0, + > LTTNG_EVENT_LOGLEVEL_RANGE = 1, + LTTNG_EVENT_LOGLEVEL_SINGLE > = 2, +}; + +%rename("LOGLEVEL_EMERG") LTTNG_LOGLEVEL_EMERG; > +%rename("LOGLEVEL_ALERT") LTTNG_LOGLEVEL_ALERT; +%rename("LOGLEVEL_CRIT") > LTTNG_LOGLEVEL_CRIT; +%rename("LOGLEVEL_ERR") LTTNG_LOGLEVEL_ERR; > +%rename("LOGLEVEL_WARNING") LTTNG_LOGLEVEL_WARNING; > +%rename("LOGLEVEL_NOTICE") LTTNG_LOGLEVEL_NOTICE; > +%rename("LOGLEVEL_INFO") LTTNG_LOGLEVEL_INFO; > +%rename("LOGLEVEL_DEBUG_SYSTEM") LTTNG_LOGLEVEL_DEBUG_SYSTEM; > +%rename("LOGLEVEL_DEBUG_PROGRAM") LTTNG_LOGLEVEL_DEBUG_PROGRAM; > +%rename("LOGLEVEL_DEBUG_PROCESS") LTTNG_LOGLEVEL_DEBUG_PROCESS; > +%rename("LOGLEVEL_DEBUG_MODULE") LTTNG_LOGLEVEL_DEBUG_MODULE; > +%rename("LOGLEVEL_DEBUG_UNIT") LTTNG_LOGLEVEL_DEBUG_UNIT; > +%rename("LOGLEVEL_DEBUG_FUNCTION") LTTNG_LOGLEVEL_DEBUG_FUNCTION; > +%rename("LOGLEVEL_DEBUG_LINE") LTTNG_LOGLEVEL_DEBUG_LINE; > +%rename("LOGLEVEL_DEBUG") LTTNG_LOGLEVEL_DEBUG; +enum lttng_loglevel { + > LTTNG_LOGLEVEL_EMERG = 0, + LTTNG_LOGLEVEL_ALERT > = 1, + LTTNG_LOGLEVEL_CRIT = 2, + > LTTNG_LOGLEVEL_ERR = 3, + LTTNG_LOGLEVEL_WARNING > = 4, + LTTNG_LOGLEVEL_NOTICE = 5, + > LTTNG_LOGLEVEL_INFO = 6, + > LTTNG_LOGLEVEL_DEBUG_SYSTEM = 7, + > LTTNG_LOGLEVEL_DEBUG_PROGRAM = 8, + > LTTNG_LOGLEVEL_DEBUG_PROCESS = 9, + > LTTNG_LOGLEVEL_DEBUG_MODULE = 10, + > LTTNG_LOGLEVEL_DEBUG_UNIT = 11, + > LTTNG_LOGLEVEL_DEBUG_FUNCTION = 12, + > LTTNG_LOGLEVEL_DEBUG_LINE = 13, + LTTNG_LOGLEVEL_DEBUG > = 14, +}; + +%rename("EVENT_SPLICE") LTTNG_EVENT_SPLICE; > +%rename("EVENT_MMAP") LTTNG_EVENT_MMAP; +enum lttng_event_output { + > LTTNG_EVENT_SPLICE = 0, + LTTNG_EVENT_MMAP > = 1, +}; + +%rename("EVENT_CONTEXT_PID") LTTNG_EVENT_CONTEXT_PID; > +%rename("EVENT_CONTEXT_PERF_COUNTER") LTTNG_EVENT_CONTEXT_PERF_COUNTER; > +%rename("EVENT_CONTEXT_PROCNAME") LTTNG_EVENT_CONTEXT_PROCNAME; > +%rename("EVENT_CONTEXT_PRIO") LTTNG_EVENT_CONTEXT_PRIO; > +%rename("EVENT_CONTEXT_NICE") LTTNG_EVENT_CONTEXT_NICE; > +%rename("EVENT_CONTEXT_VPID") LTTNG_EVENT_CONTEXT_VPID; > +%rename("EVENT_CONTEXT_TID") LTTNG_EVENT_CONTEXT_TID; > +%rename("EVENT_CONTEXT_VTID") LTTNG_EVENT_CONTEXT_VTID; > +%rename("EVENT_CONTEXT_PPID") LTTNG_EVENT_CONTEXT_PPID; > +%rename("EVENT_CONTEXT_VPPID") LTTNG_EVENT_CONTEXT_VPPID; > +%rename("EVENT_CONTEXT_PTHREAD_ID") LTTNG_EVENT_CONTEXT_PTHREAD_ID; +enum > lttng_event_context_type { + LTTNG_EVENT_CONTEXT_PID = 0, + > LTTNG_EVENT_CONTEXT_PERF_COUNTER = 1, + LTTNG_EVENT_CONTEXT_PROCNAME > = 2, + LTTNG_EVENT_CONTEXT_PRIO = 3, + > LTTNG_EVENT_CONTEXT_NICE = 4, + LTTNG_EVENT_CONTEXT_VPID > = 5, + LTTNG_EVENT_CONTEXT_TID = 6, + > LTTNG_EVENT_CONTEXT_VTID = 7, + LTTNG_EVENT_CONTEXT_PPID > = 8, + LTTNG_EVENT_CONTEXT_VPPID = 9, + > LTTNG_EVENT_CONTEXT_PTHREAD_ID = 10, +}; + > +%rename("CALIBRATE_FUNCTION") LTTNG_CALIBRATE_FUNCTION; +enum > lttng_calibrate_type { + LTTNG_CALIBRATE_FUNCTION = 0, +}; + > + + +// ============================================= +// TYPEMAPS +// > ============================================= + +//list_sessions > +%typemap(argout) struct lttng_session **sessions{ + + int l = > PyInt_AsSsize_t($result); + if (l >= 0) + { + PyObject *sessions = > PyList_New(0); + int i; + for(i=0; i PyTuple_New(4); + PyObject *name = PyString_FromString((*$1)[i].name); + > PyObject *path = PyString_FromString((*$1)[i].path); + PyObject *enabled > = PyInt_FromSize_t((*$1)[i].enabled); + PyObject *padding = > PyString_FromString((*$1)[i].padding); + + PyTuple_SetItem(tmp, 0, > name); + PyTuple_SetItem(tmp, 1, path); + PyTuple_SetItem(tmp, 2, > enabled); + PyTuple_SetItem(tmp, 3, padding); + PyList_Append(sessions, > tmp); + } + $result = sessions; + } +} +%typemap(in,numinputs=0) struct > lttng_session **sessions (struct lttng_session *temp){ + $1=&temp; +} + > +//list_domains +%typemap(argout) struct lttng_domain **domains{ + + int l > = PyInt_AsSsize_t($result); + if (l >= 0) + { + PyObject *dom = > PyList_New(0); + int i; + for(i=0; i PyTuple_New(5); + PyObject *type = PyInt_FromSize_t((*$1)[i].type); + > PyObject *execname = PyString_FromString((*$1)[i].attr.exec_name); + > PyObject *pid = PyInt_FromSize_t((*$1)[i].attr.pid); + PyObject *padding > = PyString_FromString((*$1)[i].padding); + PyObject *attrpadding = > PyString_FromString((*$1)[i].attr.padding); + + PyTuple_SetItem(tmp, 0, > type); + PyTuple_SetItem(tmp, 1, padding); + PyTuple_SetItem(tmp, 2, > pid); + PyTuple_SetItem(tmp, 3, execname); + PyTuple_SetItem(tmp, 4, > attrpadding); + PyList_Append(dom, tmp); + } + $result = dom; + } +} > +%typemap(in,numinputs=0) struct lttng_domain **domains (struct > lttng_domain *temp){ + $1=&temp; +} + +//list_channels +%typemap(argout) > struct lttng_channel **channels{ + + int l = PyInt_AsSsize_t($result); + if > (l >= 0) + { + PyObject *chan = PyList_New(0); + int i; + for(i=0; i i++) + { + PyObject *tmp = PyTuple_New(4); + PyObject *name = > PyString_FromString((*$1)[i].name); + PyObject *enabled = > PyInt_FromSize_t((*$1)[i].enabled); + PyObject *padding = > PyString_FromString((*$1)[i].padding); + + PyObject *attrtmp = > PyTuple_New(7); + PyObject *overwrite = > PyInt_FromLong((*$1)[i].attr.overwrite); + PyObject *subbuf = > PyInt_FromSize_t((*$1)[i].attr.subbuf_size); + PyObject *num = > PyInt_FromSize_t((*$1)[i].attr.num_subbuf); + PyObject *switchtimer = > PyInt_FromSize_t((*$1)[i].attr.switch_timer_interval); + PyObject > *readtimer = PyInt_FromSize_t((*$1)[i].attr.read_timer_interval); + > PyObject *output = PyInt_FromSize_t((*$1)[i].attr.output); + PyObject > *attrpad = PyString_FromString((*$1)[i].attr.padding); + + > PyTuple_SetItem(attrtmp, 0, overwrite); + PyTuple_SetItem(attrtmp, 1, > subbuf); + PyTuple_SetItem(attrtmp, 2, num); + PyTuple_SetItem(attrtmp, > 3, switchtimer); + PyTuple_SetItem(attrtmp, 4, readtimer); + > PyTuple_SetItem(attrtmp, 5, output); + PyTuple_SetItem(attrtmp, 6, > attrpad); + + PyTuple_SetItem(tmp, 0, name); + PyTuple_SetItem(tmp, 1, > enabled); + PyTuple_SetItem(tmp, 2, padding); + PyTuple_SetItem(tmp, 3, > attrtmp); + PyList_Append(chan, tmp); + } + $result = chan; + } +} > +%typemap(in,numinputs=0) struct lttng_channel **channels (struct > lttng_channel *temp){ + $1=&temp; +} + +//list_events & list_tracepoints > +%typemap(argout) struct lttng_event **events{ + + int l = > PyInt_AsSsize_t($result); + if (l >= 0) + { + PyObject *events = > PyList_New(0); + int i; + for(i=0; i PyTuple_New(10); + PyObject *name = PyString_FromString((*$1)[i].name); + > PyObject *type = PyInt_FromSize_t((*$1)[i].type); + PyObject > *logleveltype = PyInt_FromSize_t((*$1)[i].loglevel_type); + PyObject > *loglevel = PyInt_FromLong((*$1)[i].loglevel); + PyObject *enabled = > PyInt_FromLong((*$1)[i].enabled); + PyObject *pid = > PyInt_FromSize_t((*$1)[i].pid); + PyObject *padding = > PyString_FromString((*$1)[i].padding); + PyObject *attrpadding = > PyString_FromString((*$1)[i].attr.padding); + + PyObject *probe = > PyTuple_New(4); + PyObject *addr = > PyInt_FromSize_t((*$1)[i].attr.probe.addr); + PyObject *offset = > PyInt_FromSize_t((*$1)[i].attr.probe.offset); + PyObject *symbolname = > PyString_FromString((*$1)[i].attr.probe.symbol_name); + PyObject > *probepad = PyString_FromString((*$1)[i].attr.probe.padding); + + > PyObject *function = PyTuple_New(2); + PyObject *f_symbolname = > PyString_FromString((*$1)[i].attr.ftrace.symbol_name); + PyObject *f_pad > = PyString_FromString((*$1)[i].attr.ftrace.padding); + + > PyTuple_SetItem(function, 0, f_symbolname); + PyTuple_SetItem(function, > 1, f_pad); + + PyTuple_SetItem(probe, 0, addr); + > PyTuple_SetItem(probe, 1, offset); + PyTuple_SetItem(probe, 2, > symbolname); + PyTuple_SetItem(probe, 3, probepad); + + > PyTuple_SetItem(tmp, 0, name); + PyTuple_SetItem(tmp, 1, type); + > PyTuple_SetItem(tmp, 2, logleveltype); + PyTuple_SetItem(tmp, 3, > loglevel); + PyTuple_SetItem(tmp, 4, enabled); + PyTuple_SetItem(tmp, > 5, pid); + PyTuple_SetItem(tmp, 6, padding); + PyTuple_SetItem(tmp, 7, > probe); + PyTuple_SetItem(tmp, 8, function); + PyTuple_SetItem(tmp, 9, > attrpadding); + PyList_Append(events, tmp); + } + $result = events; + > } +} +%typemap(in,numinputs=0) struct lttng_event **events (struct > lttng_event *temp){ + $1=&temp; +} + + + +// > ============================================= +// FUNCTIONS +// > ============================================= + +%rename("create") > lttng_create_session(const char *name, const char *path); > +%rename("destroy") lttng_destroy_session(const char *name); > +%rename("_lttng_create_handle") lttng_create_handle(const char > *session_name, struct lttng_domain *domain); > +%rename("_lttng_destroy_handle") lttng_destroy_handle(struct lttng_handle > *handle); +%rename("_lttng_list_sessions") lttng_list_sessions(struct > lttng_session **sessions); +%rename("_lttng_list_domains") > lttng_list_domains(const char *session_name, struct lttng_domain > **domains); +%rename("_lttng_list_channels") lttng_list_channels(struct > lttng_handle *handle,struct lttng_channel **channels); > +%rename("_lttng_list_events") lttng_list_events(struct lttng_handle > *handle, const char *channel_name, struct lttng_event **events); > +%rename("_lttng_list_tracepoints") lttng_list_tracepoints(struct > lttng_handle *handle, struct lttng_event **events); > +%rename("session_daemon_alive") lttng_session_daemon_alive(void); > +%rename("set_tracing_group") lttng_set_tracing_group(const char *name); > +%rename("strerror") lttng_strerror(int code); > +%rename("_lttng_register_consumer") lttng_register_consumer(struct > lttng_handle *handle, const char *socket_path); +%rename("start") > lttng_start_tracing(const char *session_name); +%rename("stop") > lttng_stop_tracing(const char *session_name); > +%rename("_lttng_add_context") lttng_add_context(struct lttng_handle > *handle, struct lttng_event_context *ctx, const char *event_name, const > char *channel_name); +%rename("_lttng_enable_event") > lttng_enable_event(struct lttng_handle *handle, struct lttng_event *ev, > const char *channel_name); +%rename("_lttng_enable_channel") > lttng_enable_channel(struct lttng_handle *handle, struct lttng_channel > *chan); +%rename("_lttng_disable_event") lttng_disable_event(struct > lttng_handle *handle, const char *name, const char *channel_name); > +%rename("_lttng_disable_channel") lttng_disable_channel(struct > lttng_handle *handle, const char *name); +%rename("_lttng_calibrate") > lttng_calibrate(struct lttng_handle *handle, struct lttng_calibrate > *calibrate); +%rename("channel_set_default_attr") > lttng_channel_set_default_attr(struct lttng_domain *domain, struct > lttng_channel_attr *attr); + +//Redefined functions +struct lttng_handle > *lttng_create_handle(const char *session_name, + struct lttng_domain > *domain); +void lttng_destroy_handle(struct lttng_handle *handle); +int > lttng_list_channels(struct lttng_handle *handle,struct lttng_channel > **channels); +int lttng_list_events(struct lttng_handle *handle, + const > char *channel_name, struct lttng_event **events); +int > lttng_list_tracepoints(struct lttng_handle *handle, struct lttng_event > **events); +int lttng_add_context(struct lttng_handle *handle, struct > lttng_event_context *ctx, + const char *event_name, const char > *channel_name); +int lttng_enable_event(struct lttng_handle *handle, + > struct lttng_event *ev, const char *channel_name); +int > lttng_enable_channel(struct lttng_handle *handle, struct lttng_channel > *chan); +int lttng_disable_event(struct lttng_handle *handle, + const char > *name, const char *channel_name); +int lttng_disable_channel(struct > lttng_handle *handle, const char *name); +int lttng_calibrate(struct > lttng_handle *handle, struct lttng_calibrate *calibrate); +int > lttng_register_consumer(struct lttng_handle *handle, const char > *socket_path); +int lttng_list_sessions(struct lttng_session **sessions); > +int lttng_list_domains(const char *session_name, struct lttng_domain > **domains); + +//Functions not needing redefinition > +%feature("docstring")"create(str name, str path) -> int + +Create a new > tracing session using name and path. +Returns size of returned session > payload data or a negative error code." +int lttng_create_session(const > char *name, const char *path); + + +%feature("docstring")"destroy(str name) > -> int + +Tear down tracing session using name. +Returns size of returned > session payload data or a negative error code." +int > lttng_destroy_session(const char *name); + + > +%feature("docstring")"session_daemon_alive() -> int + +Check if session > daemon is alive. +Return 1 if alive or 0 if not. +On error returns a > negative value." +int lttng_session_daemon_alive(void); + + > +%feature("docstring")"set_tracing_group(str name) -> int + +Sets the > tracing_group variable with name. +This function allocates memory pointed > to by tracing_group. +On success, returns 0, on error, returns -1 (null > name) or -ENOMEM." +int lttng_set_tracing_group(const char *name); + + > +%feature("docstring")"strerror(int code) -> char + +Returns a human > readable string describing +the error code (a negative value)." +const char > *lttng_strerror(int code); + + +%feature("docstring")"start(str > session_name) -> int + +Start tracing for all traces of the session. > +Returns size of returned session payload data or a negative error code." > +int lttng_start_tracing(const char *session_name); + + > +%feature("docstring")"stop(str session_name) -> int + +Stop tracing for > all traces of the session. +Returns size of returned session payload data > or a negative error code." +int lttng_stop_tracing(const char > *session_name); + + +%feature("docstring")"channel_set_default_attr(Domain > domain, ChannelAttr attr) + +Set default channel attributes. +If either or > both of the arguments are null, attr content is zeroe'd." +void > lttng_channel_set_default_attr(struct lttng_domain *domain, struct > lttng_channel_attr *attr); + + +// > ============================================= +// Python redefinition of > some functions +// (List and Handle-related) +// > ============================================= + +%feature("docstring")"" > +%pythoncode %{ + +def list_sessions(): + """ + list_sessions() -> dict + + > Ask the session daemon for all available sessions. + Returns a dict of > Session instances, the key is the name; + on error, returns a negative > value. + """ + + ses_list = _lttng_list_sessions() + if type(ses_list) is > int: + return ses_list + + sessions = {} + + for ses_elements in > ses_list: + ses = Session() + ses.name = ses_elements[0] + ses.path = > ses_elements[1] + ses.enabled = ses_elements[2] + ses.padding = > ses_elements[3] + + sessions[ses.name] = ses + + return sessions + + +def > list_domains(session_name): + """ + list_domains(str session_name) -> list > + + Ask the session daemon for all available domains of a session. + > Returns a list of Domain instances; + on error, returns a negative value. + > """ + + dom_list = _lttng_list_domains(session_name) + if type(dom_list) is > int: + return dom_list + + domains = [] + + for dom_elements in dom_list: > + dom = Domain() + dom.type = dom_elements[0] + dom.paddinf = > dom_elements[1] + dom.attr.pid = dom_elements[2] + dom.attr.exec_name = > dom_elements[3] + dom.attr.padding = dom_elements[4] + + > domains.append(dom) + + return domains + + +def list_channels(handle): + > """ + list_channels(Handle handle) -> dict + + Ask the session daemon for > all available channels of a session. + Returns a dict of Channel instances, > the key is the name; + on error, returns a negative value. + """ + + try: + > chan_list = _lttng_list_channels(handle._h) + except AttributeError: + > raise TypeError("in method 'list_channels', argument 1 must be a Handle > instance") + + if type(chan_list) is int: + return chan_list + + channels > = {} + + for channel_elements in chan_list: + chan = Channel() + > chan.name = channel_elements[0] + chan.enabled = channel_elements[1] + > chan.padding = channel_elements[2] + chan.attr.overwrite = > channel_elements[3][0] + chan.attr.subbuf_size = channel_elements[3][1] + > chan.attr.num_subbuf = channel_elements[3][2] + > chan.attr.switch_timer_interval = channel_elements[3][3] + > chan.attr.read_timer_interval = channel_elements[3][4] + chan.attr.output > = channel_elements[3][5] + chan.attr.padding = channel_elements[3][6] + + > channels[chan.name] = chan + + return channels + + +def list_events(handle, > channel_name): + """ + list_events(Handle handle, str channel_name) -> > dict + + Ask the session daemon for all available events of a session > channel. + Returns a dict of Event instances, the key is the name; + on > error, returns a negative value. + """ + + try: + ev_list = > _lttng_list_events(handle._h, channel_name) + except AttributeError: + > raise TypeError("in method 'list_events', argument 1 must be a Handle > instance") + + if type(ev_list) is int: + return ev_list + + events = {} > + + for ev_elements in ev_list: + ev = Event() + ev.name = > ev_elements[0] + ev.type = ev_elements[1] + ev.loglevel_type = > ev_elements[2] + ev.loglevel = ev_elements[3] + ev.enabled = > ev_elements[4] + ev.pid = ev_elements[5] + ev.attr.padding = > ev_elements[6] + ev.attr.probe.addr = ev_elements[7][0] + > ev.attr.probe.offset = ev_elements[7][1] + ev.attr.probe.symbol_name = > ev_elements[7][2] + ev.attr.probe.padding = ev_elements[7][3] + > ev.attr.ftrace.symbol_name = ev_elements[8][0] + ev.attr.ftrace.padding = > ev_elements[8][1] + ev.attr.padding = ev_elements[9] + + events[ev.name] > = ev + + return events + + +def list_tracepoints(handle): + """ + > list_tracepoints(Handle handle) -> dict + + Returns a dict of Event > instances, the key is the name; + on error, returns a negative value. + > """ + + try: + ev_list = _lttng_list_tracepoints(handle._h) + except > AttributeError: + raise TypeError("in method 'list_tracepoints', argument > 1 must be a Handle instance") + + if type(ev_list) is int: + return > ev_list + + events = {} + + for ev_elements in ev_list: + ev = Event() + > ev.name = ev_elements[0] + ev.type = ev_elements[1] + ev.loglevel_type = > ev_elements[2] + ev.loglevel = ev_elements[3] + ev.enabled = > ev_elements[4] + ev.pid = ev_elements[5] + ev.attr.padding = > ev_elements[6] + ev.attr.probe.addr = ev_elements[7][0] + > ev.attr.probe.offset = ev_elements[7][1] + ev.attr.probe.symbol_name = > ev_elements[7][2] + ev.attr.probe.padding = ev_elements[7][3] + > ev.attr.ftrace.symbol_name = ev_elements[8][0] + ev.attr.ftrace.padding = > ev_elements[8][1] + ev.attr.padding = ev_elements[9] + + events[ev.name] > = ev + + return events + + +def register_consumer(handle, socket_path): + > """ + register_consumer(Handle handle, str socket_path) -> int + + Register > an outside consumer. + Returns size of returned session payload data or a > negative error code. + """ + + try: + return > _lttng_register_consumer(handle._h, socket_path) + except AttributeError: + > raise TypeError("in method 'register_consumer', argument 1 must be a Handle > instance") + + +def add_context(handle, event_context, event_name, > channel_name): + """ + add_context(Handle handle, EventContext ctx, + > str event_name, str channel_name) -> int + + Add context to event and/or > channel. + If event_name is None, the context is applied to all events of > the channel. + If channel_name is None, a lookup of the event's channel is > done. + If both are None, the context is applied to all events of all > channels. + Returns the size of the returned payload data or a negative > error code. + """ + + try: + return _lttng_add_context(handle._h, > event_context, event_name, channel_name) + except AttributeError: + raise > TypeError("in method 'add_context', argument 1 must be a Handle instance") > + + +def enable_event(handle, event, channel_name): + """ + > enable_event(Handle handle, Event event, + str channel_name) -> int + > + Enable event(s) for a channel. + If no event name is specified, all > events are enabled. + If no channel name is specified, the default > 'channel0' is used. + Returns size of returned session payload data or a > negative error code. + """ + + try: + return > _lttng_enable_event(handle._h, event, channel_name) + except > AttributeError: + raise TypeError("in method 'enable_event', argument 1 > must be a Handle instance") + + +def enable_channel(handle, channel): + > """ + enable_channel(Handle handle, Channel channel -> int + + Enable > channel per domain + Returns size of returned session payload data or a > negative error code. + """ + + try: + return > _lttng_enable_channel(handle._h, channel) + except AttributeError: + raise > TypeError("in method 'enable_channel', argument 1 must be a Handle > instance") + + +def disable_event(handle, name, channel_name): + """ + > disable_event(Handle handle, str name, str channel_name) -> int + + Disable > event(s) of a channel and domain. + If no event name is specified, all > events are disabled. + If no channel name is specified, the default > 'channel0' is used. + Returns size of returned session payload data or a > negative error code + """ + + try: + return > _lttng_disable_event(handle._h, name, channel_name) + except > AttributeError: + raise TypeError("in method 'disable_event', argument 1 > must be a Handle instance") + + +def disable_channel(handle, name): + """ + > disable_channel(Handle handle, str name) -> int + + All tracing will be > stopped for registered events of the channel. + Returns size of returned > session payload data or a negative error code. + """ + + try: + return > _lttng_disable_channel(handle._h, name) + except AttributeError: + raise > TypeError("in method 'disable_channel', argument 1 must be a Handle > instance") + + +def calibrate(handle, calibrate): + """ + calibrate(Handle > handle, Calibrate calibrate) -> int + + Quantify LTTng overhead. + Returns > size of returned session payload data or a negative error code. + """ + + > try: + return _lttng_calibrate(handle._h, calibrate) + except > AttributeError: + raise TypeError("in method 'calibrate', argument 1 must > be a Handle instance") +%} + + +// > ============================================= +// Handle class +// Used > to prevent freeing unallocated memory +// > ============================================= + +%feature("docstring")"" > +%feature("autodoc", "1"); + +%pythoncode %{ +class Handle: + """ + > Manages a handle. + Takes two arguments: (str session_name, Domain domain) > + """ + + __frozen = False + + def __init__(self, session_name, domain): + > if type(session_name) is not str: + raise TypeError("in method > '__init__', argument 2 of type 'str'") + if type(domain) is not Domain and > domain is not None: + raise TypeError("in method '__init__', argument 3 > of type 'lttng.Domain'") + + self._sname = session_name + if domain is > None: + self._domtype = None + else: + self._domtype = domain.type + > self._h = _lttng_create_handle(session_name, domain) + self.__frozen = > True + + def __del__(self): + _lttng_destroy_handle(self._h) + + def > __repr__(self): + if self._domtype == 1: + domstr = "DOMAIN_KERNEL" + > elif self._domtype == 2: + domstr = "DOMAIN_UST" + else: + domstr = > self._domtype + + return "lttng.Handle; session('{}'), > domain.type({})".format( + self._sname, domstr) + + def __setattr__(self, > attr, val): + if self.__frozen: + raise NotImplementedError("cannot > modify attributes") + else: + self.__dict__[attr] = val +%} + + +// > ============================================= +// STRUCTURES +// > ============================================= + +%rename("Domain") > lttng_domain; +%rename("EventContext") lttng_event_context; > +%rename("Event") lttng_event; +%rename("Calibrate") lttng_calibrate; > +%rename("ChannelAttr") lttng_channel_attr; +%rename("Channel") > lttng_channel; +%rename("Session") lttng_session; + +struct lttng_domain{ + > enum lttng_domain_type type; + char padding[LTTNG_DOMAIN_PADDING1]; + + > union { + pid_t pid; + char exec_name[NAME_MAX]; + char > padding[LTTNG_DOMAIN_PADDING2]; + } attr; + + %extend { + char > *__repr__() { + static char temp[256]; + switch ( $self->type ) { + > case 1: + sprintf(temp, "lttng.Domain; type(DOMAIN_KERNEL)"); + > break; + case 2: + sprintf(temp, "lttng.Domain; type(DOMAIN_UST)"); + > break; + default: + sprintf(temp, "lttng.Domain; type(%i)", > $self->type); + break; + } + return &temp[0]; + } + } +}; + +struct > lttng_event_context { + enum lttng_event_context_type ctx; + char > padding[LTTNG_EVENT_CONTEXT_PADDING1]; + + union { + struct > lttng_event_perf_counter_ctx perf_counter; + char > padding[LTTNG_EVENT_CONTEXT_PADDING2]; + } u; + + %extend { + char > *__repr__() { + static char temp[256]; + switch ( $self->ctx ) { + > case 0: + sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_PID)"); + > break; + case 1: + sprintf(temp, "lttng.EventContext; > ctx(EVENT_CONTEXT_PERF_COUNTER)"); + break; + case 2: + > sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_PROCNAME)"); + > break; + case 3: + sprintf(temp, "lttng.EventContext; > ctx(EVENT_CONTEXT_PRIO)"); + break; + case 4: + sprintf(temp, > "lttng.EventContext; ctx(EVENT_CONTEXT_NICE)"); + break; + case 5: + > sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_VPID)"); + break; + > case 6: + sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_TID)"); + > break; + case 7: + sprintf(temp, "lttng.EventContext; > ctx(EVENT_CONTEXT_VTID)"); + break; + case 8: + sprintf(temp, > "lttng.EventContext; ctx(EVENT_CONTEXT_PPID)"); + break; + case 9: + > sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_VPPID)"); + break; > + case 10: + sprintf(temp, "lttng.EventContext; > ctx(EVENT_CONTEXT_PTHREAD_ID)"); + break; + default: + > sprintf(temp, "lttng.EventContext; type(%i)", $self->ctx); + break; + > } + return &temp[0]; + } + } +}; + +struct lttng_event_probe_attr { + > uint64_t addr; + uint64_t offset; + char > symbol_name[LTTNG_SYMBOL_NAME_LEN]; + char > padding[LTTNG_EVENT_PROBE_PADDING1]; +}; + +struct > lttng_event_function_attr { + char symbol_name[LTTNG_SYMBOL_NAME_LEN]; + > char padding[LTTNG_EVENT_FUNCTION_PADDING1]; +}; + +struct lttng_event { + > enum lttng_event_type type; + char name[LTTNG_SYMBOL_NAME_LEN]; + + enum > lttng_loglevel_type loglevel_type; + int loglevel; + + int32_t enabled; + > pid_t pid; + + char padding[LTTNG_EVENT_PADDING1]; + + union { + struct > lttng_event_probe_attr probe; + struct lttng_event_function_attr ftrace; > + + char padding[LTTNG_EVENT_PADDING2]; + } attr; + + %extend { + char > *__repr__() { + static char temp[512]; + char evtype[50]; + char > logtype[50]; + + switch ( $self->type ) { + case -1: + > sprintf(evtype, "EVENT_ALL"); + break; + case 0: + sprintf(evtype, > "EVENT_TRACEPOINT"); + break; + case 1: + sprintf(evtype, > "EVENT_PROBE"); + break; + case 2: + sprintf(evtype, > "EVENT_FUNCTION"); + break; + case 3: + sprintf(evtype, > "EVENT_FUNCTION_ENTRY"); + break; + case 4: + sprintf(evtype, > "EVENT_NOOP"); + break; + case 5: + sprintf(evtype, > "EVENT_SYSCALL"); + break; + default: + sprintf(evtype, "%i", > $self->type); + break; + } + + switch ( $self->loglevel_type ) { + > case 0: + sprintf(logtype, "EVENT_LOGLEVEL_ALL"); + break; + case > 1: + sprintf(logtype, "EVENT_LOGLEVEL_RANGE"); + break; + case 2: + > sprintf(logtype, "EVENT_LOGLEVEL_SINGLE"); + break; + default: + > sprintf(logtype, "%i", $self->loglevel_type); + break; + } + + > sprintf(temp, "lttng.Event; name('%s'), type(%s), " + > "loglevel_type(%s), loglevel(%i), " + "enabled(%s), pid(%i)", + > $self->name, evtype, logtype, $self->loglevel, + $self->enabled ? "True" > : "False", $self->pid); + return &temp[0]; + } + } +}; + +struct > lttng_calibrate { + enum lttng_calibrate_type type; + char > padding[LTTNG_CALIBRATE_PADDING1]; + + %extend { + char *__repr__() { + > static char temp[256]; + switch ( $self->type ) { + case 0: + > sprintf(temp, "lttng.Calibrate; type(CALIBRATE_FUNCTION)"); + break; + > default: + sprintf(temp, "lttng.Calibrate; type(%i)", $self->type); + > break; + } + return &temp[0]; + } + } +}; + +struct lttng_channel_attr > { + int overwrite; + uint64_t subbuf_size; + uint64_t num_subbuf; + > unsigned int switch_timer_interval; + unsigned int read_timer_interval; + > enum lttng_event_output output; + + char > padding[LTTNG_CHANNEL_ATTR_PADDING1]; + + %extend { + char *__repr__() { > + static char temp[256]; + char evout[25]; + + switch ( $self->output > ) { + case 0: + sprintf(evout, "EVENT_SPLICE"); + break; + case > 1: + sprintf(evout, "EVENT_MMAP"); + break; + default: + > sprintf(evout, "%i", $self->output); + break; + } + sprintf(temp, > "lttng.ChannelAttr; overwrite(%i), subbuf_size(%lu), " + > "num_subbuf(%lu), switch_timer_interval(%u), " + > "read_timer_interval(%u), output(%s)", + $self->overwrite, > $self->subbuf_size, $self->num_subbuf, + $self->switch_timer_interval, > $self->read_timer_interval, + evout); + return &temp[0]; + } + } +}; > + +struct lttng_channel { + char name[LTTNG_SYMBOL_NAME_LEN]; + uint32_t > enabled; + struct lttng_channel_attr attr; + char > padding[LTTNG_CHANNEL_PADDING1]; + + %extend { + char *__repr__() { + > static char temp[512]; + sprintf(temp, "lttng.Channel; name('%s'), > enabled(%s)", + $self->name, $self->enabled ? "True" : "False"); + > return &temp[0]; + } + } +}; + +struct lttng_session { + char > name[NAME_MAX]; + char path[PATH_MAX]; + uint32_t enabled; + char > padding[LTTNG_SESSION_PADDING1]; + + %extend { + char *__repr__() { + > static char temp[512]; + sprintf(temp, "lttng.Session; name('%s'), > path('%s'), enabled(%s)", + $self->name, $self->path, + > $self->enabled ? "True" : "False"); + return &temp[0]; + } + } +}; diff > --git a/src/python/tests/example.py b/src/python/tests/example.py new file > mode 100644 index 0000000..9703170 --- /dev/null +++ > b/src/python/tests/example.py @@ -0,0 +1,109 @@ +#This example shows > basically how to use the lttng-tools python module + +from lttng import * > + +# This error will be raised is something goes wrong +class > LTTngError(Exception): + def __init__(self, value): + self.value = value + > def __str__(self): + return repr(self.value) + +#Setting up the domain to > use +dom = Domain() +dom.type = DOMAIN_KERNEL + +#Setting up a channel to > use +channel = Channel() +channel.name = "mychan" +channel.attr.overwrite = > 0 +channel.attr.subbuf_size = 4096 +channel.attr.num_subbuf = 8 > +channel.attr.switch_timer_interval = 0 +channel.attr.read_timer_interval = > 200 +channel.attr.output = EVENT_SPLICE + +#Setting up some events that > will be used +event = Event() +event.type = EVENT_TRACEPOINT > +event.loglevel_type = EVENT_LOGLEVEL_ALL + +sched_switch = Event() > +sched_switch.name = "sched_switch" +sched_switch.type = EVENT_TRACEPOINT > +sched_switch.loglevel_type = EVENT_LOGLEVEL_ALL + +sched_process_exit = > Event() +sched_process_exit.name = "sched_process_exit" > +sched_process_exit.type = EVENT_TRACEPOINT > +sched_process_exit.loglevel_type = EVENT_LOGLEVEL_ALL + > +sched_process_free = Event() +sched_process_free.name = > "sched_process_free" +sched_process_free.type = EVENT_TRACEPOINT > +sched_process_free.loglevel_type = EVENT_LOGLEVEL_ALL + + +#Creating a new > session +res = create("test","/lttng-traces/test") +if res<0: + raise > LTTngError(strerror(res)) + +#Creating handle +han = None +han = > Handle("test", dom) +if han is None: + raise LTTngError("Handle not > created") + +#Enabling the kernel channel +res = enable_channel(han, > channel) +if res<0: + raise LTTngError(strerror(res)) + +#Enabling some > events in given channel +#To enable all events in default channel, use > +#enable_event(han, event, None) +res = enable_event(han, sched_switch, > channel.name) +if res<0: + raise LTTngError(strerror(res)) + +res = > enable_event(han, sched_process_exit, channel.name) +if res<0: + raise > LTTngError(strerror(res)) + +res = enable_event(han, sched_process_free, > channel.name) +if res<0: + raise LTTngError(strerror(res)) + +#Disabling an > event +res = disable_event(han, sched_switch.name, channel.name) +if > res<0: + raise LTTngError(strerror(res)) + +#Getting a list of the > channels +l = list_channels(han) +if type(l) is int: + raise > LTTngError(strerror(l)) + +#Starting the trace +res = start("test") +if > res<0: + raise LTTngError(strerror(res)) + +#Stopping the trace +res = > stop("test") +if res<0: + raise LTTngError(strerror(res)) + +#Disabling a > channel +res = disable_channel(han, channel.name) +if res<0: + raise > LTTngError(strerror(res)) + +#Destroying the handle +del han + +#Destroying > the session +res = destroy("test") +if res<0: + raise > LTTngError(strerror(res)) diff --git a/src/python/tests/run.sh > b/src/python/tests/run.sh new file mode 100644 index 0000000..7de819b --- > /dev/null +++ b/src/python/tests/run.sh @@ -0,0 +1 @@ +python tests.py diff > --git a/src/python/tests/tests.py b/src/python/tests/tests.py new file mode > 100644 index 0000000..a4be981 --- /dev/null +++ > b/src/python/tests/tests.py @@ -0,0 +1,310 @@ +import unittest +import os > +import time +from lttng import * + +class TestLttngPythonModule > (unittest.TestCase): + + def test_kernel_all_events(self): + dom = > Domain() + dom.type = DOMAIN_KERNEL + + event = Event() + event.type = > EVENT_TRACEPOINT + event.loglevel_type = EVENT_LOGLEVEL_ALL + + han = > Handle("test_kernel_all_ev", dom) + + r = > create("test_kernel_all_ev","/lttng-traces/test") + > self.assertGreaterEqual(r, 0, strerror(r)) + + r = enable_event(han, > event, None) + self.assertGreaterEqual(r, 0, strerror(r)) + + r = > start("test_kernel_all_ev") + self.assertGreaterEqual(r, 0, strerror(r)) + > time.sleep(2) + + r = stop("test_kernel_all_ev") + > self.assertGreaterEqual(r, 0, strerror(r)) + + r = > destroy("test_kernel_all_ev") + self.assertGreaterEqual(r, 0, > strerror(r)) + + + def test_kernel_event(self): + + dom = Domain() + > dom.type = DOMAIN_KERNEL + + channel = Channel() + channel.name="mychan" > + channel.attr.overwrite = 0 + channel.attr.subbuf_size = 4096 + > channel.attr.num_subbuf = 8 + channel.attr.switch_timer_interval = 0 + > channel.attr.read_timer_interval = 200 + channel.attr.output = > EVENT_SPLICE + + sched_switch = Event() + sched_switch.name = > "sched_switch" + sched_switch.type = EVENT_TRACEPOINT + > sched_switch.loglevel_type = EVENT_LOGLEVEL_ALL + + sched_process_exit = > Event() + sched_process_exit.name = "sched_process_exit" + > sched_process_exit.type = EVENT_TRACEPOINT + > sched_process_exit.loglevel_type = EVENT_LOGLEVEL_ALL + + > sched_process_free = Event() + sched_process_free.name = > "sched_process_free" + sched_process_free.type = EVENT_TRACEPOINT + > sched_process_free.loglevel_type = EVENT_LOGLEVEL_ALL + + han = > Handle("test_kernel_event", dom) + + #Create session test + r = > create("test_kernel_event","/lttng-traces/test") + > self.assertGreaterEqual(r, 0, strerror(r)) + + #Enabling channel tests + > r = enable_channel(han, channel) + self.assertGreaterEqual(r, 0, > strerror(r)) + + #Enabling events tests + r = enable_event(han, > sched_switch, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) > + + r = enable_event(han, sched_process_exit, channel.name) + > self.assertGreaterEqual(r, 0, strerror(r)) + + r = enable_event(han, > sched_process_free, channel.name) + self.assertGreaterEqual(r, 0, > strerror(r)) + + #Disabling events tests + r = disable_event(han, > sched_switch.name, channel.name) + self.assertGreaterEqual(r, 0, > strerror(r)) + + r = disable_event(han, sched_process_free.name, > channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + #Renabling > events tests + r = enable_event(han, sched_switch, channel.name) + > self.assertGreaterEqual(r, 0, strerror(r)) + + r = enable_event(han, > sched_process_free, channel.name) + self.assertGreaterEqual(r, 0, > strerror(r)) + + #Start, stop, destroy + r = start("test_kernel_event") + > self.assertGreaterEqual(r, 0, strerror(r)) + time.sleep(2) + + r = > stop("test_kernel_event") + self.assertGreaterEqual(r, 0, strerror(r)) + + > r=disable_channel(han, channel.name) + self.assertGreaterEqual(r, 0, > strerror(r)) + + r=destroy("test_kernel_event") + > self.assertGreaterEqual(r, 0, strerror(r)) + + + + def > test_ust_all_events(self): + dom = Domain() + dom.type = DOMAIN_UST + + > event = Event() + event.type = EVENT_TRACEPOINT + event.loglevel_type = > EVENT_LOGLEVEL_ALL + + han = Handle("test_ust_all_ev", dom) + + r = > create("test_ust_all_ev","/lttng-traces/test") + > self.assertGreaterEqual(r, 0, strerror(r)) + + r = enable_event(han, > event, None) + self.assertGreaterEqual(r, 0, strerror(r)) + + r = > start("test_ust_all_ev") + self.assertGreaterEqual(r, 0, strerror(r)) + > time.sleep(2) + + r = stop("test_ust_all_ev") + > self.assertGreaterEqual(r, 0, strerror(r)) + + r = > destroy("test_ust_all_ev") + self.assertGreaterEqual(r, 0, strerror(r)) + > + + def test_ust_event(self): + + dom = Domain() + dom.type = DOMAIN_UST > + + channel = Channel() + channel.name="mychan" + channel.attr.overwrite > = 0 + channel.attr.subbuf_size = 4096 + channel.attr.num_subbuf = 8 + > channel.attr.switch_timer_interval = 0 + channel.attr.read_timer_interval > = 200 + channel.attr.output = EVENT_MMAP + + ev1 = Event() + ev1.name = > "tp1" + ev1.type = EVENT_TRACEPOINT + ev1.loglevel_type = > EVENT_LOGLEVEL_ALL + + ev2 = Event() + ev2.name = "ev2" + ev2.type = > EVENT_TRACEPOINT + ev2.loglevel_type = EVENT_LOGLEVEL_ALL + + ev3 = > Event() + ev3.name = "ev3" + ev3.type = EVENT_TRACEPOINT + > ev3.loglevel_type = EVENT_LOGLEVEL_ALL + + han = Handle("test_ust_event", > dom) + + #Create session test + r = > create("test_ust_event","/lttng-traces/test") + self.assertGreaterEqual(r, > 0, strerror(r)) + + #Enabling channel tests + r = enable_channel(han, > channel) + self.assertGreaterEqual(r, 0, strerror(r)) + + #Enabling > events tests + r = enable_event(han, ev1, channel.name) + > self.assertGreaterEqual(r, 0, strerror(r)) + + r = enable_event(han, ev2, > channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + r = > enable_event(han, ev3, channel.name) + self.assertGreaterEqual(r, 0, > strerror(r)) + + #Disabling events tests + r = disable_event(han, > ev1.name, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + > r = disable_event(han, ev3.name, channel.name) + > self.assertGreaterEqual(r, 0, strerror(r)) + + #Renabling events tests + > r = enable_event(han, ev1, channel.name) + self.assertGreaterEqual(r, 0, > strerror(r)) + + r = enable_event(han, ev3, channel.name) + > self.assertGreaterEqual(r, 0, strerror(r)) + + #Start, stop + r = > start("test_ust_event") + self.assertGreaterEqual(r, 0, strerror(r)) + > time.sleep(2) + + r = stop("test_ust_event") + self.assertGreaterEqual(r, > 0, strerror(r)) + + #Restart/restop + r = start("test_ust_event") + > self.assertGreaterEqual(r, 0, strerror(r)) + time.sleep(2) + + r = > stop("test_ust_event") + self.assertGreaterEqual(r, 0, strerror(r)) + + > #Disabling channel and destroy + r=disable_channel(han, channel.name) + > self.assertGreaterEqual(r, 0, strerror(r)) + + > r=destroy("test_ust_event") + self.assertGreaterEqual(r, 0, strerror(r)) > + + + def test_other_functions(self): + dom = Domain() + > dom.type=DOMAIN_KERNEL + + event=Event() + event.type=EVENT_TRACEPOINT + > event.loglevel_type=EVENT_LOGLEVEL_ALL + + calib = Calibrate() + > calib.type = CALIBRATE_FUNCTION + + ctx = EventContext() + > ctx.type=EVENT_CONTEXT_PID + + chattr = ChannelAttr() + chattr.overwrite > = 0 + chattr.subbuf_size = 4096 + chattr.num_subbuf = 8 + > chattr.switch_timer_interval = 0 + chattr.read_timer_interval = 200 + > chattr.output = EVENT_SPLICE + + han = Handle("test_otherf" , dom) + + r > = create("test_otherf","/lttng-traces/test") + self.assertGreaterEqual(r, > 0, strerror(r)) + + r = enable_event(han, event, None) + > self.assertGreaterEqual(r, 0, strerror(r)) + + #Calibrate test + r = > calibrate(han , calib) + self.assertGreaterEqual(r, 0, strerror(r)) + + > #Context test + r = add_context(han, ctx, "sched_switch", "channel0") + > self.assertGreaterEqual(r, 0, strerror(r)) + #Any channel + r = > add_context(han, ctx, "sched_wakeup", None) + self.assertGreaterEqual(r, > 0, strerror(r)) + #All events + r = add_context(han, ctx, None, None) + > self.assertGreaterEqual(r, 0, strerror(r)) + + #Def. channel attr + > channel_set_default_attr(dom, chattr) + channel_set_default_attr(None, > None) + + #Ses Daemon alive + r = session_daemon_alive() + > self.assertTrue(r == 1 or r == 0, strerror(r)) + + #Setting trace group + > r = set_tracing_group("testing") + self.assertGreaterEqual(r, 0, > strerror(r)) + + + r = start("test_otherf") + self.assertGreaterEqual(r, > 0, strerror(r)) + time.sleep(2) + + r = stop("test_otherf") + > self.assertGreaterEqual(r, 0, strerror(r)) + + del han + + r = > destroy("test_otherf") + self.assertGreaterEqual(r, 0, strerror(r)) + + > +if __name__ == "__main__": + # CHECK IF ROOT + if os.geteuid() == 0: + > #Make sure session names don't already exist: + > destroy("test_kernel_event") + destroy("test_kernel_all_events") + > destroy("test_ust_all_events") + destroy("test_ust_event") + > destroy("test_otherf") + + unittest.main() + else: + print('Script must > be run as root') -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAEBAgAGBQJQGCc4AAoJEELoaioR9I02f68IAKCipHU8psxIkXyUECveu57F 1ZPe9wzanUrb5eaiLH07mmbVJf/1Bu08eLfiuu1naaV0ZZIa2DenTXHcuC4orGbE /8KVBYidgDWIzY8lJOnw6wg+zB2ibnfTqtyhNE9Rqgesq6o776QfFgSkqzfQq/2m BxOsE1jKzx6JbgdquO32KBAyQAgyQu8Z9aJUYgAd3peqrx19pwnWhgnY88rtAzNi 5ktGj6btK4HAcQ62Q8pmTTaOR0y5sBb7STDYF2pcNMPU3TeLBjkRhl/djva0C7t/ hPiL8IVT4AYC0y72Oof0kuSgaGIyHAxujAGHeOnOQP3KXhAvrow/bhJodbIo3pU= =lEVV -----END PGP SIGNATURE----- From yannick.brosseau at gmail.com Tue Jul 31 15:20:15 2012 From: yannick.brosseau at gmail.com (Yannick Brosseau) Date: Tue, 31 Jul 2012 15:20:15 -0400 Subject: [lttng-dev] [lttng-tools PATCH] lttng-tools python module In-Reply-To: <50182739.3030604@polymtl.ca> References: <1343326167-11522-1-git-send-email-danny.serres@efficios.com> <50182739.3030604@polymtl.ca> Message-ID: <50182FEF.6070504@gmail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2012-07-31 14:43, David Goulet wrote: > > > Apart from those minor issues, I have two questions about this patch. First, > why is the python module in src/ and not in extras/ ? I consider src/ to be > supported and stable code shipped with the installation and/or in packages. > Also, the src/ directory is the core code of lttng-tools and this module is > more an extra useful tool. > I'm not sure it belongs to extras, since its an actual library that do something and that is installed on the system. If you do not want it in src, we could create a top level python directory or a binding/python (which allows for other language later on). On the other hand, its a binding of the liblttng-ctl, so having the binding live with the lib directly can be a good idea. We should probably do a quick survey of other projects approach. > Second, _IF_ this goes into src/, please move the tests to the tests/ > directory else we are going to make it self contained in extras/ which is good > right now. > yes, good point. Yannick -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlAYL+gACgkQFQrZ7GzHX2rtagCgllef/MlyxLacs1Udta3NB8Y5 WJEAnA5E5zMJ08cLdBMYKjsDhqqIF7BP =j7S+ -----END PGP SIGNATURE----- -------------- next part -------------- An HTML attachment was scrubbed... URL: From christian.babeux at efficios.com Tue Jul 31 15:56:47 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Tue, 31 Jul 2012 15:56:47 -0400 Subject: [lttng-dev] [lttng-tools PATCH] lttng-tools python module In-Reply-To: <1343326167-11522-1-git-send-email-danny.serres@efficios.com> References: <1343326167-11522-1-git-send-email-danny.serres@efficios.com> Message-ID: Hi Danny, First of all, thank you for your work on Python bindings! This will be very useful in the near future :). Here are some comments on your patch: > SWIG >= 2.0 is used to create the wrapper and its > 'warning md variable unused' bug is patched in Makefile.am. > [...] > diff --git a/src/python/Makefile.am b/src/python/Makefile.am > new file mode 100644 > index 0000000..b67d550 > --- /dev/null > +++ b/src/python/Makefile.am > [...] > +lttng_wrap.c: lttng.i > + $(SWIG) -python -I. -I$(top_srcdir)/src/common/sessiond-comm lttng.i > + sed -i "s/Python.h/python$(PYTHON_VERSION)\/Python.h/g" lttng_wrap.c > + sed -i "s/PyObject \*m, \*d, \*md;/PyObject \*m, \*d;\n#if defined(SWIGPYTHON_BUILTIN)\nPyObject *md;\n#endif/g" lttng_wrap.c > + sed -i "s/md = d/d/g" lttng_wrap.c > + sed -i "s/(void)public_symbol;/(void)public_symbol;\n md = d;/g" lttng_wrap.c If I understand correctly your commit message, those sed invocations are necessary to remove an 'unused variable warning'. Is this a known upstream bug in SWIG? > + sed -i "s/Python.h/python$(PYTHON_VERSION)\/Python.h/g" lttng_wrap.c This sed replacement didn't work on my machine. I have a Python3 install and the appropriate Python.h header is located in '/usr/include/python3.2mu'. To reliably detect Python include paths, the 'python-config --includes' command can be used like you did in the main configure.ac. I would suggest generating the binding like this: -AM_CFLAGS = -I$(PYTHONINC) -I../lib/lttng-ctl -I../common \ +AM_CFLAGS = -I$(PYTHON_INCLUDE) -I../lib/lttng-ctl -I../common \ $(BUDDY_CFLAGS) [...] lttng_wrap.c: lttng.i $(SWIG) -python -I. -I$(top_srcdir)/src/common/sessiond-comm lttng.i - sed -i "s/Python.h/python$(PYTHON_VERSION)\/Python.h/g" lttng_wrap.c [...] The README should also mention that in order to generate the Python bindings, python headers are also required (python-dev on Debian/Ubuntu). Thank you, Christian -------------- next part -------------- An HTML attachment was scrubbed... URL: From serres at live.ca Tue Jul 31 17:09:14 2012 From: serres at live.ca (Danny Serres) Date: Tue, 31 Jul 2012 17:09:14 -0400 Subject: [lttng-dev] [lttng-tools PATCH] lttng-tools python module In-Reply-To: <50182739.3030604@polymtl.ca> References: <1343326167-11522-1-git-send-email-danny.serres@efficios.com>, <50182739.3030604@polymtl.ca> Message-ID: > Date: Tue, 31 Jul 2012 14:43:05 -0400 > From: david.goulet at polymtl.ca > To: danny.serres at efficios.com > CC: lttng-dev at lists.lttng.org > Subject: Re: [lttng-dev] [lttng-tools PATCH] lttng-tools python module > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi Danny, > > Sorry for the delay! > > First, thanks for this great work. I have a couple of "requests" before I put > all that upstream. > > Can you add the generated files into .gitignore please. I get this: > > # src/python/lttng.i > # src/python/lttng.py > # src/python/lttng_wrap.c > > There is also forgotten whitespaces in src/python/lttng.i.in (first carac.) > > + char *__repr__() { > (times 5) Fixed > > Apart from those minor issues, I have two questions about this patch. First, > why is the python module in src/ and not in extras/ ? I consider src/ to be > supported and stable code shipped with the installation and/or in packages. > Also, the src/ directory is the core code of lttng-tools and this module is > more an extra useful tool. > > Second, _IF_ this goes into src/, please move the tests to the tests/ > directory else we are going to make it self contained in extras/ which is good > right now. > >From what I've seen so far, other projects all have a top python dir which includes the Python-related file. I'll wait on approval on doing this before posting a new version. > Last thing, could it be possible to have a small how-to/tutorial in the doc/ > directory so people know that this exist and how to install it and use it ? > (Also add it to the README in PACKAGE CONTENTS). A swig2 dependency will be > added with this module so this howto should mention that this depends on that > software. (swig2.0 package on Debian/Ubuntu). > Done Thanks Danny > I might be wrong on some point so don't hesitate to argue and comment! :) > > Cheers! > David > > On 26/07/12 02:09 PM, Danny Serres wrote: > > The lttng-tools Python module can be used to directly control the > > lttng-tools API inside Python, using 'import lttng'. > > > > Therefore, it becomes possible to create a trace, add events, start/stop > > tracing, destroy a session and so on from within Python. > > > > The module does not include URI-related functions. > > > > SWIG >= 2.0 is used to create the wrapper and its 'warning md variable > > unused' bug is patched in Makefile.am. > > > > In the interface file, struct and enum are directly copied from lttng.h > > (all changes must be made in both files). > > > > Signed-off-by: Danny Serres Signed-off-by: > > Yannick Brosseau --- config/ax_pkg_swig.m4 > > | 135 ++++++ configure.ac | 43 ++ src/Makefile.am > > | 4 + src/python/Makefile.am | 25 ++ src/python/lttng.i.in > > | 1023 +++++++++++++++++++++++++++++++++++++++++++ > > src/python/tests/example.py | 109 +++++ src/python/tests/run.sh | 1 > > + src/python/tests/tests.py | 310 +++++++++++++ 8 files changed, 1650 > > insertions(+) create mode 100644 config/ax_pkg_swig.m4 create mode 100644 > > src/python/Makefile.am create mode 100644 src/python/lttng.i.in create mode > > 100644 src/python/tests/example.py create mode 100644 > > src/python/tests/run.sh create mode 100644 src/python/tests/tests.py > > > > diff --git a/config/ax_pkg_swig.m4 b/config/ax_pkg_swig.m4 new file mode > > 100644 index 0000000..e112f3d --- /dev/null +++ b/config/ax_pkg_swig.m4 @@ > > -0,0 +1,135 @@ +# > > =========================================================================== > > > > > +# http://www.gnu.org/software/autoconf-archive/ax_pkg_swig.html > > +# > > =========================================================================== > > > > > +# > > +# SYNOPSIS +# +# AX_PKG_SWIG([major.minor.micro], [action-if-found], > > [action-if-not-found]) +# +# DESCRIPTION +# +# This macro searches for a > > SWIG installation on your system. If found, +# then SWIG is AC_SUBST'd; > > if not found, then $SWIG is empty. If SWIG is +# found, then SWIG_LIB is > > set to the SWIG library path, and AC_SUBST'd. +# +# You can use the > > optional first argument to check if the version of the +# available SWIG > > is greater than or equal to the value of the argument. It +# should have > > the format: N[.N[.N]] (N is a number between 0 and 999. Only +# the first > > N is mandatory.) If the version argument is given (e.g. +# 1.3.17), > > AX_PKG_SWIG checks that the swig package is this version number +# or > > higher. +# +# As usual, action-if-found is executed if SWIG is found, > > otherwise +# action-if-not-found is executed. +# +# In configure.in, > > use as: +# +# AX_PKG_SWIG(1.3.17, [], [ AC_MSG_ERROR([SWIG is required > > to build..]) ]) +# AX_SWIG_ENABLE_CXX +# > > AX_SWIG_MULTI_MODULE_SUPPORT +# AX_SWIG_PYTHON +# +# LICENSE +# +# > > Copyright (c) 2008 Sebastian Huber +# Copyright > > (c) 2008 Alan W. Irwin +# Copyright (c) 2008 > > Rafael Laboissiere +# Copyright (c) 2008 Andrew > > Collier +# Copyright (c) 2011 Murray Cumming > > +# +# This program is free software; you can > > redistribute it and/or modify it +# under the terms of the GNU General > > Public License as published by the +# Free Software Foundation; either > > version 2 of the License, or (at your +# option) any later version. +# +# > > This program is distributed in the hope that it will be useful, but +# > > WITHOUT ANY WARRANTY; without even the implied warranty of +# > > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# > > Public License for more details. +# +# You should have received a copy of > > the GNU General Public License along +# with this program. If not, see > > . +# +# As a special exception, the > > respective Autoconf Macro's copyright owner +# gives unlimited permission > > to copy, distribute and modify the configure +# scripts that are the > > output of Autoconf when processing the Macro. You +# need not follow the > > terms of the GNU General Public License when using +# or distributing > > such scripts, even though portions of the text of the +# Macro appear in > > them. The GNU General Public License (GPL) does govern +# all other use > > of the material that constitutes the Autoconf Macro. +# +# This special > > exception to the GPL applies to versions of the Autoconf +# Macro > > released by the Autoconf Archive. When you make and distribute a +# > > modified version of the Autoconf Macro, you may extend this special +# > > exception to the GPL to apply to your modified version as well. + +#serial > > 8 + +AC_DEFUN([AX_PKG_SWIG],[ + # Ubuntu has swig 2.0 as > > /usr/bin/swig2.0 + AC_PATH_PROGS([SWIG],[swig swig2.0]) + if > > test -z "$SWIG" ; then + m4_ifval([$3],[$3],[:]) + > > elif test -n "$1" ; then + AC_MSG_CHECKING([SWIG version]) + > > [swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed > > 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`] + > > AC_MSG_RESULT([$swig_version]) + if test -n "$swig_version" > > ; then + # Calculate the required version number > > components + [required=$1] + > > [required_major=`echo $required | sed 's/[^0-9].*//'`] + > > if test -z "$required_major" ; then + > > [required_major=0] + fi + > > [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] + > > [required_minor=`echo $required | sed 's/[^0-9].*//'`] + > > if test -z "$required_minor" ; then + > > [required_minor=0] + fi + > > [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] + > > [required_patch=`echo $required | sed 's/[^0-9].*//'`] + > > if test -z "$required_patch" ; then + > > [required_patch=0] + fi + # > > Calculate the available version number components + > > [available=$swig_version] + [available_major=`echo > > $available | sed 's/[^0-9].*//'`] + if test -z > > "$available_major" ; then + > > [available_major=0] + fi + > > [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] + > > [available_minor=`echo $available | sed 's/[^0-9].*//'`] + > > if test -z "$available_minor" ; then + > > [available_minor=0] + fi + > > [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] + > > [available_patch=`echo $available | sed 's/[^0-9].*//'`] + > > if test -z "$available_patch" ; then + > > [available_patch=0] + fi + # > > Convert the version tuple into a single number for easier comparison. + > > # Using base 100 should be safe since SWIG internally uses BCD values + > > # to encode its version number. + > > required_swig_vernum=`expr $required_major \* 10000 \ + > > \+ $required_minor \* 100 \+ $required_patch` + > > available_swig_vernum=`expr $available_major \* 10000 \ + > > \+ $available_minor \* 100 \+ $available_patch` + + > > if test $available_swig_vernum -lt $required_swig_vernum; then + > > AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version.]) + > > SWIG='' + m4_ifval([$3],[$3],[]) + > > else + AC_MSG_CHECKING([for SWIG library]) + > > SWIG_LIB=`$SWIG -swiglib` + > > AC_MSG_RESULT([$SWIG_LIB]) + > > m4_ifval([$2],[$2],[]) + fi + else + > > AC_MSG_WARN([cannot determine SWIG version]) + > > SWIG='' + m4_ifval([$3],[$3],[]) + > > fi + fi + AC_SUBST([SWIG_LIB]) +]) diff --git a/configure.ac > > b/configure.ac index 17e6b67..97167de 100644 --- a/configure.ac +++ > > b/configure.ac @@ -154,6 +154,40 @@ AC_CHECK_LIB([c], [open_memstream], ] > > ) > > > > +# For Python +# SWIG version needed or newer: +swig_version=2.0.0 + > > +AC_ARG_ENABLE([python], + > > [AC_HELP_STRING([--disable-python], + [do not > > compile Python bindings])], + [], [enable_python=yes]) + > > +AM_CONDITIONAL([USE_PYTHON], [test "x${enable_python:-yes}" = xyes]) + +if > > test "x${enable_python:-yes}" = xyes; then + AC_MSG_NOTICE([You may > > configure with --disable-python ]dnl +[if you do not need Python > > bindings.]) + + AX_PKG_SWIG($swig_version, [], [ AC_MSG_ERROR([SWIG > > $swig_version or newer is needed]) ]) + AM_PATH_PYTHON + + > > AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for python, bypassing > > python-config]) + AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config]) + > > AS_IF([test -z "$PYTHON_INCLUDE"], [ + AS_IF([test -z "$PYTHON_CONFIG"], > > [ + AC_PATH_PROGS([PYTHON_CONFIG], + > > [python$PYTHON_VERSION-config python-config], + [no], + > > [`dirname $PYTHON`]) + AS_IF([test "$PYTHON_CONFIG" = no], > > [AC_MSG_ERROR([cannot find python-config for $PYTHON.])]) + ]) + > > AC_MSG_CHECKING([python include flags]) + PYTHON_INCLUDE=`$PYTHON_CONFIG > > --includes` + AC_MSG_RESULT([$PYTHON_INCLUDE]) + ]) +fi + # Option to > > only build the consumer daemon and its libraries > > AC_ARG_WITH([consumerd-only], AS_HELP_STRING([--with-consumerd-only],[Only > > build the consumer daemon [default=no]]), @@ -214,6 +248,7 @@ > > AC_CONFIG_FILES([ src/bin/lttng-sessiond/Makefile > > src/bin/lttng-relayd/Makefile src/bin/lttng/Makefile + src/python/Makefile > > tests/Makefile tests/kernel/Makefile tests/tools/Makefile @@ -260,6 +295,14 > > @@ AS_IF([test "x$lttng_ust_support" = "xyes"],[ AS_ECHO("Disabled") ]) > > > > +#Python binding enabled/disabled +AS_ECHO_N("Python binding: ") > > +AS_IF([test "x${enable_python:-yes}" = xyes], [ + AS_ECHO("Enabled") +],[ > > + AS_ECHO("Disabled") +]) + # Do we build only the consumerd, or > > everything AS_IF([test "x$consumerd_only" = "xyes"],[ AS_ECHO("Only the > > consumerd daemon will be built.") diff --git a/src/Makefile.am > > b/src/Makefile.am index 103337c..a65a5c1 100644 --- a/src/Makefile.am +++ > > b/src/Makefile.am @@ -1 +1,5 @@ SUBDIRS = common lib bin + +if USE_PYTHON > > +SUBDIRS += python +endif diff --git a/src/python/Makefile.am > > b/src/python/Makefile.am new file mode 100644 index 0000000..b67d550 --- > > /dev/null +++ b/src/python/Makefile.am @@ -0,0 +1,25 @@ +lttng.i: > > lttng.i.in + sed "s/LTTNG_VERSION_STR/LTTng $(PACKAGE_VERSION)/g" > > lttng.i + +AM_CFLAGS = -I$(PYTHONINC) -I../lib/lttng-ctl > > -I../common \ + $(BUDDY_CFLAGS) + +EXTRA_DIST = lttng.i > > +python_PYTHON = lttng.py +pyexec_LTLIBRARIES = _lttng.la + > > +MAINTAINERCLEANFILES = lttng_wrap.c lttng.py + +_lttng_la_SOURCES = > > lttng_wrap.c + +_lttng_la_LDFLAGS = -module + +_lttng_la_LIBADD = > > ../lib/lttng-ctl/liblttng-ctl.la \ + > > ../common/sessiond-comm/libsessiond-comm.la + +lttng_wrap.c: lttng.i + > > $(SWIG) -python -I. -I$(top_srcdir)/src/common/sessiond-comm lttng.i + sed > > -i "s/Python.h/python$(PYTHON_VERSION)\/Python.h/g" lttng_wrap.c + sed -i > > "s/PyObject \*m, \*d, \*md;/PyObject \*m, \*d;\n#if > > defined(SWIGPYTHON_BUILTIN)\nPyObject *md;\n#endif/g" lttng_wrap.c + sed -i > > "s/md = d/d/g" lttng_wrap.c + sed -i > > "s/(void)public_symbol;/(void)public_symbol;\n md = d;/g" lttng_wrap.c > > diff --git a/src/python/lttng.i.in b/src/python/lttng.i.in new file mode > > 100644 index 0000000..4f3cfeb --- /dev/null +++ b/src/python/lttng.i.in @@ > > -0,0 +1,1023 @@ +%define DOCSTRING +"LTTNG_VERSION_STR + +The LTTng > > project aims at providing highly efficient tracing tools for Linux. +It's > > tracers help tracking down performance issues and debugging problems > > involving +multiple concurrent processes and threads. Tracing across > > multiple systems is also possible." +%enddef + > > +%module(docstring=DOCSTRING) lttng + +%include "typemaps.i" +%include > > "pyabc.i" +%{ +#define SWIG_FILE_WITH_INIT +#include +%} + > > +typedef unsigned int uint32_t; +typedef int int32_t; +typedef unsigned > > long long uint64_t; +typedef long pid_t; + + +// > > ============================================= +// ENUMS +// > > ============================================= + +%rename("DOMAIN_KERNEL") > > LTTNG_DOMAIN_KERNEL; +%rename("DOMAIN_UST") LTTNG_DOMAIN_UST; +enum > > lttng_domain_type { + LTTNG_DOMAIN_KERNEL = 1, + > > LTTNG_DOMAIN_UST = 2, +}; + +%rename("EVENT_ALL") > > LTTNG_EVENT_ALL; +%rename("EVENT_TRACEPOINT") LTTNG_EVENT_TRACEPOINT; > > +%rename("EVENT_PROBE") LTTNG_EVENT_PROBE; > > +%rename("EVENT_FUNCTION")LTTNG_EVENT_FUNCTION; > > +%rename("EVENT_FUNCTION_ENTRY") LTTNG_EVENT_FUNCTION_ENTRY; > > +%rename("EVENT_NOOP") LTTNG_EVENT_NOOP; +%rename("EVENT_SYSCALL") > > LTTNG_EVENT_SYSCALL; +enum lttng_event_type { + 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, +}; + > > +%rename("EVENT_LOGLEVEL_ALL") LTTNG_EVENT_LOGLEVEL_ALL; > > +%rename("EVENT_LOGLEVEL_RANGE") LTTNG_EVENT_LOGLEVEL_RANGE; > > +%rename("EVENT_LOGLEVEL_SINGLE") LTTNG_EVENT_LOGLEVEL_SINGLE; +enum > > lttng_loglevel_type { + LTTNG_EVENT_LOGLEVEL_ALL = 0, + > > LTTNG_EVENT_LOGLEVEL_RANGE = 1, + LTTNG_EVENT_LOGLEVEL_SINGLE > > = 2, +}; + +%rename("LOGLEVEL_EMERG") LTTNG_LOGLEVEL_EMERG; > > +%rename("LOGLEVEL_ALERT") LTTNG_LOGLEVEL_ALERT; +%rename("LOGLEVEL_CRIT") > > LTTNG_LOGLEVEL_CRIT; +%rename("LOGLEVEL_ERR") LTTNG_LOGLEVEL_ERR; > > +%rename("LOGLEVEL_WARNING") LTTNG_LOGLEVEL_WARNING; > > +%rename("LOGLEVEL_NOTICE") LTTNG_LOGLEVEL_NOTICE; > > +%rename("LOGLEVEL_INFO") LTTNG_LOGLEVEL_INFO; > > +%rename("LOGLEVEL_DEBUG_SYSTEM") LTTNG_LOGLEVEL_DEBUG_SYSTEM; > > +%rename("LOGLEVEL_DEBUG_PROGRAM") LTTNG_LOGLEVEL_DEBUG_PROGRAM; > > +%rename("LOGLEVEL_DEBUG_PROCESS") LTTNG_LOGLEVEL_DEBUG_PROCESS; > > +%rename("LOGLEVEL_DEBUG_MODULE") LTTNG_LOGLEVEL_DEBUG_MODULE; > > +%rename("LOGLEVEL_DEBUG_UNIT") LTTNG_LOGLEVEL_DEBUG_UNIT; > > +%rename("LOGLEVEL_DEBUG_FUNCTION") LTTNG_LOGLEVEL_DEBUG_FUNCTION; > > +%rename("LOGLEVEL_DEBUG_LINE") LTTNG_LOGLEVEL_DEBUG_LINE; > > +%rename("LOGLEVEL_DEBUG") LTTNG_LOGLEVEL_DEBUG; +enum lttng_loglevel { + > > LTTNG_LOGLEVEL_EMERG = 0, + LTTNG_LOGLEVEL_ALERT > > = 1, + LTTNG_LOGLEVEL_CRIT = 2, + > > LTTNG_LOGLEVEL_ERR = 3, + LTTNG_LOGLEVEL_WARNING > > = 4, + LTTNG_LOGLEVEL_NOTICE = 5, + > > LTTNG_LOGLEVEL_INFO = 6, + > > LTTNG_LOGLEVEL_DEBUG_SYSTEM = 7, + > > LTTNG_LOGLEVEL_DEBUG_PROGRAM = 8, + > > LTTNG_LOGLEVEL_DEBUG_PROCESS = 9, + > > LTTNG_LOGLEVEL_DEBUG_MODULE = 10, + > > LTTNG_LOGLEVEL_DEBUG_UNIT = 11, + > > LTTNG_LOGLEVEL_DEBUG_FUNCTION = 12, + > > LTTNG_LOGLEVEL_DEBUG_LINE = 13, + LTTNG_LOGLEVEL_DEBUG > > = 14, +}; + +%rename("EVENT_SPLICE") LTTNG_EVENT_SPLICE; > > +%rename("EVENT_MMAP") LTTNG_EVENT_MMAP; +enum lttng_event_output { + > > LTTNG_EVENT_SPLICE = 0, + LTTNG_EVENT_MMAP > > = 1, +}; + +%rename("EVENT_CONTEXT_PID") LTTNG_EVENT_CONTEXT_PID; > > +%rename("EVENT_CONTEXT_PERF_COUNTER") LTTNG_EVENT_CONTEXT_PERF_COUNTER; > > +%rename("EVENT_CONTEXT_PROCNAME") LTTNG_EVENT_CONTEXT_PROCNAME; > > +%rename("EVENT_CONTEXT_PRIO") LTTNG_EVENT_CONTEXT_PRIO; > > +%rename("EVENT_CONTEXT_NICE") LTTNG_EVENT_CONTEXT_NICE; > > +%rename("EVENT_CONTEXT_VPID") LTTNG_EVENT_CONTEXT_VPID; > > +%rename("EVENT_CONTEXT_TID") LTTNG_EVENT_CONTEXT_TID; > > +%rename("EVENT_CONTEXT_VTID") LTTNG_EVENT_CONTEXT_VTID; > > +%rename("EVENT_CONTEXT_PPID") LTTNG_EVENT_CONTEXT_PPID; > > +%rename("EVENT_CONTEXT_VPPID") LTTNG_EVENT_CONTEXT_VPPID; > > +%rename("EVENT_CONTEXT_PTHREAD_ID") LTTNG_EVENT_CONTEXT_PTHREAD_ID; +enum > > lttng_event_context_type { + LTTNG_EVENT_CONTEXT_PID = 0, + > > LTTNG_EVENT_CONTEXT_PERF_COUNTER = 1, + LTTNG_EVENT_CONTEXT_PROCNAME > > = 2, + LTTNG_EVENT_CONTEXT_PRIO = 3, + > > LTTNG_EVENT_CONTEXT_NICE = 4, + LTTNG_EVENT_CONTEXT_VPID > > = 5, + LTTNG_EVENT_CONTEXT_TID = 6, + > > LTTNG_EVENT_CONTEXT_VTID = 7, + LTTNG_EVENT_CONTEXT_PPID > > = 8, + LTTNG_EVENT_CONTEXT_VPPID = 9, + > > LTTNG_EVENT_CONTEXT_PTHREAD_ID = 10, +}; + > > +%rename("CALIBRATE_FUNCTION") LTTNG_CALIBRATE_FUNCTION; +enum > > lttng_calibrate_type { + LTTNG_CALIBRATE_FUNCTION = 0, +}; + > > + + +// ============================================= +// TYPEMAPS +// > > ============================================= + +//list_sessions > > +%typemap(argout) struct lttng_session **sessions{ + + int l = > > PyInt_AsSsize_t($result); + if (l >= 0) + { + PyObject *sessions = > > PyList_New(0); + int i; + for(i=0; i > PyTuple_New(4); + PyObject *name = PyString_FromString((*$1)[i].name); + > > PyObject *path = PyString_FromString((*$1)[i].path); + PyObject *enabled > > = PyInt_FromSize_t((*$1)[i].enabled); + PyObject *padding = > > PyString_FromString((*$1)[i].padding); + + PyTuple_SetItem(tmp, 0, > > name); + PyTuple_SetItem(tmp, 1, path); + PyTuple_SetItem(tmp, 2, > > enabled); + PyTuple_SetItem(tmp, 3, padding); + PyList_Append(sessions, > > tmp); + } + $result = sessions; + } +} +%typemap(in,numinputs=0) struct > > lttng_session **sessions (struct lttng_session *temp){ + $1=&temp; +} + > > +//list_domains +%typemap(argout) struct lttng_domain **domains{ + + int l > > = PyInt_AsSsize_t($result); + if (l >= 0) + { + PyObject *dom = > > PyList_New(0); + int i; + for(i=0; i > PyTuple_New(5); + PyObject *type = PyInt_FromSize_t((*$1)[i].type); + > > PyObject *execname = PyString_FromString((*$1)[i].attr.exec_name); + > > PyObject *pid = PyInt_FromSize_t((*$1)[i].attr.pid); + PyObject *padding > > = PyString_FromString((*$1)[i].padding); + PyObject *attrpadding = > > PyString_FromString((*$1)[i].attr.padding); + + PyTuple_SetItem(tmp, 0, > > type); + PyTuple_SetItem(tmp, 1, padding); + PyTuple_SetItem(tmp, 2, > > pid); + PyTuple_SetItem(tmp, 3, execname); + PyTuple_SetItem(tmp, 4, > > attrpadding); + PyList_Append(dom, tmp); + } + $result = dom; + } +} > > +%typemap(in,numinputs=0) struct lttng_domain **domains (struct > > lttng_domain *temp){ + $1=&temp; +} + +//list_channels +%typemap(argout) > > struct lttng_channel **channels{ + + int l = PyInt_AsSsize_t($result); + if > > (l >= 0) + { + PyObject *chan = PyList_New(0); + int i; + for(i=0; i > i++) + { + PyObject *tmp = PyTuple_New(4); + PyObject *name = > > PyString_FromString((*$1)[i].name); + PyObject *enabled = > > PyInt_FromSize_t((*$1)[i].enabled); + PyObject *padding = > > PyString_FromString((*$1)[i].padding); + + PyObject *attrtmp = > > PyTuple_New(7); + PyObject *overwrite = > > PyInt_FromLong((*$1)[i].attr.overwrite); + PyObject *subbuf = > > PyInt_FromSize_t((*$1)[i].attr.subbuf_size); + PyObject *num = > > PyInt_FromSize_t((*$1)[i].attr.num_subbuf); + PyObject *switchtimer = > > PyInt_FromSize_t((*$1)[i].attr.switch_timer_interval); + PyObject > > *readtimer = PyInt_FromSize_t((*$1)[i].attr.read_timer_interval); + > > PyObject *output = PyInt_FromSize_t((*$1)[i].attr.output); + PyObject > > *attrpad = PyString_FromString((*$1)[i].attr.padding); + + > > PyTuple_SetItem(attrtmp, 0, overwrite); + PyTuple_SetItem(attrtmp, 1, > > subbuf); + PyTuple_SetItem(attrtmp, 2, num); + PyTuple_SetItem(attrtmp, > > 3, switchtimer); + PyTuple_SetItem(attrtmp, 4, readtimer); + > > PyTuple_SetItem(attrtmp, 5, output); + PyTuple_SetItem(attrtmp, 6, > > attrpad); + + PyTuple_SetItem(tmp, 0, name); + PyTuple_SetItem(tmp, 1, > > enabled); + PyTuple_SetItem(tmp, 2, padding); + PyTuple_SetItem(tmp, 3, > > attrtmp); + PyList_Append(chan, tmp); + } + $result = chan; + } +} > > +%typemap(in,numinputs=0) struct lttng_channel **channels (struct > > lttng_channel *temp){ + $1=&temp; +} + +//list_events & list_tracepoints > > +%typemap(argout) struct lttng_event **events{ + + int l = > > PyInt_AsSsize_t($result); + if (l >= 0) + { + PyObject *events = > > PyList_New(0); + int i; + for(i=0; i > PyTuple_New(10); + PyObject *name = PyString_FromString((*$1)[i].name); + > > PyObject *type = PyInt_FromSize_t((*$1)[i].type); + PyObject > > *logleveltype = PyInt_FromSize_t((*$1)[i].loglevel_type); + PyObject > > *loglevel = PyInt_FromLong((*$1)[i].loglevel); + PyObject *enabled = > > PyInt_FromLong((*$1)[i].enabled); + PyObject *pid = > > PyInt_FromSize_t((*$1)[i].pid); + PyObject *padding = > > PyString_FromString((*$1)[i].padding); + PyObject *attrpadding = > > PyString_FromString((*$1)[i].attr.padding); + + PyObject *probe = > > PyTuple_New(4); + PyObject *addr = > > PyInt_FromSize_t((*$1)[i].attr.probe.addr); + PyObject *offset = > > PyInt_FromSize_t((*$1)[i].attr.probe.offset); + PyObject *symbolname = > > PyString_FromString((*$1)[i].attr.probe.symbol_name); + PyObject > > *probepad = PyString_FromString((*$1)[i].attr.probe.padding); + + > > PyObject *function = PyTuple_New(2); + PyObject *f_symbolname = > > PyString_FromString((*$1)[i].attr.ftrace.symbol_name); + PyObject *f_pad > > = PyString_FromString((*$1)[i].attr.ftrace.padding); + + > > PyTuple_SetItem(function, 0, f_symbolname); + PyTuple_SetItem(function, > > 1, f_pad); + + PyTuple_SetItem(probe, 0, addr); + > > PyTuple_SetItem(probe, 1, offset); + PyTuple_SetItem(probe, 2, > > symbolname); + PyTuple_SetItem(probe, 3, probepad); + + > > PyTuple_SetItem(tmp, 0, name); + PyTuple_SetItem(tmp, 1, type); + > > PyTuple_SetItem(tmp, 2, logleveltype); + PyTuple_SetItem(tmp, 3, > > loglevel); + PyTuple_SetItem(tmp, 4, enabled); + PyTuple_SetItem(tmp, > > 5, pid); + PyTuple_SetItem(tmp, 6, padding); + PyTuple_SetItem(tmp, 7, > > probe); + PyTuple_SetItem(tmp, 8, function); + PyTuple_SetItem(tmp, 9, > > attrpadding); + PyList_Append(events, tmp); + } + $result = events; + > > } +} +%typemap(in,numinputs=0) struct lttng_event **events (struct > > lttng_event *temp){ + $1=&temp; +} + + + +// > > ============================================= +// FUNCTIONS +// > > ============================================= + +%rename("create") > > lttng_create_session(const char *name, const char *path); > > +%rename("destroy") lttng_destroy_session(const char *name); > > +%rename("_lttng_create_handle") lttng_create_handle(const char > > *session_name, struct lttng_domain *domain); > > +%rename("_lttng_destroy_handle") lttng_destroy_handle(struct lttng_handle > > *handle); +%rename("_lttng_list_sessions") lttng_list_sessions(struct > > lttng_session **sessions); +%rename("_lttng_list_domains") > > lttng_list_domains(const char *session_name, struct lttng_domain > > **domains); +%rename("_lttng_list_channels") lttng_list_channels(struct > > lttng_handle *handle,struct lttng_channel **channels); > > +%rename("_lttng_list_events") lttng_list_events(struct lttng_handle > > *handle, const char *channel_name, struct lttng_event **events); > > +%rename("_lttng_list_tracepoints") lttng_list_tracepoints(struct > > lttng_handle *handle, struct lttng_event **events); > > +%rename("session_daemon_alive") lttng_session_daemon_alive(void); > > +%rename("set_tracing_group") lttng_set_tracing_group(const char *name); > > +%rename("strerror") lttng_strerror(int code); > > +%rename("_lttng_register_consumer") lttng_register_consumer(struct > > lttng_handle *handle, const char *socket_path); +%rename("start") > > lttng_start_tracing(const char *session_name); +%rename("stop") > > lttng_stop_tracing(const char *session_name); > > +%rename("_lttng_add_context") lttng_add_context(struct lttng_handle > > *handle, struct lttng_event_context *ctx, const char *event_name, const > > char *channel_name); +%rename("_lttng_enable_event") > > lttng_enable_event(struct lttng_handle *handle, struct lttng_event *ev, > > const char *channel_name); +%rename("_lttng_enable_channel") > > lttng_enable_channel(struct lttng_handle *handle, struct lttng_channel > > *chan); +%rename("_lttng_disable_event") lttng_disable_event(struct > > lttng_handle *handle, const char *name, const char *channel_name); > > +%rename("_lttng_disable_channel") lttng_disable_channel(struct > > lttng_handle *handle, const char *name); +%rename("_lttng_calibrate") > > lttng_calibrate(struct lttng_handle *handle, struct lttng_calibrate > > *calibrate); +%rename("channel_set_default_attr") > > lttng_channel_set_default_attr(struct lttng_domain *domain, struct > > lttng_channel_attr *attr); + +//Redefined functions +struct lttng_handle > > *lttng_create_handle(const char *session_name, + struct lttng_domain > > *domain); +void lttng_destroy_handle(struct lttng_handle *handle); +int > > lttng_list_channels(struct lttng_handle *handle,struct lttng_channel > > **channels); +int lttng_list_events(struct lttng_handle *handle, + const > > char *channel_name, struct lttng_event **events); +int > > lttng_list_tracepoints(struct lttng_handle *handle, struct lttng_event > > **events); +int lttng_add_context(struct lttng_handle *handle, struct > > lttng_event_context *ctx, + const char *event_name, const char > > *channel_name); +int lttng_enable_event(struct lttng_handle *handle, + > > struct lttng_event *ev, const char *channel_name); +int > > lttng_enable_channel(struct lttng_handle *handle, struct lttng_channel > > *chan); +int lttng_disable_event(struct lttng_handle *handle, + const char > > *name, const char *channel_name); +int lttng_disable_channel(struct > > lttng_handle *handle, const char *name); +int lttng_calibrate(struct > > lttng_handle *handle, struct lttng_calibrate *calibrate); +int > > lttng_register_consumer(struct lttng_handle *handle, const char > > *socket_path); +int lttng_list_sessions(struct lttng_session **sessions); > > +int lttng_list_domains(const char *session_name, struct lttng_domain > > **domains); + +//Functions not needing redefinition > > +%feature("docstring")"create(str name, str path) -> int + +Create a new > > tracing session using name and path. +Returns size of returned session > > payload data or a negative error code." +int lttng_create_session(const > > char *name, const char *path); + + +%feature("docstring")"destroy(str name) > > -> int + +Tear down tracing session using name. +Returns size of returned > > session payload data or a negative error code." +int > > lttng_destroy_session(const char *name); + + > > +%feature("docstring")"session_daemon_alive() -> int + +Check if session > > daemon is alive. +Return 1 if alive or 0 if not. +On error returns a > > negative value." +int lttng_session_daemon_alive(void); + + > > +%feature("docstring")"set_tracing_group(str name) -> int + +Sets the > > tracing_group variable with name. +This function allocates memory pointed > > to by tracing_group. +On success, returns 0, on error, returns -1 (null > > name) or -ENOMEM." +int lttng_set_tracing_group(const char *name); + + > > +%feature("docstring")"strerror(int code) -> char + +Returns a human > > readable string describing +the error code (a negative value)." +const char > > *lttng_strerror(int code); + + +%feature("docstring")"start(str > > session_name) -> int + +Start tracing for all traces of the session. > > +Returns size of returned session payload data or a negative error code." > > +int lttng_start_tracing(const char *session_name); + + > > +%feature("docstring")"stop(str session_name) -> int + +Stop tracing for > > all traces of the session. +Returns size of returned session payload data > > or a negative error code." +int lttng_stop_tracing(const char > > *session_name); + + +%feature("docstring")"channel_set_default_attr(Domain > > domain, ChannelAttr attr) + +Set default channel attributes. +If either or > > both of the arguments are null, attr content is zeroe'd." +void > > lttng_channel_set_default_attr(struct lttng_domain *domain, struct > > lttng_channel_attr *attr); + + +// > > ============================================= +// Python redefinition of > > some functions +// (List and Handle-related) +// > > ============================================= + +%feature("docstring")"" > > +%pythoncode %{ + +def list_sessions(): + """ + list_sessions() -> dict + + > > Ask the session daemon for all available sessions. + Returns a dict of > > Session instances, the key is the name; + on error, returns a negative > > value. + """ + + ses_list = _lttng_list_sessions() + if type(ses_list) is > > int: + return ses_list + + sessions = {} + + for ses_elements in > > ses_list: + ses = Session() + ses.name = ses_elements[0] + ses.path = > > ses_elements[1] + ses.enabled = ses_elements[2] + ses.padding = > > ses_elements[3] + + sessions[ses.name] = ses + + return sessions + + +def > > list_domains(session_name): + """ + list_domains(str session_name) -> list > > + + Ask the session daemon for all available domains of a session. + > > Returns a list of Domain instances; + on error, returns a negative value. + > > """ + + dom_list = _lttng_list_domains(session_name) + if type(dom_list) is > > int: + return dom_list + + domains = [] + + for dom_elements in dom_list: > > + dom = Domain() + dom.type = dom_elements[0] + dom.paddinf = > > dom_elements[1] + dom.attr.pid = dom_elements[2] + dom.attr.exec_name = > > dom_elements[3] + dom.attr.padding = dom_elements[4] + + > > domains.append(dom) + + return domains + + +def list_channels(handle): + > > """ + list_channels(Handle handle) -> dict + + Ask the session daemon for > > all available channels of a session. + Returns a dict of Channel instances, > > the key is the name; + on error, returns a negative value. + """ + + try: + > > chan_list = _lttng_list_channels(handle._h) + except AttributeError: + > > raise TypeError("in method 'list_channels', argument 1 must be a Handle > > instance") + + if type(chan_list) is int: + return chan_list + + channels > > = {} + + for channel_elements in chan_list: + chan = Channel() + > > chan.name = channel_elements[0] + chan.enabled = channel_elements[1] + > > chan.padding = channel_elements[2] + chan.attr.overwrite = > > channel_elements[3][0] + chan.attr.subbuf_size = channel_elements[3][1] + > > chan.attr.num_subbuf = channel_elements[3][2] + > > chan.attr.switch_timer_interval = channel_elements[3][3] + > > chan.attr.read_timer_interval = channel_elements[3][4] + chan.attr.output > > = channel_elements[3][5] + chan.attr.padding = channel_elements[3][6] + + > > channels[chan.name] = chan + + return channels + + +def list_events(handle, > > channel_name): + """ + list_events(Handle handle, str channel_name) -> > > dict + + Ask the session daemon for all available events of a session > > channel. + Returns a dict of Event instances, the key is the name; + on > > error, returns a negative value. + """ + + try: + ev_list = > > _lttng_list_events(handle._h, channel_name) + except AttributeError: + > > raise TypeError("in method 'list_events', argument 1 must be a Handle > > instance") + + if type(ev_list) is int: + return ev_list + + events = {} > > + + for ev_elements in ev_list: + ev = Event() + ev.name = > > ev_elements[0] + ev.type = ev_elements[1] + ev.loglevel_type = > > ev_elements[2] + ev.loglevel = ev_elements[3] + ev.enabled = > > ev_elements[4] + ev.pid = ev_elements[5] + ev.attr.padding = > > ev_elements[6] + ev.attr.probe.addr = ev_elements[7][0] + > > ev.attr.probe.offset = ev_elements[7][1] + ev.attr.probe.symbol_name = > > ev_elements[7][2] + ev.attr.probe.padding = ev_elements[7][3] + > > ev.attr.ftrace.symbol_name = ev_elements[8][0] + ev.attr.ftrace.padding = > > ev_elements[8][1] + ev.attr.padding = ev_elements[9] + + events[ev.name] > > = ev + + return events + + +def list_tracepoints(handle): + """ + > > list_tracepoints(Handle handle) -> dict + + Returns a dict of Event > > instances, the key is the name; + on error, returns a negative value. + > > """ + + try: + ev_list = _lttng_list_tracepoints(handle._h) + except > > AttributeError: + raise TypeError("in method 'list_tracepoints', argument > > 1 must be a Handle instance") + + if type(ev_list) is int: + return > > ev_list + + events = {} + + for ev_elements in ev_list: + ev = Event() + > > ev.name = ev_elements[0] + ev.type = ev_elements[1] + ev.loglevel_type = > > ev_elements[2] + ev.loglevel = ev_elements[3] + ev.enabled = > > ev_elements[4] + ev.pid = ev_elements[5] + ev.attr.padding = > > ev_elements[6] + ev.attr.probe.addr = ev_elements[7][0] + > > ev.attr.probe.offset = ev_elements[7][1] + ev.attr.probe.symbol_name = > > ev_elements[7][2] + ev.attr.probe.padding = ev_elements[7][3] + > > ev.attr.ftrace.symbol_name = ev_elements[8][0] + ev.attr.ftrace.padding = > > ev_elements[8][1] + ev.attr.padding = ev_elements[9] + + events[ev.name] > > = ev + + return events + + +def register_consumer(handle, socket_path): + > > """ + register_consumer(Handle handle, str socket_path) -> int + + Register > > an outside consumer. + Returns size of returned session payload data or a > > negative error code. + """ + + try: + return > > _lttng_register_consumer(handle._h, socket_path) + except AttributeError: + > > raise TypeError("in method 'register_consumer', argument 1 must be a Handle > > instance") + + +def add_context(handle, event_context, event_name, > > channel_name): + """ + add_context(Handle handle, EventContext ctx, + > > str event_name, str channel_name) -> int + + Add context to event and/or > > channel. + If event_name is None, the context is applied to all events of > > the channel. + If channel_name is None, a lookup of the event's channel is > > done. + If both are None, the context is applied to all events of all > > channels. + Returns the size of the returned payload data or a negative > > error code. + """ + + try: + return _lttng_add_context(handle._h, > > event_context, event_name, channel_name) + except AttributeError: + raise > > TypeError("in method 'add_context', argument 1 must be a Handle instance") > > + + +def enable_event(handle, event, channel_name): + """ + > > enable_event(Handle handle, Event event, + str channel_name) -> int + > > + Enable event(s) for a channel. + If no event name is specified, all > > events are enabled. + If no channel name is specified, the default > > 'channel0' is used. + Returns size of returned session payload data or a > > negative error code. + """ + + try: + return > > _lttng_enable_event(handle._h, event, channel_name) + except > > AttributeError: + raise TypeError("in method 'enable_event', argument 1 > > must be a Handle instance") + + +def enable_channel(handle, channel): + > > """ + enable_channel(Handle handle, Channel channel -> int + + Enable > > channel per domain + Returns size of returned session payload data or a > > negative error code. + """ + + try: + return > > _lttng_enable_channel(handle._h, channel) + except AttributeError: + raise > > TypeError("in method 'enable_channel', argument 1 must be a Handle > > instance") + + +def disable_event(handle, name, channel_name): + """ + > > disable_event(Handle handle, str name, str channel_name) -> int + + Disable > > event(s) of a channel and domain. + If no event name is specified, all > > events are disabled. + If no channel name is specified, the default > > 'channel0' is used. + Returns size of returned session payload data or a > > negative error code + """ + + try: + return > > _lttng_disable_event(handle._h, name, channel_name) + except > > AttributeError: + raise TypeError("in method 'disable_event', argument 1 > > must be a Handle instance") + + +def disable_channel(handle, name): + """ + > > disable_channel(Handle handle, str name) -> int + + All tracing will be > > stopped for registered events of the channel. + Returns size of returned > > session payload data or a negative error code. + """ + + try: + return > > _lttng_disable_channel(handle._h, name) + except AttributeError: + raise > > TypeError("in method 'disable_channel', argument 1 must be a Handle > > instance") + + +def calibrate(handle, calibrate): + """ + calibrate(Handle > > handle, Calibrate calibrate) -> int + + Quantify LTTng overhead. + Returns > > size of returned session payload data or a negative error code. + """ + + > > try: + return _lttng_calibrate(handle._h, calibrate) + except > > AttributeError: + raise TypeError("in method 'calibrate', argument 1 must > > be a Handle instance") +%} + + +// > > ============================================= +// Handle class +// Used > > to prevent freeing unallocated memory +// > > ============================================= + +%feature("docstring")"" > > +%feature("autodoc", "1"); + +%pythoncode %{ +class Handle: + """ + > > Manages a handle. + Takes two arguments: (str session_name, Domain domain) > > + """ + + __frozen = False + + def __init__(self, session_name, domain): + > > if type(session_name) is not str: + raise TypeError("in method > > '__init__', argument 2 of type 'str'") + if type(domain) is not Domain and > > domain is not None: + raise TypeError("in method '__init__', argument 3 > > of type 'lttng.Domain'") + + self._sname = session_name + if domain is > > None: + self._domtype = None + else: + self._domtype = domain.type + > > self._h = _lttng_create_handle(session_name, domain) + self.__frozen = > > True + + def __del__(self): + _lttng_destroy_handle(self._h) + + def > > __repr__(self): + if self._domtype == 1: + domstr = "DOMAIN_KERNEL" + > > elif self._domtype == 2: + domstr = "DOMAIN_UST" + else: + domstr = > > self._domtype + + return "lttng.Handle; session('{}'), > > domain.type({})".format( + self._sname, domstr) + + def __setattr__(self, > > attr, val): + if self.__frozen: + raise NotImplementedError("cannot > > modify attributes") + else: + self.__dict__[attr] = val +%} + + +// > > ============================================= +// STRUCTURES +// > > ============================================= + +%rename("Domain") > > lttng_domain; +%rename("EventContext") lttng_event_context; > > +%rename("Event") lttng_event; +%rename("Calibrate") lttng_calibrate; > > +%rename("ChannelAttr") lttng_channel_attr; +%rename("Channel") > > lttng_channel; +%rename("Session") lttng_session; + +struct lttng_domain{ + > > enum lttng_domain_type type; + char padding[LTTNG_DOMAIN_PADDING1]; + + > > union { + pid_t pid; + char exec_name[NAME_MAX]; + char > > padding[LTTNG_DOMAIN_PADDING2]; + } attr; + + %extend { + char > > *__repr__() { + static char temp[256]; + switch ( $self->type ) { + > > case 1: + sprintf(temp, "lttng.Domain; type(DOMAIN_KERNEL)"); + > > break; + case 2: + sprintf(temp, "lttng.Domain; type(DOMAIN_UST)"); + > > break; + default: + sprintf(temp, "lttng.Domain; type(%i)", > > $self->type); + break; + } + return &temp[0]; + } + } +}; + +struct > > lttng_event_context { + enum lttng_event_context_type ctx; + char > > padding[LTTNG_EVENT_CONTEXT_PADDING1]; + + union { + struct > > lttng_event_perf_counter_ctx perf_counter; + char > > padding[LTTNG_EVENT_CONTEXT_PADDING2]; + } u; + + %extend { + char > > *__repr__() { + static char temp[256]; + switch ( $self->ctx ) { + > > case 0: + sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_PID)"); + > > break; + case 1: + sprintf(temp, "lttng.EventContext; > > ctx(EVENT_CONTEXT_PERF_COUNTER)"); + break; + case 2: + > > sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_PROCNAME)"); + > > break; + case 3: + sprintf(temp, "lttng.EventContext; > > ctx(EVENT_CONTEXT_PRIO)"); + break; + case 4: + sprintf(temp, > > "lttng.EventContext; ctx(EVENT_CONTEXT_NICE)"); + break; + case 5: + > > sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_VPID)"); + break; + > > case 6: + sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_TID)"); + > > break; + case 7: + sprintf(temp, "lttng.EventContext; > > ctx(EVENT_CONTEXT_VTID)"); + break; + case 8: + sprintf(temp, > > "lttng.EventContext; ctx(EVENT_CONTEXT_PPID)"); + break; + case 9: + > > sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_VPPID)"); + break; > > + case 10: + sprintf(temp, "lttng.EventContext; > > ctx(EVENT_CONTEXT_PTHREAD_ID)"); + break; + default: + > > sprintf(temp, "lttng.EventContext; type(%i)", $self->ctx); + break; + > > } + return &temp[0]; + } + } +}; + +struct lttng_event_probe_attr { + > > uint64_t addr; + uint64_t offset; + char > > symbol_name[LTTNG_SYMBOL_NAME_LEN]; + char > > padding[LTTNG_EVENT_PROBE_PADDING1]; +}; + +struct > > lttng_event_function_attr { + char symbol_name[LTTNG_SYMBOL_NAME_LEN]; + > > char padding[LTTNG_EVENT_FUNCTION_PADDING1]; +}; + +struct lttng_event { + > > enum lttng_event_type type; + char name[LTTNG_SYMBOL_NAME_LEN]; + + enum > > lttng_loglevel_type loglevel_type; + int loglevel; + + int32_t enabled; + > > pid_t pid; + + char padding[LTTNG_EVENT_PADDING1]; + + union { + struct > > lttng_event_probe_attr probe; + struct lttng_event_function_attr ftrace; > > + + char padding[LTTNG_EVENT_PADDING2]; + } attr; + + %extend { + char > > *__repr__() { + static char temp[512]; + char evtype[50]; + char > > logtype[50]; + + switch ( $self->type ) { + case -1: + > > sprintf(evtype, "EVENT_ALL"); + break; + case 0: + sprintf(evtype, > > "EVENT_TRACEPOINT"); + break; + case 1: + sprintf(evtype, > > "EVENT_PROBE"); + break; + case 2: + sprintf(evtype, > > "EVENT_FUNCTION"); + break; + case 3: + sprintf(evtype, > > "EVENT_FUNCTION_ENTRY"); + break; + case 4: + sprintf(evtype, > > "EVENT_NOOP"); + break; + case 5: + sprintf(evtype, > > "EVENT_SYSCALL"); + break; + default: + sprintf(evtype, "%i", > > $self->type); + break; + } + + switch ( $self->loglevel_type ) { + > > case 0: + sprintf(logtype, "EVENT_LOGLEVEL_ALL"); + break; + case > > 1: + sprintf(logtype, "EVENT_LOGLEVEL_RANGE"); + break; + case 2: + > > sprintf(logtype, "EVENT_LOGLEVEL_SINGLE"); + break; + default: + > > sprintf(logtype, "%i", $self->loglevel_type); + break; + } + + > > sprintf(temp, "lttng.Event; name('%s'), type(%s), " + > > "loglevel_type(%s), loglevel(%i), " + "enabled(%s), pid(%i)", + > > $self->name, evtype, logtype, $self->loglevel, + $self->enabled ? "True" > > : "False", $self->pid); + return &temp[0]; + } + } +}; + +struct > > lttng_calibrate { + enum lttng_calibrate_type type; + char > > padding[LTTNG_CALIBRATE_PADDING1]; + + %extend { + char *__repr__() { + > > static char temp[256]; + switch ( $self->type ) { + case 0: + > > sprintf(temp, "lttng.Calibrate; type(CALIBRATE_FUNCTION)"); + break; + > > default: + sprintf(temp, "lttng.Calibrate; type(%i)", $self->type); + > > break; + } + return &temp[0]; + } + } +}; + +struct lttng_channel_attr > > { + int overwrite; + uint64_t subbuf_size; + uint64_t num_subbuf; + > > unsigned int switch_timer_interval; + unsigned int read_timer_interval; + > > enum lttng_event_output output; + + char > > padding[LTTNG_CHANNEL_ATTR_PADDING1]; + + %extend { + char *__repr__() { > > + static char temp[256]; + char evout[25]; + + switch ( $self->output > > ) { + case 0: + sprintf(evout, "EVENT_SPLICE"); + break; + case > > 1: + sprintf(evout, "EVENT_MMAP"); + break; + default: + > > sprintf(evout, "%i", $self->output); + break; + } + sprintf(temp, > > "lttng.ChannelAttr; overwrite(%i), subbuf_size(%lu), " + > > "num_subbuf(%lu), switch_timer_interval(%u), " + > > "read_timer_interval(%u), output(%s)", + $self->overwrite, > > $self->subbuf_size, $self->num_subbuf, + $self->switch_timer_interval, > > $self->read_timer_interval, + evout); + return &temp[0]; + } + } +}; > > + +struct lttng_channel { + char name[LTTNG_SYMBOL_NAME_LEN]; + uint32_t > > enabled; + struct lttng_channel_attr attr; + char > > padding[LTTNG_CHANNEL_PADDING1]; + + %extend { + char *__repr__() { + > > static char temp[512]; + sprintf(temp, "lttng.Channel; name('%s'), > > enabled(%s)", + $self->name, $self->enabled ? "True" : "False"); + > > return &temp[0]; + } + } +}; + +struct lttng_session { + char > > name[NAME_MAX]; + char path[PATH_MAX]; + uint32_t enabled; + char > > padding[LTTNG_SESSION_PADDING1]; + + %extend { + char *__repr__() { + > > static char temp[512]; + sprintf(temp, "lttng.Session; name('%s'), > > path('%s'), enabled(%s)", + $self->name, $self->path, + > > $self->enabled ? "True" : "False"); + return &temp[0]; + } + } +}; diff > > --git a/src/python/tests/example.py b/src/python/tests/example.py new file > > mode 100644 index 0000000..9703170 --- /dev/null +++ > > b/src/python/tests/example.py @@ -0,0 +1,109 @@ +#This example shows > > basically how to use the lttng-tools python module + +from lttng import * > > + +# This error will be raised is something goes wrong +class > > LTTngError(Exception): + def __init__(self, value): + self.value = value + > > def __str__(self): + return repr(self.value) + +#Setting up the domain to > > use +dom = Domain() +dom.type = DOMAIN_KERNEL + +#Setting up a channel to > > use +channel = Channel() +channel.name = "mychan" +channel.attr.overwrite = > > 0 +channel.attr.subbuf_size = 4096 +channel.attr.num_subbuf = 8 > > +channel.attr.switch_timer_interval = 0 +channel.attr.read_timer_interval = > > 200 +channel.attr.output = EVENT_SPLICE + +#Setting up some events that > > will be used +event = Event() +event.type = EVENT_TRACEPOINT > > +event.loglevel_type = EVENT_LOGLEVEL_ALL + +sched_switch = Event() > > +sched_switch.name = "sched_switch" +sched_switch.type = EVENT_TRACEPOINT > > +sched_switch.loglevel_type = EVENT_LOGLEVEL_ALL + +sched_process_exit = > > Event() +sched_process_exit.name = "sched_process_exit" > > +sched_process_exit.type = EVENT_TRACEPOINT > > +sched_process_exit.loglevel_type = EVENT_LOGLEVEL_ALL + > > +sched_process_free = Event() +sched_process_free.name = > > "sched_process_free" +sched_process_free.type = EVENT_TRACEPOINT > > +sched_process_free.loglevel_type = EVENT_LOGLEVEL_ALL + + +#Creating a new > > session +res = create("test","/lttng-traces/test") +if res<0: + raise > > LTTngError(strerror(res)) + +#Creating handle +han = None +han = > > Handle("test", dom) +if han is None: + raise LTTngError("Handle not > > created") + +#Enabling the kernel channel +res = enable_channel(han, > > channel) +if res<0: + raise LTTngError(strerror(res)) + +#Enabling some > > events in given channel +#To enable all events in default channel, use > > +#enable_event(han, event, None) +res = enable_event(han, sched_switch, > > channel.name) +if res<0: + raise LTTngError(strerror(res)) + +res = > > enable_event(han, sched_process_exit, channel.name) +if res<0: + raise > > LTTngError(strerror(res)) + +res = enable_event(han, sched_process_free, > > channel.name) +if res<0: + raise LTTngError(strerror(res)) + +#Disabling an > > event +res = disable_event(han, sched_switch.name, channel.name) +if > > res<0: + raise LTTngError(strerror(res)) + +#Getting a list of the > > channels +l = list_channels(han) +if type(l) is int: + raise > > LTTngError(strerror(l)) + +#Starting the trace +res = start("test") +if > > res<0: + raise LTTngError(strerror(res)) + +#Stopping the trace +res = > > stop("test") +if res<0: + raise LTTngError(strerror(res)) + +#Disabling a > > channel +res = disable_channel(han, channel.name) +if res<0: + raise > > LTTngError(strerror(res)) + +#Destroying the handle +del han + +#Destroying > > the session +res = destroy("test") +if res<0: + raise > > LTTngError(strerror(res)) diff --git a/src/python/tests/run.sh > > b/src/python/tests/run.sh new file mode 100644 index 0000000..7de819b --- > > /dev/null +++ b/src/python/tests/run.sh @@ -0,0 +1 @@ +python tests.py diff > > --git a/src/python/tests/tests.py b/src/python/tests/tests.py new file mode > > 100644 index 0000000..a4be981 --- /dev/null +++ > > b/src/python/tests/tests.py @@ -0,0 +1,310 @@ +import unittest +import os > > +import time +from lttng import * + +class TestLttngPythonModule > > (unittest.TestCase): + + def test_kernel_all_events(self): + dom = > > Domain() + dom.type = DOMAIN_KERNEL + + event = Event() + event.type = > > EVENT_TRACEPOINT + event.loglevel_type = EVENT_LOGLEVEL_ALL + + han = > > Handle("test_kernel_all_ev", dom) + + r = > > create("test_kernel_all_ev","/lttng-traces/test") + > > self.assertGreaterEqual(r, 0, strerror(r)) + + r = enable_event(han, > > event, None) + self.assertGreaterEqual(r, 0, strerror(r)) + + r = > > start("test_kernel_all_ev") + self.assertGreaterEqual(r, 0, strerror(r)) + > > time.sleep(2) + + r = stop("test_kernel_all_ev") + > > self.assertGreaterEqual(r, 0, strerror(r)) + + r = > > destroy("test_kernel_all_ev") + self.assertGreaterEqual(r, 0, > > strerror(r)) + + + def test_kernel_event(self): + + dom = Domain() + > > dom.type = DOMAIN_KERNEL + + channel = Channel() + channel.name="mychan" > > + channel.attr.overwrite = 0 + channel.attr.subbuf_size = 4096 + > > channel.attr.num_subbuf = 8 + channel.attr.switch_timer_interval = 0 + > > channel.attr.read_timer_interval = 200 + channel.attr.output = > > EVENT_SPLICE + + sched_switch = Event() + sched_switch.name = > > "sched_switch" + sched_switch.type = EVENT_TRACEPOINT + > > sched_switch.loglevel_type = EVENT_LOGLEVEL_ALL + + sched_process_exit = > > Event() + sched_process_exit.name = "sched_process_exit" + > > sched_process_exit.type = EVENT_TRACEPOINT + > > sched_process_exit.loglevel_type = EVENT_LOGLEVEL_ALL + + > > sched_process_free = Event() + sched_process_free.name = > > "sched_process_free" + sched_process_free.type = EVENT_TRACEPOINT + > > sched_process_free.loglevel_type = EVENT_LOGLEVEL_ALL + + han = > > Handle("test_kernel_event", dom) + + #Create session test + r = > > create("test_kernel_event","/lttng-traces/test") + > > self.assertGreaterEqual(r, 0, strerror(r)) + + #Enabling channel tests + > > r = enable_channel(han, channel) + self.assertGreaterEqual(r, 0, > > strerror(r)) + + #Enabling events tests + r = enable_event(han, > > sched_switch, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) > > + + r = enable_event(han, sched_process_exit, channel.name) + > > self.assertGreaterEqual(r, 0, strerror(r)) + + r = enable_event(han, > > sched_process_free, channel.name) + self.assertGreaterEqual(r, 0, > > strerror(r)) + + #Disabling events tests + r = disable_event(han, > > sched_switch.name, channel.name) + self.assertGreaterEqual(r, 0, > > strerror(r)) + + r = disable_event(han, sched_process_free.name, > > channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + #Renabling > > events tests + r = enable_event(han, sched_switch, channel.name) + > > self.assertGreaterEqual(r, 0, strerror(r)) + + r = enable_event(han, > > sched_process_free, channel.name) + self.assertGreaterEqual(r, 0, > > strerror(r)) + + #Start, stop, destroy + r = start("test_kernel_event") + > > self.assertGreaterEqual(r, 0, strerror(r)) + time.sleep(2) + + r = > > stop("test_kernel_event") + self.assertGreaterEqual(r, 0, strerror(r)) + + > > r=disable_channel(han, channel.name) + self.assertGreaterEqual(r, 0, > > strerror(r)) + + r=destroy("test_kernel_event") + > > self.assertGreaterEqual(r, 0, strerror(r)) + + + + def > > test_ust_all_events(self): + dom = Domain() + dom.type = DOMAIN_UST + + > > event = Event() + event.type = EVENT_TRACEPOINT + event.loglevel_type = > > EVENT_LOGLEVEL_ALL + + han = Handle("test_ust_all_ev", dom) + + r = > > create("test_ust_all_ev","/lttng-traces/test") + > > self.assertGreaterEqual(r, 0, strerror(r)) + + r = enable_event(han, > > event, None) + self.assertGreaterEqual(r, 0, strerror(r)) + + r = > > start("test_ust_all_ev") + self.assertGreaterEqual(r, 0, strerror(r)) + > > time.sleep(2) + + r = stop("test_ust_all_ev") + > > self.assertGreaterEqual(r, 0, strerror(r)) + + r = > > destroy("test_ust_all_ev") + self.assertGreaterEqual(r, 0, strerror(r)) + > > + + def test_ust_event(self): + + dom = Domain() + dom.type = DOMAIN_UST > > + + channel = Channel() + channel.name="mychan" + channel.attr.overwrite > > = 0 + channel.attr.subbuf_size = 4096 + channel.attr.num_subbuf = 8 + > > channel.attr.switch_timer_interval = 0 + channel.attr.read_timer_interval > > = 200 + channel.attr.output = EVENT_MMAP + + ev1 = Event() + ev1.name = > > "tp1" + ev1.type = EVENT_TRACEPOINT + ev1.loglevel_type = > > EVENT_LOGLEVEL_ALL + + ev2 = Event() + ev2.name = "ev2" + ev2.type = > > EVENT_TRACEPOINT + ev2.loglevel_type = EVENT_LOGLEVEL_ALL + + ev3 = > > Event() + ev3.name = "ev3" + ev3.type = EVENT_TRACEPOINT + > > ev3.loglevel_type = EVENT_LOGLEVEL_ALL + + han = Handle("test_ust_event", > > dom) + + #Create session test + r = > > create("test_ust_event","/lttng-traces/test") + self.assertGreaterEqual(r, > > 0, strerror(r)) + + #Enabling channel tests + r = enable_channel(han, > > channel) + self.assertGreaterEqual(r, 0, strerror(r)) + + #Enabling > > events tests + r = enable_event(han, ev1, channel.name) + > > self.assertGreaterEqual(r, 0, strerror(r)) + + r = enable_event(han, ev2, > > channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + r = > > enable_event(han, ev3, channel.name) + self.assertGreaterEqual(r, 0, > > strerror(r)) + + #Disabling events tests + r = disable_event(han, > > ev1.name, channel.name) + self.assertGreaterEqual(r, 0, strerror(r)) + + > > r = disable_event(han, ev3.name, channel.name) + > > self.assertGreaterEqual(r, 0, strerror(r)) + + #Renabling events tests + > > r = enable_event(han, ev1, channel.name) + self.assertGreaterEqual(r, 0, > > strerror(r)) + + r = enable_event(han, ev3, channel.name) + > > self.assertGreaterEqual(r, 0, strerror(r)) + + #Start, stop + r = > > start("test_ust_event") + self.assertGreaterEqual(r, 0, strerror(r)) + > > time.sleep(2) + + r = stop("test_ust_event") + self.assertGreaterEqual(r, > > 0, strerror(r)) + + #Restart/restop + r = start("test_ust_event") + > > self.assertGreaterEqual(r, 0, strerror(r)) + time.sleep(2) + + r = > > stop("test_ust_event") + self.assertGreaterEqual(r, 0, strerror(r)) + + > > #Disabling channel and destroy + r=disable_channel(han, channel.name) + > > self.assertGreaterEqual(r, 0, strerror(r)) + + > > r=destroy("test_ust_event") + self.assertGreaterEqual(r, 0, strerror(r)) > > + + + def test_other_functions(self): + dom = Domain() + > > dom.type=DOMAIN_KERNEL + + event=Event() + event.type=EVENT_TRACEPOINT + > > event.loglevel_type=EVENT_LOGLEVEL_ALL + + calib = Calibrate() + > > calib.type = CALIBRATE_FUNCTION + + ctx = EventContext() + > > ctx.type=EVENT_CONTEXT_PID + + chattr = ChannelAttr() + chattr.overwrite > > = 0 + chattr.subbuf_size = 4096 + chattr.num_subbuf = 8 + > > chattr.switch_timer_interval = 0 + chattr.read_timer_interval = 200 + > > chattr.output = EVENT_SPLICE + + han = Handle("test_otherf" , dom) + + r > > = create("test_otherf","/lttng-traces/test") + self.assertGreaterEqual(r, > > 0, strerror(r)) + + r = enable_event(han, event, None) + > > self.assertGreaterEqual(r, 0, strerror(r)) + + #Calibrate test + r = > > calibrate(han , calib) + self.assertGreaterEqual(r, 0, strerror(r)) + + > > #Context test + r = add_context(han, ctx, "sched_switch", "channel0") + > > self.assertGreaterEqual(r, 0, strerror(r)) + #Any channel + r = > > add_context(han, ctx, "sched_wakeup", None) + self.assertGreaterEqual(r, > > 0, strerror(r)) + #All events + r = add_context(han, ctx, None, None) + > > self.assertGreaterEqual(r, 0, strerror(r)) + + #Def. channel attr + > > channel_set_default_attr(dom, chattr) + channel_set_default_attr(None, > > None) + + #Ses Daemon alive + r = session_daemon_alive() + > > self.assertTrue(r == 1 or r == 0, strerror(r)) + + #Setting trace group + > > r = set_tracing_group("testing") + self.assertGreaterEqual(r, 0, > > strerror(r)) + + + r = start("test_otherf") + self.assertGreaterEqual(r, > > 0, strerror(r)) + time.sleep(2) + + r = stop("test_otherf") + > > self.assertGreaterEqual(r, 0, strerror(r)) + + del han + + r = > > destroy("test_otherf") + self.assertGreaterEqual(r, 0, strerror(r)) + + > > +if __name__ == "__main__": + # CHECK IF ROOT + if os.geteuid() == 0: + > > #Make sure session names don't already exist: + > > destroy("test_kernel_event") + destroy("test_kernel_all_events") + > > destroy("test_ust_all_events") + destroy("test_ust_event") + > > destroy("test_otherf") + + unittest.main() + else: + print('Script must > > be run as root') > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.12 (GNU/Linux) > > iQEcBAEBAgAGBQJQGCc4AAoJEELoaioR9I02f68IAKCipHU8psxIkXyUECveu57F > 1ZPe9wzanUrb5eaiLH07mmbVJf/1Bu08eLfiuu1naaV0ZZIa2DenTXHcuC4orGbE > /8KVBYidgDWIzY8lJOnw6wg+zB2ibnfTqtyhNE9Rqgesq6o776QfFgSkqzfQq/2m > BxOsE1jKzx6JbgdquO32KBAyQAgyQu8Z9aJUYgAd3peqrx19pwnWhgnY88rtAzNi > 5ktGj6btK4HAcQ62Q8pmTTaOR0y5sBb7STDYF2pcNMPU3TeLBjkRhl/djva0C7t/ > hPiL8IVT4AYC0y72Oof0kuSgaGIyHAxujAGHeOnOQP3KXhAvrow/bhJodbIo3pU= > =lEVV > -----END PGP SIGNATURE----- -------------- next part -------------- An HTML attachment was scrubbed... URL: From serres at live.ca Tue Jul 31 16:56:57 2012 From: serres at live.ca (Danny Serres) Date: Tue, 31 Jul 2012 16:56:57 -0400 Subject: [lttng-dev] [lttng-tools PATCH] lttng-tools python module In-Reply-To: References: <1343326167-11522-1-git-send-email-danny.serres@efficios.com>, Message-ID: Date: Tue, 31 Jul 2012 15:56:47 -0400 Subject: Re: [lttng-dev] [lttng-tools PATCH] lttng-tools python module From: christian.babeux at efficios.com To: danny.serres at efficios.com CC: lttng-dev at lists.lttng.org Hi Danny, First of all, thank you for your work on Python bindings!This will be very useful in the near future :). Here are some comments on your patch: > SWIG >= 2.0 is used to create the wrapper and its> 'warning md variable unused' bug is patched in Makefile.am.> [...]> diff --git a/src/python/Makefile.am b/src/python/Makefile.am> new file mode 100644> index 0000000..b67d550> --- /dev/null> +++ b/src/python/Makefile.am> [...]> +lttng_wrap.c: lttng.i> + $(SWIG) -python -I. -I$(top_srcdir)/src/common/sessiond-comm lttng.i> + sed -i "s/Python.h/python$(PYTHON_VERSION)\/Python.h/g" lttng_wrap.c> + sed -i "s/PyObject \*m, \*d, \*md;/PyObject \*m, \*d;\n#if defined(SWIGPYTHON_BUILTIN)\nPyObject *md;\n#endif/g" lttng_wrap.c> + sed -i "s/md = d/d/g" lttng_wrap.c> + sed -i "s/(void)public_symbol;/(void)public_symbol;\n md = d;/g" lttng_wrap.c If I understand correctly your commit message, those sed invocations are necessary to remove an 'unused variable warning'. Is this a known upstreambug in SWIG? Yes, it is. So far, it has not been fixed but a patch has been proposed (same as I apply here using sed) (see http://sourceforge.net/tracker/index.php?func=detail&aid=3530021&group_id=1645&atid=101645 ) > + sed -i "s/Python.h/python$(PYTHON_VERSION)\/Python.h/g" lttng_wrap.c This sed replacement didn't work on my machine. I have a Python3 install and the appropriate Python.h header is located in '/usr/include/python3.2mu'.To reliably detect Python include paths, the 'python-config --includes'command can be used like you did in the main configure.ac. I would suggest generating the binding like this: -AM_CFLAGS = -I$(PYTHONINC) -I../lib/lttng-ctl -I../common \ +AM_CFLAGS = -I$(PYTHON_INCLUDE) -I../lib/lttng-ctl -I../common \ $(BUDDY_CFLAGS) [...] lttng_wrap.c: lttng.i $(SWIG) -python -I. -I$(top_srcdir)/src/common/sessiond-comm lttng.i- sed -i "s/Python.h/python$(PYTHON_VERSION)\/Python.h/g" lttng_wrap.c[...] The README should also mention that in order to generate the Python bindings, python headers are also required (python-dev on Debian/Ubuntu). Fixed. I will post a second version soon. Thanks, Danny Thank you, Christian -------------- next part -------------- An HTML attachment was scrubbed... URL: