Philippe Proulx [Tue, 23 May 2017 15:25:05 +0000 (11:25 -0400)]
Fix: do not require lttng-utils.debug-info with --disable-debug-info
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 23 May 2017 02:07:15 +0000 (22:07 -0400)]
Fix: ctf.fs source: append all ctf_fs_trace objects to component's list
This avoids obvious potential leaks.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 22 May 2017 19:33:03 +0000 (15:33 -0400)]
ctf.fs source: recurse to find multiples CTF traces
One port per CTF data stream amongst all the traces that are found
from the user's starting path is created.
The traces are named so as to be able to replicate the original tree
by stripping their common prefix within slash boundaries.
For example: user passes `hello` as the starting path, the component
finds the following traces:
hello/world/kilo
hello/yes
hello/ispep/zero/mini
These traces would be named:
world/kilo
yes
ispep/zero/mini
Another example: user passes `hello` as the starting path, the
component finds the following trace:
hello/world/kilo
In this case, the trace is named `kilo`.
I used realpath() to normalize the paths and make sure that there aren't
`.` or `..` in the trace's name. Opening a trace located directly in `/`
is not supported.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 20 May 2017 01:46:25 +0000 (21:46 -0400)]
Fix warnings emitted by `gcc -Wall`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 20 May 2017 00:49:41 +0000 (20:49 -0400)]
Library: log version (INFO) on construction
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 20 May 2017 00:37:30 +0000 (20:37 -0400)]
babeltrace(1): reset console after graph stops running
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 20 May 2017 00:32:45 +0000 (20:32 -0400)]
logging-internal.h: use __attribute__((format)) to check parameters
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 20 May 2017 00:32:16 +0000 (20:32 -0400)]
Logging: fix wrong parameters, superfluous commas, etc.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 20 May 2017 00:21:33 +0000 (20:21 -0400)]
lib/ctf-ir/event.c: replace some BT_LOGE() with BT_LOGW()
Field serialization can fail because of a user error, for example trying
to serialize a field which is not set.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 19 May 2017 23:56:09 +0000 (19:56 -0400)]
CTF writer: stream: handle automatic fields more securely
The stream.c code for automatically writing the values of selected
fields in the packet context, packet header, and event header fields is
not super secure, in that the user could make the stream object write an
invalid CTF data stream file.
The code is updated to follow those rules:
* Packet header field:
* `magic` field: always force to 0xc1fc1fc1. Override any current
value.
* `uuid` field: always force to trace's UUID. Override any current
value.
* `stream_id`: always force to stream's class's ID. Override any
current value.
* Packet context field:
* `packet_size`: always force to the size of the packet being flushed.
Override any current value.
* `packet_size`: always force to the current packet's offset. Override
any current value.
* `timestamp_begin`: if the field's type is mapped to the stream's
class's clock class, force to the timestamp of the stream's first
recorded event (if any, and if this timestamp is itself mapped to
the same clock class), overriding the user's value.
* `timestamp_end`: if the field's type is mapped to the stream's
class's clock class, force to the timestamp of the stream's last
recorded event (if any, and if this timestamp is itself mapped to
the same clock class), overriding the user's value.
* `events_discarded`: always force to the stream's current discarded
events count (now a dedicated member of the stream object to keep
this value safe). Override any current value.
* Event header field:
* `timestamp`: if the field's type is an integer field type which is
mapped to the stream's class's clock class, force to the current
value of the stream's class's clock, overriding the user's value.
* `id`: if the field's type is an integer field type, force to the
event's class's ID, overriding the user's value.
* If the stream's packet context does not exist or does not contain
a `packet_size` field, the user can only flush the stream one time.
* If the stream's packet context does not exist or does not contain a
`content_size` field, the content size (current offset) of the packet
to flush must be equal to its packet size.
Those rules are more strict than before, but they ensure that the
written stream is valid. Writing an invalid CTF stream, or CTF trace at
all, is not a CTF writer use case. This is in line with the project's
first precept: don't trust the user.
I added assertions which check that the packet size is always a multiple
of 8: this is suggested by CTF 1, and required by (eventual) CTF 2. This
is always the case here because the packet's initial size is 8 pages and
then it's incremented by this value each time. If it is a requirement
that the user should be able to control the packet size, then we should
add a function to set the expected packet size before flushing the
stream, not rely on the `packet_size` field's value.
There are still a few cases which remain to be checked. For example, if
the stream class's event header field type's `id` field does not exist,
and there's more than one event class in the stream's class, we write
the event anyway without any warning: this is because LTTng is known to
have a complex system of `id` and `timestamp` fields with extended
structures depending on the ID value, and the ctf.fs sink component
class uses CTF writer as is. That said, in the most common scenarios,
`id` is an integer field type.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 18 May 2017 23:52:41 +0000 (19:52 -0400)]
Validate CTF semantics in selected CTF IR functions
Before this patch, the semantics suggested by the CTF specification are
not validated in CTF IR itself. For example, the library does not
enforce that, if there's more than one stream class contained in a given
trace, its packet header field type's `stream_id` field must exist
(which also means that the packet header field type must be set).
When you add a stream class to a trace created by a CTF writer object
(implicit when you call bt_ctf_writer_create_stream(), for example), we
proceed to automatically map selected field types to the stream class's
clock if it's set. Those fields are:
* Packet context field type: `timestamp_begin`
* Packet context field type: `timestamp_end`
* Event header field type: `timestamp`
If those fields are not mapped to a clock class, and if there's no
current stream class's clock, then the whole
bt_ctf_trace_add_stream_class() function fails.
Those mappings are needed to make a valid CTF trace. The field types
cannot be mapped at stream class creation time because the user can
override the packet context and event header field types and still have
those fields without a mapping. To make this use case more easy in CTF
writer context, the mapping is always done automatically in
bt_ctf_trace_add_stream_class().
This has the side effect that this sequence of operations is not valid
anymore:
1. Create a trace.
2. Create a default stream class with bt_ctf_trace_add_stream_class().
3. Add the default stream class (2) to the created trace (1).
Because bt_ctf_trace_add_stream_class() creates an initial packet
context field type which contains the `timestamp_begin` and
`timestamp_end` fields, and because those fields are only valid at
bt_ctf_trace_add_stream_class() call time when they are mapped to a
clock class, and because we're not in CTF writer context, then they are
not automatically mapped. This is why, in non CTF writer mode (graph
mode), the user should prefer bt_ctf_stream_class_create_empty(), or
manually get the `timestamp_begin` and `timestamp_end` field types and
map them to a clock class which is also part of the trace in which to
add the stream class.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 18 May 2017 23:49:53 +0000 (19:49 -0400)]
Event notification: make sure contained event has a trace
Because we need to keep support for legacy CTF writer behaviours, we can
still create a "floating" event without its stream class attached to a
trace. Disallow the creation of an event notification with such an event
to provide the guarantee to filter and sink components that you can
always find the trace of an event notification's event.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 18 May 2017 18:52:24 +0000 (14:52 -0400)]
lib/ctf-ir/stream.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 18 May 2017 18:51:12 +0000 (14:51 -0400)]
fields.c: get non-existing field: log level WARN -> VERBOSE
It is possible that a user needs to check if a structure field's field,
for example, is set (exists). If it does not, the given function returns
NULL, but this is not an error: the function is used to check here, not
to create the field.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 18 May 2017 18:50:11 +0000 (14:50 -0400)]
bt_ctf_event_serialize(): do not log whole function (done in stream.c)
We already log the current event being serialized in
bt_ctf_stream_flush(): do not log twice.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 17 May 2017 20:53:31 +0000 (16:53 -0400)]
Fix: lttng-live enum mismatch
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 17 May 2017 20:31:27 +0000 (16:31 -0400)]
lib/ctf-ir/field-types.c: use `int`, not `int64_t` for return value
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 17 May 2017 18:55:35 +0000 (14:55 -0400)]
Fix: lib/ctf-ir/event-class.c: fix warnings on `ret` condition
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 21:35:42 +0000 (17:35 -0400)]
Fix: g_quark_try_string() is usually not a WARN trigger
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 21:18:55 +0000 (17:18 -0400)]
Fix: set no field in event/packet without warnings or failing
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 16 May 2017 18:42:18 +0000 (14:42 -0400)]
lttng-live: handle EINTR and graph cancelation
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 16 May 2017 15:53:22 +0000 (11:53 -0400)]
Fix: invoke bt_ctf_trace_set_is_static only when trace is destroyed
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 04:09:06 +0000 (00:09 -0400)]
lib/ctf-ir/utils.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 04:06:04 +0000 (00:06 -0400)]
lib/ctf-ir/fields.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 02:37:00 +0000 (22:37 -0400)]
lib/values.c: add more verbose/debug logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 02:36:47 +0000 (22:36 -0400)]
lib/ctf-ir/packet.c: add more debug logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 02:35:32 +0000 (22:35 -0400)]
lib/ctf-ir/event-class.c: add more verbose/debug logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 02:34:27 +0000 (22:34 -0400)]
lib/ctf-ir/attributes.c: add assert()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 02:13:25 +0000 (22:13 -0400)]
Update logging guide: more about the WARN level
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 02:03:53 +0000 (22:03 -0400)]
lib/ctf-ir/field-types.c: logging: log more details
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 01:08:06 +0000 (21:08 -0400)]
lib/ctf-ir/event.c: logging: fix log levels and more verbose/debug logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 01:01:02 +0000 (21:01 -0400)]
lib/ctf-ir/field-types.c: logging: log struct/var FT field destruction
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 00:57:45 +0000 (20:57 -0400)]
lib/ctf-ir/field-types.c: logging: log only specific functions
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 00:42:24 +0000 (20:42 -0400)]
lib/ctf-ir/field-types.c: logging: log more details when freezing
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 15 May 2017 21:37:30 +0000 (17:37 -0400)]
lttng-live: change loglevel env var to BABELTRACE_PLUGIN_CTF_LTTNG_LIVE_LOG_LEVEL
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 15 May 2017 21:33:38 +0000 (17:33 -0400)]
lttng-live: ensure that port connections go to the same component
Also has tiny cleanups.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 15 May 2017 20:44:09 +0000 (16:44 -0400)]
Fix: don't call iterator finalize more than once
A finalize may have side-effects that trigger port removal, thus calling
finalize again. Ensure it is not called more than once.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 15 May 2017 15:48:32 +0000 (11:48 -0400)]
Fix: muxer: handle CANCELED status
Since commit
bbd6694a2 "Collect useless graph's connections", the
lttng-live component may return a CANCELED state to the muxer. The muxer
should deal with this state as an "END" state.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 15 May 2017 19:51:32 +0000 (15:51 -0400)]
Update logging guide
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 15 May 2017 19:50:28 +0000 (15:50 -0400)]
lib/ctf-ir/field-types.c: add verbose logging (modifying functions)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 15 May 2017 14:48:10 +0000 (10:48 -0400)]
LTTng live: use common url parser
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Fri, 12 May 2017 21:10:27 +0000 (17:10 -0400)]
Implement cmd_print_lttng_live_sessions
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sun, 14 May 2017 21:34:18 +0000 (17:34 -0400)]
lib/values.c: use assert() instead of checking error
In this case we know that it should not fail.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sun, 14 May 2017 21:33:59 +0000 (17:33 -0400)]
lib/ctf-ir/stream-class.c: logging: fix typo
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sun, 14 May 2017 21:33:09 +0000 (17:33 -0400)]
Logging: use WARN level where appropriate
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sun, 14 May 2017 21:32:00 +0000 (17:32 -0400)]
lib/ctf-ir/field-types.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sun, 14 May 2017 21:31:26 +0000 (17:31 -0400)]
cli/babeltrace.c: logging: add details in graph listeners
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sun, 14 May 2017 07:14:41 +0000 (03:14 -0400)]
lib/ctf-ir/field-path.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sun, 14 May 2017 07:14:20 +0000 (03:14 -0400)]
lib/values.c: logging: log original and copy addresses
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sun, 14 May 2017 06:55:24 +0000 (02:55 -0400)]
lib/ref.c: logging: show current count and new count in messages
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sun, 14 May 2017 06:05:28 +0000 (02:05 -0400)]
lib/ctf-ir/stream-class.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sun, 14 May 2017 04:49:15 +0000 (00:49 -0400)]
lib/ctf-ir/event.c: logging: remove some context given by other statement
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sun, 14 May 2017 04:22:54 +0000 (00:22 -0400)]
lib/values.c: logging: log array size when out of bound
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sun, 14 May 2017 03:01:09 +0000 (23:01 -0400)]
lib/ctf-ir/event-class.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sun, 14 May 2017 01:27:36 +0000 (21:27 -0400)]
lib/ctf-ir/event.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sun, 14 May 2017 01:26:44 +0000 (21:26 -0400)]
Add internal bt_ctf_field_type_id_string()/byte_order_string()
This is to be used by logging.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sun, 14 May 2017 01:25:39 +0000 (21:25 -0400)]
lib/values.c: logging: log value's type name
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 13 May 2017 23:15:22 +0000 (19:15 -0400)]
lib/ctf-ir/clock-class.c: improve logging with clock class's name
Clock class log statements should be easier to follow with a clock
class's name field.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 13 May 2017 22:54:01 +0000 (18:54 -0400)]
Include <babeltrace/lib-logging-internal.h> before anything else
This makes sure that headers which would need this to be included see
what it defines.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 13 May 2017 22:51:10 +0000 (18:51 -0400)]
cli/babeltrace.c: improve main loop's logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 13 May 2017 22:44:45 +0000 (18:44 -0400)]
cli/babeltrace.c: handle usleep()'s error
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 13 May 2017 19:57:47 +0000 (15:57 -0400)]
lib/ctf-ir/packet.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 13 May 2017 19:57:10 +0000 (15:57 -0400)]
cli/babeltrace.c: do not call load_all_plugins() in commands
main() already calls load_all_plugins() when the configuration asks to.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 13 May 2017 19:12:52 +0000 (15:12 -0400)]
logging-internal.h: fix include name in comments
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 13 May 2017 19:08:24 +0000 (15:08 -0400)]
include/babeltrace/object-internal.h: add logging
Because the static inline functions are instrumented in the header
itself, it cannot have its own tag. So this header MUST be included
AFTER including <babeltrace/logging-internal.h>, or anything that
includes this (like <babeltrace/lib-logging-internal.h>).
ctf.lttng-live is modified to respect this, as well as various
instrumented library source files.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 13 May 2017 17:17:45 +0000 (13:17 -0400)]
Collect useless graph's connections
Before this patch, the connections accumulate in the graph's array of
connections and are never destroyed until the graph is destroyed.
However, because it is possible to disconnect the ports of a connection,
it is possible that a graph contains connections that are useless. This
can cause a "leak" of connections, which would be especially experienced
with a graph that contains a source which dynamically adds and removes
many ports that are connected during its lifetime.
The conditions for a connection to be considered useless are:
1. Its reference count is 0. This means only its parent, the graph,
controls its existence.
2. Its ports are disconnected.
3. All its created notification iterators are finalized.
When all the conditions above are satisfied, it is safe to remove the
connection from its parent graph.
Conditions 2 and 3 can be checked in:
* bt_connection_disconnect_ports(): The connection is dead, detached
from its ports, and vice versa, thus satisfying condition 2.
* bt_connection_remove_iterator(): The number of notification iterators
changes; could drop to 0, thus satisfying condition 3.
To accomodate condition 1, a new concept is added to the base object: it
is possible to set a "parent is owner" listener which is called when the
parent becomes the owner of the object (that is, when the object's
reference count drops to 0 and it has a parent). Connection objects use
this callback to possibly remove itself from its parent when all three
conditions above are satisfied.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Fri, 12 May 2017 22:07:51 +0000 (18:07 -0400)]
Implement logging in lttng-live component
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 13 May 2017 01:16:15 +0000 (21:16 -0400)]
cli/babeltrace.c: add logging when the command completes
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 13 May 2017 01:14:11 +0000 (21:14 -0400)]
babeltrace(1): handle SIGINT to cancel the graph gracefully
It goes like this:
1. Ctrl+C
2. SIGINT
3. sigint_handler()
4. Cancel the application's graph.
5. bt_graph_run() eventually returns BT_GRAPH_STATUS_CANCELED or
BT_GRAPH_STATUS_AGAIN.
6. When we get those statuses, we check if the graph is canceled and
quit the loop if so.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 13 May 2017 00:34:50 +0000 (20:34 -0400)]
Fix possible leaks in graph's current design
There was a possible leak when, for example:
* The user has a reference to the graph.
* The graph holds its child sink component.
* The sink component has a reference to a notification iterator.
* The notification iterator has a reference to the source component.
* The source component has a reference to its parent, the graph, because
its reference count is 1 (owned by the notification iterator).
This forms a cycle: sink component owns the notification iterator, which
owns the source component, which owns the graph, which holds the sink
component.
To break this cycle and still guarantee that the lifetime of a
notification iterator's upstream component is equal to or longer than
this iterator's lifetime, we split the notification iterator's
destruction and finalization (user's finalization method) phases. In
other words, a notification iterator can be finalized without being
destroyed. However it is guaranteed that it is always finalized once
destroyed.
A connection keeps a set of created notification iterators (weak
references). There are two possible paths to finalize a notification
iterator:
1. The graph still exists and is not being destroyed, and the final
reference to the notification iterator is put: the notification
is destroyed, and since it has not been finalized yet, it's
finalized during that phase.
2. The graph is being destroyed, and an owner (or more) still owns a
reference to the notification iterator. The graph's destructor first
destroys the graph's connections. Each connection finalizes each
notification iterator in its list, but does not destroy them.
The notification iterators are marked as finalized. Eventually the
graph destroys its components, some of which could put the last
reference to a notification iterator: the notification iterator is
destroyed, but not finalized twice.
When a notification iterator is marked as finalized, calling its "next"
method returns the new BT_NOTIFICATION_ITERATOR_STATUS_CANCELED status
when its queue is empty (instead of BT_NOTIFICATION_ITERATOR_STATUS_END).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 13 May 2017 00:33:32 +0000 (20:33 -0400)]
BT_GRAPH_STATUS_CANCELED is not an error, thus use a positive value
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Fri, 25 Nov 2016 21:25:14 +0000 (16:25 -0500)]
Implement ctf.lttng-live component
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 13 Apr 2017 16:02:55 +0000 (12:02 -0400)]
Fix: IR visitor: error msg printing
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 30 Nov 2016 22:32:23 +0000 (17:32 -0500)]
Move print.h header to upper level dir
Can be used by both fs and lttng-live.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 12 May 2017 19:38:47 +0000 (15:38 -0400)]
utils.muxer: fix ownership of objects
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 21:54:10 +0000 (17:54 -0400)]
Add graph cancellation API
With this API you can cancel a graph with bt_graph_cancel() and
check if a graph is canceled with bt_graph_is_canceled().
A canceled graph is used to indicate to a contained component or
notification iterator if it should retry or not when a system call is
interrupted. This exists mostly to support a clean termination when we
get SIGINT, but with debugger support (a system call is interrupted when
the debugger sends SIGCONT; in this case we need to retry the system
call).
Cancelling a graph also makes bt_graph_run() quit before the next
sink consuming iteration.
It is not allowed to run a canceled graph again. Once it is canceled,
it's dead for good.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 21:44:25 +0000 (17:44 -0400)]
port.{h,c}: use `bt_bool` instead of `int` where appropriate
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 21:41:30 +0000 (17:41 -0400)]
ir: utils: use `bt_bool` instead of `int` where appropriate
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 21:40:55 +0000 (17:40 -0400)]
ir: fields/field-types: use `bt_bool` instead of `int` where appropriate
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 21:21:26 +0000 (17:21 -0400)]
ir: clock class: use bt_bool instead of int for boolean properties
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 21:12:46 +0000 (17:12 -0400)]
Do not use `bool` type; use new `bt_bool` instead
There are possible ABI incompatibilities between C99's `bool` (`_Bool`)
type and C++'s `bool` type, and also between different compilers. For
this reason we choose to use our own boolean type, `bt_bool`, which is
defined as `int`. `BT_FALSE` and `BT_TRUE` are our own definitions for
false and true.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 17:26:34 +0000 (13:26 -0400)]
Update include/babeltrace/babeltrace.h
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 17:24:53 +0000 (13:24 -0400)]
Add extras/gen-babeltrace-h.py: include/babeltrace/babeltrace.h generator
This Python 3 script reads include/Makefile.am and prints the
equivalent content of include/babeltrace/babeltrace.h. From the
source tree's root, you can use it as such:
$ python3 extras/gen-babeltrace-h.py > include/babeltrace/babeltrace.h
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 17:23:19 +0000 (13:23 -0400)]
Move library's version API to include/babeltrace/version.h
Let's keep include/babeltrace/babeltrace.h a master header only.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 17:03:17 +0000 (13:03 -0400)]
include/Makefile.am: add titles (comments) to groups of files
This is because I intend to use this file to automatically generate
include/babeltrace/babeltrace.h.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 16:49:12 +0000 (12:49 -0400)]
Remove "end of trace" notification headers
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 16:46:12 +0000 (12:46 -0400)]
Normalize public header include guards
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 06:17:38 +0000 (02:17 -0400)]
lib/ref.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 06:07:43 +0000 (02:07 -0400)]
lib/ctf-ir/clock-class.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 05:12:20 +0000 (01:12 -0400)]
test_ctf_writer.c: remove negative index tests
The API's type for indexes is always an unsigned integer now, so we
don't need those tests anymore.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 05:12:04 +0000 (01:12 -0400)]
lib/ctf-ir/attributes.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 05:11:41 +0000 (01:11 -0400)]
ir: attributes: fix index and count integer types
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 03:50:18 +0000 (23:50 -0400)]
lib/values.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 03:49:29 +0000 (23:49 -0400)]
tests/lib/Makefile.am: fix check_ vs. noinst_ prefix
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 10 May 2017 17:35:50 +0000 (13:35 -0400)]
cli: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 10 May 2017 06:07:36 +0000 (02:07 -0400)]
common: optimize color code functions
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 8 May 2017 17:04:40 +0000 (13:04 -0400)]
Fix CLI to work with multiple ports and dynamically added ports
This patch makes the CLI actually connect component ports within the
application's graph before running it.
On the command line, you specify the connections like you used to,
except that the ports are not specific ports anymore: they are globbing
patterns (only the `*` special character is supported as of this
version) which specify: when a new upstream port matches the left part
of the connection argument (specific component and port name globbing
pattern), connect it to the first port that matches the right part
(specific component and port name globbing pattern). For example:
src.*meow*:sink.master-*
would make babeltrace(1) connect all the ports of the component instance
`src` of which the names match `*meow*` to the next available port
of the instance `sink` of which the name matches `master-*`.
This mechanism allows to connect specific ports together, or to connect
group of ports or any ports using wildcards.
The code for the globbing pattern matching was grabbed from the
LTTng-UST project and I'm one of the copyright holders anyway.
This patch also adds a --retry-duration option to the `connect` and
`run` commands to specify how many microseconds the program should
wait when the graph returns BT_GRAPH_STATUS_AGAIN (do not wait when 0).
The default duration is 100 ms.
Some files are renamed to match what they really are. The concept of a
Babeltrace configuration (`bt_config`) is beyond the command-line
arguments: it could eventually be read from a configuration file, etc.
babeltrace-cfg-cli-args.c is a module which can create a Babeltrace
configuration out of command-line arguments.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 8 May 2017 17:04:03 +0000 (13:04 -0400)]
Add logging API (internal to log, public to set the current log level)
See doc/logging-guide.adoc which explains the whole logging API, how to
set and initialize the log levels, how to write logging statements, etc.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 8 May 2017 23:40:27 +0000 (19:40 -0400)]
bt_common_shell_quote(): accept new parameter `with_single_quotes`
This parameter indicates if the function must put the initial and final
`'` character itself or if it's the caller's job.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 5 May 2017 20:49:32 +0000 (16:49 -0400)]
Rename tests/bin -> tests/cli
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.042164 seconds and 4 git commands to generate.