Jérémie Galarneau [Fri, 7 Jul 2017 18:58:31 +0000 (14:58 -0400)]
Fix: ds_file_group is checked instead of ds_file_group->stream
** CID
1377287: Null pointer dereferences (REVERSE_INULL)
/plugins/ctf/fs-src/fs.c: 902 in create_ds_file_groups()
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 7 Jul 2017 01:55:48 +0000 (21:55 -0400)]
Fix babeltrace-log(1) for Babeltrace 2
This fixes babeltrace-log(1) so that it works with the Babeltrace 2
tree.
What the program does now is to parse its arguments, create the
arguments to be passed to the babeltrace(1) CLI tool, and spawn a
babeltrace(1) process to build and run a processing graph.
babeltrace-log(1) executes babeltrace(1) as such:
babeltrace run --component dmesg:src.text.dmesg --params read-from-stdin=yes
--params no-extract-timestamp=yes --component ctf:sink.ctf.fs
--key path --value /output/path --connect dmesg:ctf
`no-extract-timestamp=yes` becomes `no-extract-timestamp=no` with
babeltrace-log(1)'s -t/--with-timestamps option. The standard input is
forwarded to the child process.
Like babeltrace(1), the build system creates both babeltrace-log and
babeltrace-log.bin executables. The former spawns the in-tree
babeltrace(1) tool while the latter spawns the installed version.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 6 Jul 2017 06:17:22 +0000 (02:17 -0400)]
src.text.dmesg: add `no-extract-timestamp` option
Babeltrace 1's babeltrace-log(1) has a -t option to extract timestamps
and write them to the event headers. It makes more sense to extract them
by default in the component itself, but babeltrace-log(1) can pass
no-extract-timestamp=yes when -t is not provided.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 5 Jul 2017 23:13:39 +0000 (19:13 -0400)]
lib/ctf-ir/clock-class.c: serialize `true`/`false` instead of `TRUE`/`FALSE`
The `signed` attribute of an integer field type is serialized in
lowercase.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 5 Jul 2017 23:12:57 +0000 (19:12 -0400)]
lib/ctf-ir/clock-class.c: only serialize UUID if it is set
Otherwise we get:
uuid = "
00000000-0000-0000-0000-
000000000000";
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 5 Jul 2017 23:00:58 +0000 (19:00 -0400)]
Add src.text.dmesg component class
The new src.text.dmesg component class reads the standard input or a
specific file and converts each line to a CTF IR event, building the
appropriate metadata objects when needed.
This component does what babeltrace-log(1) used to do. The
babeltrace-log(1) application can be replicated as such:
dmesg | babeltrace -c src.text.dmesg -p read-from-stdin=yes \
--no-debug-info -o ctf -w /path/to/output
The component class's initialization parameters are:
`read-from-stdin`:
True to read the lines from the standard input stream (excludes
`path`).
`path`:
Path to the regular file from which to read lines (excludes
`read-from-stdin`).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 5 Jul 2017 18:38:05 +0000 (14:38 -0400)]
plugins/ctf/plugin.c: fix comment
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 5 Jul 2017 16:14:47 +0000 (12:14 -0400)]
ctf: notif-iter: pass current stream ID to get_stream() medop
Make the notif iter's get_stream() medop receive the current stream
(instance) ID as a parameter, if any, so that the callee can create a
stream with bt_ctf_stream_create_with_id(), if this is needed, with the
appropriate stream ID which is only known dynamically after decoding the
first packet header.
In the case of src.ctf.fs, the streams are already created with the
appropriate stream IDs because the component deals with data stream file
groups and must mark the trace as static at creation time, so the new
parameter is ignored. In the case of src.ctf.lttng-live, we cannot read
the first packet header and then rewind (or it is rather complicated to
do so), so the stream object is created the first time get_stream() is
called with the received ID.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 5 Jul 2017 16:14:24 +0000 (12:14 -0400)]
src.ctf.fs: fs.c: add missing `static`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 5 Jul 2017 16:03:40 +0000 (12:03 -0400)]
ctf: notif-iter: ensure that all packets refer to the same stream class
Disallow, within the same packet sequence (decoded by a single CTF notif
iter instance), two packets to be described by two different stream
classes, which would also mean two different streams. Log a specific
warning message when this happens, e.g.:
07-05 12:05:04.235 17923 17923 W PLUGIN-CTF-NOTIF-ITER
set_current_stream_class@notif-iter.c:961 Two packets refer to two
different stream classes within the same packet sequence:
notit-addr=0xd97b20, prev-stream-class-addr=0xdc0b20,
prev-stream-class-name="(null)", prev-stream-class-id=33,
next-stream-class-addr=0xdc13d0, next-stream-class-name="(null)",
next-stream-class-id=34, trace-addr=0xda3650, trace-name="ctf2"
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 5 Jul 2017 16:03:33 +0000 (12:03 -0400)]
Fix: remove clock value leak in sink.text.pretty
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 4 Jul 2017 20:25:53 +0000 (16:25 -0400)]
sink.text.pretty: append `s` only if plural in discarded elems. msg.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 4 Jul 2017 20:15:04 +0000 (16:15 -0400)]
lib: use dedicated BT_LOG*_ERRNO() instead of using strerror()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 4 Jul 2017 20:02:57 +0000 (16:02 -0400)]
test_ctf_writer.c: use environment variable to override packet resize length
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 4 Jul 2017 20:02:27 +0000 (16:02 -0400)]
sink.ctf.fs: use original stream's name as CTF writer stream's name
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 4 Jul 2017 20:00:12 +0000 (16:00 -0400)]
ir: stream: prefer to use stream's name for (CTF writer) stream's path
When creating a stream file for a given CTF writer stream object, use
this format:
PREFIX-SCID-SID
PREFIX:
1. Base name of stream's name, if it exists.
2. Base name of stream class's name, if it exists.
3. `stream`
SCID:
Stream class's ID.
SID:
Stream's ID.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 4 Jul 2017 17:59:54 +0000 (13:59 -0400)]
sink.text.pretty: print discarded events and packets messages
When getting a discarded events or discarded packets notification in
sink.text.pretty, print a warning on the standard error stream (to
remain compatible with Babeltrace 1 which does that) which looks like
this:
WARNING: Tracer discarded 83565 events between [20:01:32.
062781965]
and [20:01:32.
126649071] in trace "hostname/the-trace" (UUID:
a560bbc4-7f93-b346-a980-
3959745a0f5d) within stream
"/home/user/my-traces/the-trace/stream-1048576_3_0"
(stream class ID: 1, stream ID: 3).
The message also indicates when the trace has no UUID, or when the
stream has no (instance) ID. The stream class ID is always available.
When the trace's or stream's name is unavailable, `(unknown)` is
printed.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 4 Jul 2017 17:53:16 +0000 (13:53 -0400)]
src.ctf.fs: name the stream objects with their file's path
This patch makes a src.ctf.fs component name its stream objects. The
name of a stream object is the full path of the first file of its
backing data stream file group.
The purpose of those names is for sink.text.pretty to indicate in which
file (or which file group) events or packets were discarded by the
tracer.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 4 Jul 2017 17:51:29 +0000 (13:51 -0400)]
flt.lttng-utils.debug-info: copy original stream's numeric ID
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 4 Jul 2017 17:51:01 +0000 (13:51 -0400)]
libctfcopytrace: copy trace's UUID
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 20 Jun 2017 19:40:17 +0000 (15:40 -0400)]
Add sink.utils.counter
A sink.utils.counter component counts the number of received
notifications (one count per notification type) and prints the counts
every 1000 notifications (total) by default and at the end. You can
use the `step` parameter to modify how frequent the component prints
the counts:
babeltrace /path/to/trace -c sink.utils.counter -p step=5000
You can set `step` to 0 to print the counts only at the end:
babeltrace /path/to/trace -c sink.utils.counter -p step=0
Notifications of which the type is not known (if this component is used
in future releases of Babeltrace 2) are classified under "Other
(unknown)", which is only printed if there's at least one unknown
notification.
You can use the `hide-zero` parameter (boolean) to hide the counts which
are 0.
The goal of this component class is to have a dummy sink component with
regular updates, for debugging and benchmarking purposes.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 22 Jun 2017 15:20:29 +0000 (11:20 -0400)]
Automatically generate discarded packets/events notifications
This patch adds discarded packets and events notifications. Those
notifications are automatically generated by each notification iterator
by looking at packet header (PH) field's `packet_seq_num` and packet
context (PC) field's `events_discarded` fields to keep track of the
current state. Automatically generating those notifications, and
forbidding the user to create them, allows them to always be
synchronized with the values of the PH and PC special fields, and
guarantees to the user that they are generated whenever there is a
change in those values.
Each notification contains a count, an optional beginning clock value,
and an optional ending clock value, as well as a stream in which the
elements are discarded by the tracer.
As of this patch, flt.utils.trimmer does not reset the value of its
copied `packet_seq_num` and `events_discarded` fields to 0, and this is
probably a bug because a notification iterator on an flt.utils.trimmer
component can see discarded packets or events notifications before the
first packet beginning notification (which should not be the case if we
consider that a trimmed stream should act like a stream which originally
had those time bounds).
The sink.text.pretty component does not do anything specific with those
new notifications yet, but they are expected to be used to replicate
Babeltrace 1's behaviour (printing warnings).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 22 Jun 2017 15:17:42 +0000 (11:17 -0400)]
lib/ctf-ir/trace.c: validate PH `packet_seq_num` field
Must be an unsigned integer field if it exists.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 20 Jun 2017 21:21:25 +0000 (17:21 -0400)]
ctf: notif-iter.c: ensure that medops's get_stream() always returns the same
Knowing this, we can keep per-stream state in a CTF notif iter.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 20 Jun 2017 21:07:55 +0000 (17:07 -0400)]
flt.lttng-utils.debug-info: forward unhandled notifications
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 20 Jun 2017 19:50:45 +0000 (15:50 -0400)]
Fix: flt.utils.muxer: not always an ERROR to fail to validate
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 20 Jun 2017 19:39:53 +0000 (15:39 -0400)]
Simplify sink.utils.dummy: only one upstream notification iterator
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 20 Jun 2017 18:36:52 +0000 (14:36 -0400)]
src.ctf.fs: use one CTF notif iter per notification iterator
Use only one bt_ctf_notif_iter per src.ctf.fs notification iterator,
instead of one per data stream file, so that this object can keep a
state for the whole packet sequence.
ctf_fs_ds_file_create() now receives the notif iter to use and sets
itself as its current medops user data.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 20 Jun 2017 17:36:03 +0000 (13:36 -0400)]
lib/graph/notification/inactivity.c: add missing `ret = -1`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 19 Jun 2017 23:46:31 +0000 (19:46 -0400)]
ctf: notif-iter.c: lazily initialize clock value states
Because clock classes can be added to a trace at any time, it is
possible that an integer field type is mapped to a clock class which did
not exist when init_clock_states() is initially called. To fix this,
create the clock state and map it to a clock class when a new clock
class is found.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 19 Jun 2017 23:35:43 +0000 (19:35 -0400)]
visitor-generate-ir.c: validate clock class frequency in visitor
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 19 Jun 2017 23:30:27 +0000 (19:30 -0400)]
bt_ctf_clock_class_create(): add a frequency parameter
The frequency of a clock class is a mandatory property: CTF 1.8
indicates that it's 1 GHz by default, but it is expected that there's no
default frequency in CTF 2. To allow this immediately, add a mandatory
frequency parameter to bt_ctf_clock_class_create() so that the user's
frequency is set at creation time.
To maintain backward compatibility with pre-2.0.0 CTF writer,
bt_ctf_clock_create() sets its clock class's frequency to 1 GHz, and so
do other parts of the code base.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 19 Jun 2017 23:05:33 +0000 (19:05 -0400)]
stream.c: standardize "Cannot truncate stream file [...]" log message
Standardized:
* Do not put a function name in a non-DEBUG/non-VERBOSE statement.
* Do not put spaces around the `=` of fields.
* Prepend `: ` before fields.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 19 Jun 2017 23:01:17 +0000 (19:01 -0400)]
BT_LOG_WRITE_ERRNO(): use `_msg ": %s" _fmt` format
Do not put a period at the end of the errno string: this gives the
opportunity to the user to follow the errno string with a colon, a
space, and fields, e.g.:
BT_LOGE_ERRNO("Cannot write to file", ": filename=\"%s\"", filename);
which would print this message, for example:
Cannot write to file: No space left on device: filename="/tmp/my-file"
You can also terminate a field-less message with a period manually:
BT_LOGE_ERRNO("Cannot close file", ".");
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 19 Jun 2017 22:52:09 +0000 (18:52 -0400)]
lib/graph/notification/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 [Mon, 19 Jun 2017 22:42:11 +0000 (18:42 -0400)]
lib/graph/notification/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 [Mon, 19 Jun 2017 22:41:50 +0000 (18:41 -0400)]
Fix: add_clock_classes(): do not add existing clock classes
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 19 Jun 2017 22:39:13 +0000 (18:39 -0400)]
Remove unused bt_notification_get_stream()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 19 Jun 2017 22:25:30 +0000 (18:25 -0400)]
Fix: allow NULL (unnamed) in bt_ctf_stream_class_{get,set}_name()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 19 Jun 2017 22:21:57 +0000 (18:21 -0400)]
test_ctf_writer.c: set PACKET_RESIZE_TEST_LENGTH to 100000 again
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 19 Jun 2017 22:00:31 +0000 (18:00 -0400)]
lib/graph/notification/inactivity.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 19 Jun 2017 21:42:02 +0000 (17:42 -0400)]
lib/graph/notification/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 [Mon, 19 Jun 2017 21:41:12 +0000 (17:41 -0400)]
doc/logging-guide.adoc: document standard way of choosing tag names
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 19 Jun 2017 19:58:27 +0000 (15:58 -0400)]
plugins/utils/muxer/muxer.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 16 Jun 2017 17:51:19 +0000 (13:51 -0400)]
plugins/utils/trimmer/iterator.c: use unique logging tag
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 6 Jul 2017 17:09:22 +0000 (13:09 -0400)]
Fix: set intersections hashtable to NULL after destruction
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 22 Jun 2017 20:58:59 +0000 (16:58 -0400)]
Build plugins as unversioned modules
This will build the plugins as straight .so file without libtools
'lib' prefix and version symlinks.
See this link for more details :
https://autotools.io/libtool/plugins.html
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 16 Feb 2017 16:03:09 +0000 (11:03 -0500)]
Port: plugin system compat for mingw / macOS
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 6 Apr 2017 19:00:44 +0000 (15:00 -0400)]
Fix: ctf writer test on Cygwin
In the ctf writer test we execl() some libtool wrappers that get confused
when arg[0] is not the full path to the binary.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Fri, 7 Apr 2017 19:44:34 +0000 (15:44 -0400)]
Fix: disable debug by default info on Cygwin
elfutils is not available on Cygwin.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 8 Jun 2017 14:54:43 +0000 (10:54 -0400)]
Fix: remove AC_FUNC_MALLOC for cross-compile
AC_FUNC_MALLOC/REALLOC are based on a run-time test which fails when
cross-compiling and we don't use the results from these tests anyway.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 30 May 2017 22:01:17 +0000 (18:01 -0400)]
Add libbabeltrace-ctf for backwards compat
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Wed, 31 May 2017 19:01:40 +0000 (15:01 -0400)]
Port: Add winsock support to live for mingw
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 8 Nov 2016 23:48:10 +0000 (18:48 -0500)]
Port: Replace readdir_r by nftw
readdir_r is deprecated and not available on all platforms, replace it
by nftw.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Wed, 9 Nov 2016 19:35:33 +0000 (14:35 -0500)]
Port: dirfd is not portable, replace it
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Fri, 2 Jun 2017 20:38:05 +0000 (16:38 -0400)]
Port: use ghashtable in mman compat
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Nathan Lynch [Fri, 30 Jun 2017 20:52:27 +0000 (15:52 -0500)]
babeltrace-2.0: do not link with -export-dynamic
It seems that changes in the plugin system make passing
-export-dynamic to the linker unnecessary -- a welcome
improvement.
No regressions observed in the test suite.
Signed-off-by: Nathan Lynch <nathan_lynch@mentor.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 5 Jul 2017 15:42:03 +0000 (11:42 -0400)]
Fix: bt_component_create is not hidden
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 29 Jun 2017 21:47:55 +0000 (17:47 -0400)]
stream-intersection: use the trace-info query results to insert trimmers
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 21 Jun 2017 21:54:24 +0000 (17:54 -0400)]
Fix: ctf_fs_metadata is assumed to be non-null
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 21 Jun 2017 18:26:20 +0000 (14:26 -0400)]
Improve logging in the LTTng index parsing code
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Fri, 16 Jun 2017 20:12:35 +0000 (16:12 -0400)]
copytrace: check clock_class_count before getting the clock by index
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Fri, 16 Jun 2017 20:21:53 +0000 (16:21 -0400)]
Fix: wrong output name in --help for implicit CTF source
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Fri, 16 Jun 2017 19:21:47 +0000 (15:21 -0400)]
Test the trimmer component
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Fri, 16 Jun 2017 19:10:27 +0000 (15:10 -0400)]
pass --clock-gmt option to the trimmer if enabled
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 19 Jun 2017 15:53:36 +0000 (11:53 -0400)]
Tests: don't rely on the test script's location
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Fri, 16 Jun 2017 18:51:41 +0000 (14:51 -0400)]
test_trace_copy: compare the two traces with diff rather than wc -l
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Fri, 16 Jun 2017 18:30:30 +0000 (14:30 -0400)]
Test debug-info
Add a test program source code, instructions to compile it with the
already compiled libhello library, and provide a lttng-ust trace of this
program running.
The test runs babeltrace on this trace with the
--debug-info-target-prefix option set to the tree of babeltrace which
allows it to find the debug symbols, and we verify that the text output
contains the complete debug_info context structure.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 19 Jun 2017 15:29:37 +0000 (11:29 -0400)]
Clean-up: coding style adjustments
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 16 Jun 2017 23:06:16 +0000 (19:06 -0400)]
Cleanup: typo fix in comment
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Thu, 15 Jun 2017 19:29:34 +0000 (15:29 -0400)]
fs-sink: add the single-trace option
This option allows the user to control the output directory of the trace
written (instead of the path being derived from the source trace path
and hostname). This implies that the component only receives one trace.
If the output directory exists and is not empty, an error is returned.
To use it:
--component sink.ctf.fs --path /tmp/out -p single-trace=true
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Thu, 15 Jun 2017 17:48:48 +0000 (13:48 -0400)]
Test: validate that the output of ctf-fs sink is identical to source
Process all the "succeed" CTF traces with the CTF-FS sink, check the
return code of babeltrace and compare the number of events in the new
trace from the number of events in the source trace.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Thu, 15 Jun 2017 17:48:02 +0000 (13:48 -0400)]
Fix: event_header is optional
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Wed, 14 Jun 2017 21:38:24 +0000 (17:38 -0400)]
Copy the packet_header in the plugins
The trimmer, debug-info and fs-sink plugins now copy the packet_header
from the trace received as parameter.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Wed, 14 Jun 2017 19:05:20 +0000 (15:05 -0400)]
Fix: wrong return code check on try_set
try_set_structure_field_integer can return 0 if it did not perform any
action, it is not an error.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Wed, 14 Jun 2017 18:45:46 +0000 (14:45 -0400)]
Fix copytrace: copy packet_context
Since we are not filtering the fields in the packet_context anymore, we
can now use the deep copy function bt_ctf_field_copy for the
packet_context.
Refactor the code to work with that and create a function to set the
packet_context on a packet or on a stream.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Wed, 14 Jun 2017 18:23:43 +0000 (14:23 -0400)]
copytrace: packet_context is optional
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Wed, 14 Jun 2017 18:21:59 +0000 (14:21 -0400)]
copytrace: create empty stream classes by default
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Wed, 14 Jun 2017 18:21:27 +0000 (14:21 -0400)]
fs-sink: packet_context is optional
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Tue, 13 Jun 2017 18:01:25 +0000 (14:01 -0400)]
Fix: the fields to reset are optional
This is a not a fatal error, just ignore if the fields are not there.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 16 Jun 2017 01:36:57 +0000 (21:36 -0400)]
ctf: remove strict metadata mode, update automatic CC mapping behaviour
Update the automatic mapping of specific fields to clock classes when
no explicit mapping is found in the integer field type to follow this:
| 0 CCs | 1 CC | 2+ CCs
--------------------------------------------------------------------
FT is mapped | Unreachable | OK as is | OK as is
FT is not mapped | Map to auto 1 GHz | Map to single CC | Error
The (FT is not mapped, 0 CC) cell follows Babeltrace 1's behaviour: when
a special timestamp field is found in the packet context
(`timestamp_begin` or `timestamp_end`) or event header (`timestamp`)
scope, when this timestamp field is not explicitly mapped to a clock
class, and when there's no clock class at this point in the trace, then
create an automatic, 1 GHz clock class and, in this case, name it
`default`. Map the field to this implicit 1 GHz clock class. See
section 8 ("Clocks") of CTF v1.8.2.
Cell (FT is not mapped, 0 CC) is a fix for old versions of LTTng, and
cell (FT is not mapped, 1 CC) is a fix for old versions of CTF writer.
Cell (FT is not mapped, 2+ CCs) is an error because we wouldn't know
which clock class to automatically map the field to.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 15 Jun 2017 22:38:45 +0000 (18:38 -0400)]
Remove the concept of event class attributes
The concept of event class attributes could be confusing with the
eventual concept of user attributes to be introduced in CTF 2. This is
not strictly required for Babeltrace 2.0: we can create dedicated
accessors for CTF 1.8 attributes (ID, name, log level, EMF URI). This is
what this patch does, removing the attributes API and adding:
* bt_ctf_event_class_get_log_level()
* bt_ctf_event_class_set_log_level()
* bt_ctf_event_class_get_emf_uri()
* bt_ctf_event_class_set_emf_uri()
There are already accessors for the name and ID attributes. As to the
stream class ID (`stream_id`) attribute, it should never have existed in
the first place because you can always use the parent stream class's ID.
Thus this patch also fixes a bug where there was a synchronization
problem between a stream class's ID and the `stream_id` attribute of its
contained event classes.
The bt_ctf_event_class_get_log_level() and
bt_ctf_event_class_set_log_level() functions use the new
`enum bt_ctf_event_class_log_level` enumeration which contains all the
log levels of LTTng-UST, which happen to be CTF 1.8's log levels too
because Babeltrace 1 prints those names for those values whatever the
trace's producer. A translation is performed from the numeric values to
this enumeration in plugins/ctf/common/metadata/visitor-generate-ir.c,
and the reverse is done in plugins/text/pretty/print.c. Knowing this,
the `loglevel_string` attribute that visitor-generate-ir.c used to add
to event classes (and which plugins/text/pretty/print.c used to
pretty-print the names) is removed. This was also an issue because
Babeltrace 1 does not know `loglevel_string` and sink.ctf.fs, through
the CTF writer implementation, was serializing this attribute in the
generated metadata.
tests/lib/test_ctf_writer.c is updated to test the individual accessors
instead of the generic attribute API.
plugins/libctfcopytrace/ctfcopytrace.c is updated to copy the known
attributes intead of using the generic attribute API.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 15 Jun 2017 20:36:47 +0000 (16:36 -0400)]
BT_CTF_BYTE_ORDER_NONE -> BT_CTF_BYTE_ORDER_UNSPECIFIED to match base
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 15 Jun 2017 20:32:38 +0000 (16:32 -0400)]
test_ctf_writer.c: do not check for invalid event class name
All event class names are valid. This is an old limitation.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 15 Jun 2017 20:32:16 +0000 (16:32 -0400)]
plugins/lttng-utils/Makefile.am: add all source files to _SOURCES var.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 15 Jun 2017 20:10:23 +0000 (16:10 -0400)]
Add BT_CTF_INTEGER_BASE_UNSPECIFIED
This is in preparation for CTF 2 in which a default base is not
specified for integer-like field types.
sink.text.pretty defaults to BT_CTF_INTEGER_BASE_DECIMAL when it gets
BT_CTF_INTEGER_BASE_UNSPECIFIED.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 16 Jun 2017 19:16:45 +0000 (15:16 -0400)]
Fix: Stream classes' id field is always serialized
A stream class' "id" must not be expressed in the trace metadata
if the trace's packet header does not contain a stream_id field.
Otherwise, the reader will try to ensure the packets' stream_id
corresponds to the stream class' id and will fail to do so.
The fix is to omit the serialization of the stream class' id
field entirely if the stream_id field is not found within the
trace's packet header.
It remains unclear whether or not a stream class has an actual
"id" in this case, or if some "unspecified" id state should
be implemented.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Tue, 13 Jun 2017 18:03:50 +0000 (14:03 -0400)]
Fix: flush stream without packet_context
Ensure we can flush a stream with only one packet if it does not have a
packet_context or the packet_size field.
Also truncate the stream to the content_size instead of the default 32kB
packet size.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 16 Jun 2017 18:55:52 +0000 (14:55 -0400)]
Add BT_LOG*_ERRNO() logging macros
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Mon, 12 Jun 2017 19:06:27 +0000 (15:06 -0400)]
debug-info fix: packet_context is optional
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 14 Jun 2017 22:13:31 +0000 (18:13 -0400)]
Fix: uninitialized return value in copy.c
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 14 Jun 2017 20:30:31 +0000 (16:30 -0400)]
Remove legacy printf_verbose()/printf_debug() and others
This patch removes all the legacy logging macros found in
babeltrace-internal.h. It also removes the babeltrace_verbose and
babeltrace_debug symbols.
To remain as backward compatible as possible, the CLI checks the
BABELTRACE_VERBOSE and BABELTRACE_DEBUG environment variables and
overrides the default log level (WARN, or the one set with --log-level)
with VERBOSE if BABELTRACE_DEBUG is 1 and INFO if only
BABELTRACE_VERBOSE is 1. This default log level applies to all the known
loggers, except the ones that have their log level explicitly set with a
dedicated environment variable.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 14 Jun 2017 16:34:00 +0000 (12:34 -0400)]
visitor-generate-ir.c: automatically map specific fields to trace's clock class
In non-strict mode (default), automatically map packet context field
type's `timestamp_begin` and `timestamp_end` fields, as well as
event header field type's `timestamp` and `ts` fields, when the
following conditions are all true:
* The decoder is in non-strict mode.
* The field type is an integer field type.
* The integer field type is not mapped to a clock class.
* The trace contains only one clock class at this point.
This attempts to fix semantics errors committed by some known tracers
(very old versions of LTTng and old versions of CTF writer).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 14 Jun 2017 15:15:00 +0000 (11:15 -0400)]
ctf: add metadata decoder config. and `strict-metadata` param in src.ctf.fs
The common metadata decoder now accepts an optional configuration
structure. The offset (seconds and nanoseconds) to apply to all the
clock classes is found in there, as well as a new option which makes the
decoder strict. In strict mode, the decoder does not allow the decoded
metadata stream to be off semantically. For example, in strict mode,
clock classes named `monotonic` are not forced to be absolute when it is
detected that the stream was produced by an LTTng tracer.
It's not expected that the strict mode be something that any user would
want under normal conditions because the non-strict mode fixes errors
made by known tracers to make things work for the other components of
the graph. As such, there's no quick --strict option in the CLI's
`convert` command: the user can instantiate its own source.ctf.fs
component with --component for this and pass the options with --params:
babeltrace -c src.ctf.fs --path ~/my-traces/trace -p strict-metadata=yes
I'm also fixing the parameter names and types for the clock class
offsets, both in the CLI and in source.ctf.fs, so that all the project's
modules are in sync regarding this. The parameters are now
`clock-class-offset-s` and `clock-class-offset-ns`, and with the
`convert` command, they are set with resp. --clock-offset and
--clock-offset-ns. They used to be passed to the `run` command as string
values (using --key and --value), but now they are part of the
component's --params option so that they are recognized as constant
integer values (even if negative).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 14 Jun 2017 06:50:29 +0000 (02:50 -0400)]
source.ctf.fs: remove ctf_fs_debug symbol
Not needed anymore because of the standardized logging.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 14 Jun 2017 06:31:12 +0000 (02:31 -0400)]
Fix: cli: help command: accept leftover when --component is not specified
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 14 Jun 2017 05:17:23 +0000 (01:17 -0400)]
cli: add global --log-level option
This new global option (applies before the command name) sets the
default log level of all the known (project's) loggers. This default
log level can still be overridden by a specific environment variable,
for example:
BABELTRACE_PLUGIN_CTF_METADATA_LOG_LEVEL=D babeltrace --log-level=I ...
In this example, all the log levels are set to INFO, but
BABELTRACE_PLUGIN_CTF_METADATA_LOG_LEVEL overrides the `ctf` plugin's
metadata module's log level to DEBUG.
When you don't specify --log-level, it defaults to W (WARN), the current
behaviour.
--verbose is now the equivalent of --log-level=I, and --debug is the
equivalent of --log-level=V. --verbose and --debug do the same thing,
for the `convert` command, whether they are global or specific to the
command. --verbose and --debug can still be specified together, and
whatever the order, the lowest log level always wins: VERBOSE.
The --log-level option can override previous --verbose, --debug, or
--log-level options because it didn't exist in Babeltrace 1 anyway so
there's no way to break backward compatibility:
babeltrace --log-level=W --verbose --log-level=E ...
In this case, the final log level is ERROR.
Other example with implicit `convert` command:
babeltrace --log-level=E /path/to/trace -v
In this case, the command's --verbose option sets the log level to
INFO because it's lower than ERROR (set by --log-level=E).
One of the main use cases of the new --log-level option is to completely
disable logging:
babeltrace --log-level=N ...
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 14 Jun 2017 02:42:58 +0000 (22:42 -0400)]
Use BABELTRACE_FORCE_COLORS environment variable to force color support
This allows this use case:
BABELTRACE_FORCE_COLORS=1 babeltrace ... |& less -R
to see the logging's color in `less`.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 14 Jun 2017 02:42:00 +0000 (22:42 -0400)]
Logging: add colors depending on log level
The whole line is colored and this indicates the log level.
VERBOSE: no color
DEBUG: no color
INFO: blue
WARN: yellow
ERROR: red
FATAL: red
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 14 Jun 2017 02:07:10 +0000 (22:07 -0400)]
visitor-generate-ir.c: logging: add stream's line number and other info
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.043558 seconds and 4 git commands to generate.