Introduce hash table for lttng_create_event_if_missing()
lttng_create_event_if_missing() takes a lot of CPU time with stress-test
applications containing 1000 different TRACEPOINT_EVENT() and 1000
individual tracepoint() call-site.
With tracing disabled:
time ./AppWith1000_lines_TP 0
real 0m2.487s
user 0m2.424s
sys 0m0.000s
Introducing this hash table cuts the overhead very significantly when
tracing is enabled:
Samuel Martin [Sun, 13 Jan 2013 16:40:10 +0000 (11:40 -0500)]
Fix: don't build C++ example if a C++ compiler isn't available
By default lttng-ust builds a hello.cxx C++ example that demonstrates
the usage of the userspace tracing library in a C++ program.
Unfortunately, when no C++ support is available, the build of lttng-ust
fails just because of this example code. So we make the compilation of
this code conditional on whether a working C++ compiler was found.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Samuel Martin <s.martin49@gmail.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Pack structures in comm protocol between UST and sessiond
Ensure robustness with respect to 32-bit vs 64-bit apps vs sessiond.
Since we are updating the ABI, change the order of overwrite field in
channel and channel attributes, to remove some unneeded padding.
This breaks compatibility between sessiond 2.1 and ust 2.0 (and
vice-versa), but sessiond refuses applications with version number that
does not match.
ltt_event -> lttng_event mass rename
Rename ltt_chan -> lttng_chan
Rename ltt_session -> lttng_session
Rename enum abstract_types to enum lttng_abstract_types
Rename ltt_transport to lttng_transport
Rename rest of ltt_ prefixes to lttng_
Complete file and symbol renames from LTT/ltt to LTTNG/lttng
Finish ltt->lttng symbol conversion
Reviewed-by: David Goulet <dgoulet@efficios.com> Reviewed-by: Christian Babeux <christian.babeux@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: Conditionally disable tests requiring shared libs support
When building lttng-ust with shared library support explicitly
disabled (e.g.: ./configure --disable-shared), libtool fail with
a fatal error:
CC tp.lo
CC tp2.lo
CCLD liblttng-ust-provider-ust-tests-demo.la
libtool: link: can not build a shared library
libtool: link: See the libtool documentation for more information.
libtool: link: Fatal configuration error.
The build should not fail because some tests require explicit shared
library support, instead they should be skipped.
This patch detect that the --disable-shared flag was passed to the
configure script and toggle the "NO_SHARED" Automake variable.
Thus, the tests that require explicit shared library support can
be skipped when the NO_SHARED variable is true.
[ Edit by Mathieu Desnoyers: add "" in configure.ac to follow the local
coding style. ]
Signed-off-by: Christian Babeux <christian.babeux@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Hollis Blanchard <hollis_blanchard@mentor.com> wrote:
> I seem to have hit a little problem with a "hello world" test app and
> lttng-ust 2.0.3. lttng-ust.git seems to be affected as well. Basically,
> I created a single UST tracepoint, but as soon as I run "lttng
> enable-event -u -a", my app segfaults. The problem seems to be that when
> creating the event to pass to ltt_event_create(), we try to memcpy the
> full 256 bytes of name. However, the name might be shorter, and if we
> get unlucky it falls within 256 bytes of the segment boundary...
Fixing the 3 sites where this issue arise. Manually inspecting all
memcpy in the UST code returned by grep did the job.
Christian Babeux [Sat, 29 Sep 2012 17:37:40 +0000 (13:37 -0400)]
Fix: reloc offset validation error out on filters with no reloc table
The reloc table is currently appended at the end of the bytecode data.
With this scheme, the reloc table offset will be equal to the length
of the bytecode data.
Val. Operator
---- --------
0x40 (FILTER_OP_LOAD_STRING)
0x6D m
0x79 y
0x53 S
0x74 t
0x72 r
0x69 i
0x6E n
0x67 g
0x00 \0
0x40 (FILTER_OP_LOAD_STRING)
0x79 y
0x6F o
0x75 u
0x72 r
0x53 S
0x74 t
0x72 r
0x69 i
0x6E n
0x67 g
0x00 \0
0x0C (FILTER_OP_EQ)
0x01 (FILTER_OP_RETURN)
In this case, we see that the reloc table offset (24) is indeed equal to
the length of the bytecode (24), but the reloc table is _empty_. Thus,
the reloc_offset received in handle_message() will be equal to the
data_size and will be wrongly flagged as not within the data even thought
the filter is entirely valid.
The fix is to simply allow a reloc_offset to be equal to the data_size.
Fixes #342
Signed-off-by: Christian Babeux <christian.babeux@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
The main issue is that get_wait_shm() bypass the fork() wrapper (with
lttng_ust_nest_count), which is responsible for holding the UST mutex
across fork(). Therefore, when exiting the context of the child process,
we execute the destructor, which try to grab the UST mutex, which might
be in pretty much any state.
Given that we don't want this process to try to register to
lttng-sessiond (because this is internal to lttng-ust), we might want to
let it skip the destructor execution. This would actually be the easiest
way out.
Fix: Filter ABI changes to support FILTER_BYTECODE_MAX_LEN (65536)
In order to support the filter bytecode maximum length (65536 bytes),
the lttng_ust_filter_bytecode len field type must be able to
hold more than a uint16_t. Change the field type to a uint32_t.
Also, since the relocation table is located at the end of the actual
bytecode, the reloc_table_offset (reloc_offset in ust-abi) field must
support offset values larger than 65535. Change the field type to a
uint32_t. This change will allow support of relocation table appended
to larger bytecode without breaking the ABI if the need arise in the
future.
Both changes currently breaks the filter ABI, but this should be a
reasonable compromise since the filtering feature has not been
released yet.
Signed-off-by: Christian Babeux <christian.babeux@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
We keep compatiblity with applications (so we're still in the 2.x
versions), but we are breaking compatibility with lttng-consumerd.
Therefore, push the internal version number to 3.0.0.
Compiling on x86-32 shows the following warnings for filter (with gcc
4.3 and 4.4):
././ust_tests_hello.h:28: note: initialized from here
././ust_tests_hello.h:28: error: dereferencing pointer ‘__stack_data.18’ does break strict-aliasing rules
Fix it by using memcpy when copying to the temporary "stack" array used
to send arguments to the filter.
When the consumerd dies (from a SIGKILL), it may close all of its file
descriptors rather abruptly.
We ensured that the UST command threads have all signals blocked, and
they use MSG_NOSIGNAL when sending messages to the sessiond over
sockets.
However, the consumer scheme uses a pipe(2) to transport the "wakeup"
info from the application tracing site to the consumer daemon. It may
send a SIGPIPE to the application in that case, which could kill the
application, an unwanted side-effect.
Block thread SIGPIPE around write() and wait for the signal to fix this.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Acked-by: Christian Babeux <christian.babeux@efficios.com> CC: David Goulet <dgoulet@efficios.com>
Fix: Libtool fails to find dependent libraries when cross-compiling lttng-ust
This problem arise when cross compiling and linking libraries with
indirect libraries dependencies (such as liblttng-ust). This "bug" is
caused by an upstream modification in the libtool package on Debian
system. The libtool "link_all_deplibs" flag is set to "no" by default
on linux targets (AFAIK, other distros set it to "unknown").
The chosen solution is to detect such cases via the configure script
and automagically patch the libtool.m4 by forcing the "link_all_deplibs"
to "unknown".
This fixup can be disabled with the appropriate configure flag:
./configure --disable-libtool-linkdep-fixup
Sample configure output on affected systems:
checking for occurence(s) of link_all_deplibs = no in
./config/libtool.m4... 3
configure: WARNING: the detected libtool will not link all
dependencies, forcing link_all_deplibs = unknown
Fixes: #321 Signed-off-by: Christian Babeux <christian.babeux@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paul Woegerer [Wed, 18 Jul 2012 19:28:44 +0000 (15:28 -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. ]