Antoine Busque [Mon, 28 Sep 2015 10:01:52 +0000 (06:01 -0400)]
Tests: add unit tests for bt_dwarf
Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Antoine Busque [Wed, 9 Sep 2015 09:05:27 +0000 (05:05 -0400)]
Initial implementation of the debuginfo API
This patchset adds so_info and durin, which are used in debug info or
callsite analysis. The developer is expected to use the SO info API
documented in `include/babeltrace/so-info.h`. Durin is only used
internally by so_info as a wrapper around `libdw`.
The analysis itself is implemented in the new `lib/debuginfo.c`.
This introduces a dependency on `libelf` and `libdw` from
elfutils. The feature can be disabled at configure time with the
`--disable-debuginfo` flag.
Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 19 Apr 2016 22:42:06 +0000 (18:42 -0400)]
Fix: lttng-live flush when output to file
When the standard output is redirected to a file, we need to flush the
output between each packet, otherwise the stream buffering may keep us
from seeing events for a while in a low-throughput trace.
While we are there, document that lttng-live does now support the
--output option in babeltrace 1.x.
Fixes #1010
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 19 Apr 2016 02:26:40 +0000 (22:26 -0400)]
Fix: lttng-live use g_free rather than free
g_new0 should be paired with g_free.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 12 Sep 2015 03:24:54 +0000 (23:24 -0400)]
Store "tracer_name" from the trace's environment
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 6 Apr 2016 18:32:40 +0000 (14:32 -0400)]
Fix: Missing pointer dereference in NULL check
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 5 Apr 2016 21:44:42 +0000 (17:44 -0400)]
Fix: leak of stream intersection positions
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 5 Apr 2016 21:24:15 +0000 (17:24 -0400)]
Remove useless bt_iter when creating intersection
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 5 Apr 2016 18:41:34 +0000 (14:41 -0400)]
Add new test artifacts to .gitignore
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 5 Apr 2016 17:08:59 +0000 (13:08 -0400)]
Tests: use templates for stream intersection and packet_seq_num
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 5 Apr 2016 15:15:07 +0000 (11:15 -0400)]
Tests: fix OOT build by adding test scripts to noinst_SCRIPTS
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 4 Apr 2016 22:42:14 +0000 (18:42 -0400)]
Docs: Add --stream-intersection to the BABELTRACE(1) man page
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 4 Apr 2016 20:47:44 +0000 (16:47 -0400)]
Rephrase error message
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Mon, 21 Sep 2015 15:23:05 +0000 (11:23 -0400)]
Test the stream intersection feature
5 traces are provided:
- 3 packets intersecting between two streams slightly offsetted
- Same trace with 3 packets intersecting but with swapped trace file names
- No intersection between packets
- Only one stream
- No streams at all
These traces were generated with the CTF writer API from the master
branch, the binary traces will be replaced by the test program when the
feature arrives in master.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Mon, 14 Sep 2015 17:05:59 +0000 (13:05 -0400)]
Option to only show streams' intersection
The --stream-intersection option allows showing only the events that
fit in the intersection of all streams, thus filtering out the events
for which only some streams have the time range info. This is achieved
by using the packet header timestamp begin/end information available
within each stream.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Mon, 21 Sep 2015 20:28:34 +0000 (16:28 -0400)]
Tests for packet_seq_num handling
5 traces are provided:
- no packets lost
- no packets lost with packet_seq_num not starting at 0
- 2 events lost before the last packet
- 2 streams with events lost in 1
- 2 stream with events lost in both
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Tue, 8 Mar 2016 05:32:27 +0000 (00:32 -0500)]
Fix: lttng-live data_size and version endianness
The data_size and cmd_version fields need to be sent in network byte
order to the relay. These fields are currently ignored by the relay
because the commands have a fix-sized payload so it does not cause any
problem for now, but they may be used in the future, so we should avoid
any confusion.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 24 Feb 2016 00:47:49 +0000 (19:47 -0500)]
test_ctf_ir_ref.c: fix coding style
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 24 Feb 2016 00:46:07 +0000 (19:46 -0500)]
test_ctf_writer.c: test packet functions
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 24 Feb 2016 00:43:47 +0000 (19:43 -0500)]
Fix: do not set event's parent to a non-writer stream
Since a non-writer stream does not know the events that are
associated to it, an event with a non-writer stream parent can
never be destroyed.
Fix this by setting a stream parent if the stream is a writer
stream, and otherwise by using the event's packet's stream.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 24 Feb 2016 00:24:59 +0000 (19:24 -0500)]
ir: bt_ctf_stream_append_event(): do not always reset parent
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 24 Feb 2016 00:24:23 +0000 (19:24 -0500)]
ir: bt_ctf_event_set_packet(): check for common stream class
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 23 Feb 2016 00:16:03 +0000 (19:16 -0500)]
test_ctf_ir_ref.c: fix indentation
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 23 Feb 2016 00:12:23 +0000 (19:12 -0500)]
test_ctf_ir_ref.c: test all permutations of put
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 22 Feb 2016 21:05:44 +0000 (16:05 -0500)]
Solaris build fix: missing inclusion of endian.h
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sun, 21 Feb 2016 08:23:46 +0000 (03:23 -0500)]
ref.h: add C++ guards
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 19 Feb 2016 02:42:29 +0000 (21:42 -0500)]
test_ctf_writer.c: test bt_ctf_clock_ns_from_value()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 22 Feb 2016 20:18:02 +0000 (15:18 -0500)]
Cleanup: lift function call outside of condition
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 19 Feb 2016 02:34:12 +0000 (21:34 -0500)]
ir: add bt_ctf_clock_ns_from_value() utility
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 19 Feb 2016 02:16:59 +0000 (21:16 -0500)]
ir: move clock value accessors to writer header
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 19 Feb 2016 02:15:39 +0000 (21:15 -0500)]
test_ctf_writer.c: test writer/non-writer clock value accessors
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 19 Feb 2016 02:15:05 +0000 (21:15 -0500)]
ir: move bt_ctf_stream_class_set_clock() to writer header
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 19 Feb 2016 02:00:31 +0000 (21:00 -0500)]
ir: disable clock value accessors in non-writer mode
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 Feb 2016 07:23:26 +0000 (02:23 -0500)]
ir: add bt_ctf_event_get_clock_value()
This patch adds a hash table of clocks to their current values (in
cycles) to the stream object. bt_ctf_stream_update_clock_value() can
be called to update the registered clock value of a given stream
from the current value of a given integer field, of which the type
is mapped to a clock. The function handles the case where the size of
the field is less than 64 bits and can make the current clock value
wrap once per call.
This patch also adds a similar hash table to the event object.
bt_ctf_event_register_stream_clock_values() is to be called by
internal code to take a snapshot of all the registered clock values
of the event's stream. The copied clock values can be retrieved by
the user later using bt_ctf_event_get_clock_value(), which should
return the value that a given clock had when the event was emitted.
This is intended to be used by sink components since the value
of a clock changes as events are created, whereas it is common
situation to hold an event and later need the clock values when
this event was emitted.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 18 Feb 2016 00:21:26 +0000 (19:21 -0500)]
ir: bt_ctf_stream_append_event(): do not append event with parent
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 18 Feb 2016 00:12:23 +0000 (19:12 -0500)]
ir: remove unused event header/context fields from stream
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 17 Feb 2016 23:57:04 +0000 (18:57 -0500)]
ir: add optional name property to stream
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 17 Feb 2016 21:55:22 +0000 (16:55 -0500)]
test_ctf_writer.c: test bt_ctf_stream_create()
This new test function tests the creation of both a writer
(when the stream class's trace was itself created by a writer)
and a non-writer stream.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 17 Feb 2016 21:52:05 +0000 (16:52 -0500)]
ir: make bt_ctf_stream_create() public
This patch also removes bt_ctf_trace_create_stream(), so that the
only way to create a stream in non-writer mode is using
bt_ctf_stream_create(). Only the stream class is needed, and since
it needs to be part of a trace before calling the function, the
created stream gets associated to this trace on creation.
The function also knows if the stream class's trace was created by
a CTF writer thanks to a new flag. With this, it's able to create
a stream file and set the stream's FD if it's a writer stream.
Otherwise the FD is set to -1 and this stream cannot be passed to
stream writer functions like bt_ctf_stream_append_event() and
bt_ctf_stream_append_discarded_events(), for example.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 Feb 2016 22:20:54 +0000 (17:20 -0500)]
test_ctf_writer.c: test stream class clock -> trace clock
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 Feb 2016 19:50:21 +0000 (14:50 -0500)]
ir: bt_ctf_trace_add_stream_class(): add stream class's clock
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 Feb 2016 21:48:08 +0000 (16:48 -0500)]
ir: remove unused bt_ctf_event_copy()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 15 Feb 2016 21:24:01 +0000 (16:24 -0500)]
ir: verify stream mode in stream functions
Some functions are disabled in CTF writer mode and vice versa.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 13 Feb 2016 02:15:16 +0000 (21:15 -0500)]
ir: freeze event on bt_ctf_stream_append_event()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 13 Feb 2016 02:12:03 +0000 (21:12 -0500)]
ir: add bt_ctf_event_freeze()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 13 Feb 2016 01:50:40 +0000 (20:50 -0500)]
ir: add bt_ctf_field_freeze()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 13 Feb 2016 01:01:15 +0000 (20:01 -0500)]
ir: remove bt_ctf_trace_get() and bt_ctf_trace_put()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 19 Feb 2016 23:07:25 +0000 (18:07 -0500)]
ir: move writer-specific declarations to writer header
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 13 Feb 2016 00:45:05 +0000 (19:45 -0500)]
ir: remove event header accessors from stream
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 12 Feb 2016 23:55:50 +0000 (18:55 -0500)]
ir: add bt_ctf_event_set_packet()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 17 Feb 2016 22:07:29 +0000 (17:07 -0500)]
ir: add public bt_ctf_packet object
The purpose of a bt_ctf_packet object is to hold the packet
header and packet context fields.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 12 Feb 2016 00:27:42 +0000 (19:27 -0500)]
ir: move the stream event ctx field to the event
Just like the event header, the stream event context field has
its type defined in the stream class, but its data can be different
in each event. The current strategy to sample and copy the current
stream's stream event context and append the copies to an array
is fine as far as CTF writer goes, but this array would not be
populated strictly using the event in the context of Babeltrace
components.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 Feb 2016 23:40:18 +0000 (18:40 -0500)]
ir: remove unused event_headers member from struct bt_ctf_stream
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 Feb 2016 23:38:10 +0000 (18:38 -0500)]
ir: validate integer FT's mapped clock against signedness
It is invalid for a signed integer field type to be mapped to a clock.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 Feb 2016 01:13:02 +0000 (20:13 -0500)]
ir: clock: use value in cycles instead of ns
The value of a clock in CTF is in cycles, not in nanoseconds.
Here, bt_ctf_clock_get_time() and bt_ctf_clock_set_time() are left
as utilities to converter from/to the clock value in cycles.
Note that this conversion, unless the frequency is exactly 1 GHz,
implies casting 64-bit integers to doubles so it is possible to
lose accuracy.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 Feb 2016 23:23:26 +0000 (18:23 -0500)]
ir: freeze mapped clock when freezing integer FT
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 Feb 2016 23:15:25 +0000 (18:15 -0500)]
ir: freeze clocks when freezing a trace
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 9 Feb 2016 01:05:55 +0000 (20:05 -0500)]
ir: split event files into event and event-class files
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 9 Feb 2016 00:32:00 +0000 (19:32 -0500)]
ir: rename event-fields/event-types -> fields/field-types
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 8 Feb 2016 21:03:22 +0000 (16:03 -0500)]
ir: rename ctf_type_id -> bt_ctf_type_id
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 8 Feb 2016 08:43:06 +0000 (03:43 -0500)]
ir: rename ctf_string_encoding -> bt_ctf_string_encoding
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 8 Feb 2016 08:26:40 +0000 (03:26 -0500)]
ir: rename bt_ctf_field_path_get_root()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 8 Feb 2016 08:24:13 +0000 (03:24 -0500)]
ir: rename bt_ctf_node -> bt_ctf_scope
"scope" is more conforming to the CTF nomenclature than "node".
Note that this changes the Babeltrace 1.x API, but this API is
expected to be hidden from the user starting from Babeltrace 2.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 8 Feb 2016 22:56:15 +0000 (17:56 -0500)]
ir: add public bt_ctf_field_path object
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 8 Feb 2016 07:43:49 +0000 (02:43 -0500)]
ir: rename bt_ctf_field_type_variant_set_tag()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 8 Feb 2016 06:41:51 +0000 (01:41 -0500)]
Add validation/resolving tests
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 8 Feb 2016 06:40:44 +0000 (01:40 -0500)]
test_bt_values.c: fix top comment
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 8 Feb 2016 07:38:25 +0000 (02:38 -0500)]
ir: freeze attributes when freezing an event
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 19 Feb 2016 05:26:35 +0000 (00:26 -0500)]
Fix scan-build warning of potential NULL dereference
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 8 Feb 2016 07:21:40 +0000 (02:21 -0500)]
ir: refactor FT validation and resolving
This patch refactors the CTF IR field type validation and the
resolving of variant/sequence field types.
First, validation is completely decoupled from the objects
containing the field types. In other words, validation does not
know the exact event class, stream class, or trace in which the
field types to validate are or are supposed to be. Only field types
are given to the validation function, which is isolated in its
own file.
To make the life of the resolving engine easier, all scopes are
deep-copied before reaching it. This is done during the validation
process. This ensures that no two field types in the whole
hierarchy refer to the same object in memory. This greatly simplifies
the resolving process, while adding insignificant overhead since
this is only done once. The copies do not replace the original types
until we are sure that the object to be validated (event class, stream
class, or trace) is valid and will be frozen. When it is the case, a
valid flag is set, which avoids validating the object again in the
future when calling the same function. If the object is not valid,
then the copies of its field types are discarded, and the function
fails.
Validation is done at three important places:
* bt_ctf_event_create(): when creating an event, because we don't
want the user to obtain an event linked to an invalid event
class. It is possible to create an event from an even class
which has a parent stream class which has no parent trace. In
this case, no variant/sequence field type in all the field types
of the stream class and event class can be resolved to the
trace packet header field type.
* bt_ctf_stream_class_add_event_class(): when adding an event class
to a stream class AND when the stream class has a parent trace,
because in this case the whole hierarchy exists and everything
is frozen, so it makes sense that everything in there should be
valid. If the stream class has no parent trace yet, then the
validation will be done when adding it to a trace using the
following function. This is because the added event class could
contain a variant/sequence field type which resolves to a field
type of the trace packet header field type, contained in the trace
object.
* bt_ctf_trace_add_stream_class(): when adding a stream class to
a trace, because in this case both the trace and the stream
class will be frozen, and hence they should be valid because they
cannot be changed anymore.
The test_ctf_writer test is updated here to follow those changes. Since
the field types can be copied when calling one of the above functions,
we cannot create a field out of an original field type and then compare
its address to a field obtained from the created event or stream: we must
put the original field types and obtain the new ones from the event class
or stream class. The contents of field types are compared using
bt_ctf_field_type_compare() instead.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 8 Feb 2016 07:14:51 +0000 (02:14 -0500)]
ir: allow to set variant FT's tag FT even when frozen
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 8 Feb 2016 07:11:20 +0000 (02:11 -0500)]
ir: add internal bt_ctf_field_path_clear()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 8 Feb 2016 07:05:35 +0000 (02:05 -0500)]
ir: validate field types on field creation
This patch removes the validation that is done when adding
fields to structure/variant field types, and when creating
array/sequence field types with specific element types. This
is needed because a variant with an unset tag type may be
created and thus exist in any of those compound types. This
variant will be resolved when the time comes.
A valid field type is still required when creating a concrete
field out of it and when serializing it.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 4 Feb 2016 22:11:41 +0000 (17:11 -0500)]
values: fix indentation
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 4 Feb 2016 18:22:27 +0000 (13:22 -0500)]
ref.h: fix doc
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 4 Feb 2016 08:11:07 +0000 (03:11 -0500)]
values: add `_empty` prefix when relevant
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 1 Feb 2016 13:21:00 +0000 (08:21 -0500)]
BT_MOVE(): call bt_put(_dst)
It makes no semantical sense to move a reference from a variable
to another without first putting the destination, if it has one.
Otherwise this would be a lost reference, unless it was moved
elsewhere or put manually using bt_put() previously, which is why
BT_MOVE() should always be used for move semantics and BT_PUT() is
preferred to bt_put() to avoid this situation.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 30 Jan 2016 06:22:57 +0000 (01:22 -0500)]
Fix: bt_ctf_field_type_floating_point_copy(): set self references
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 30 Jan 2016 06:19:01 +0000 (01:19 -0500)]
Add bt_ctf_field_type_compare(): field type deep comparison
The new bt_ctf_field_type_compare() function compares two field
types recursively.
The tag field type of variant field types are not compared; only
the tag strings are compared.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 30 Jan 2016 06:29:39 +0000 (01:29 -0500)]
ir: event-types-internal.h: fix comment
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 30 Jan 2016 06:27:18 +0000 (01:27 -0500)]
ir: add user byte order to integer/float types
The `byte_order` field of an integer/float field type gets
replaced by `BIG_ENDIAN` or `LITTLE_ENDIAN` if it's set to
0 (native) once the type becomes the descendant of a
trace. However, once this is set, there is no way to know
that the user intended this field type's byte order to be
native. The metadata string, for example, will never contain
a byte order set to `native` with this behaviour.
This patch adds a `user_byte_order` field to the internal
integer and floating point number field type structures. This
field is the one set by and returned to the user using the
CTF IR API. Internally, the declaration's `byte_order` field
is still used for caching the resolved byte order.
This patch also modifies bt_ctf_stream_class_set_byte_order()
so that it cannot fail. This is an internal, hidden function
which should not be called with invalid parameters. Assertions
are inserted to verify this.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 30 Jan 2016 05:56:30 +0000 (00:56 -0500)]
test_ctf_writer.c: assert() unchecked return values
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 31 Jul 2015 18:22:25 +0000 (14:22 -0400)]
ir: bt_ctf_stream_class_set_byte_order(): EC is already frozen
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 17 Feb 2016 03:36:24 +0000 (22:36 -0500)]
Python bindings: remove unnecessary semi-colons
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 17 Feb 2016 03:27:21 +0000 (22:27 -0500)]
Python bindings: missing error check in Clock precision setter
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 17 Feb 2016 03:26:26 +0000 (22:26 -0500)]
Python bindings: accomodate API changes introduced for negative time
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 15 Feb 2016 19:46:11 +0000 (14:46 -0500)]
Remove stale comment from event destructor
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 9 Feb 2016 18:27:24 +0000 (13:27 -0500)]
Handle negative time and offset from Epoch
Handle cases where a trace have a negative offset from Epoch.
If Epoch is arbitrary (e.g. embedded system starting at 0, without any
network access), the "0" can be used as correlation point between
various components, and some components could start before the
correlation point. Therefore, especially in traces where the time is
meant to be shown in nanoseconds or cycles from the correlation point,
it also makes sense to have a negative time value.
It introduces API-breaking changes in the C and Python APIs, since we
need to be able to return negative time values, which were previously
used as errors (-1ULL).
The --offset and --offset-ns command line parameters can now take
negative offset (seconds and nanoseconds) values too.
The [sec.ns] format is used as fallback so we don't attempt to pass
a negative time value to POSIX time-formatting APIs.
This also fixes an inaccurate return value in an error path of
bt_ctf_event_populate_event_header().
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 9 Feb 2016 18:27:23 +0000 (13:27 -0500)]
Fix: CTF parser: accept signed constant literals
Those are inaccurately rejected by the parser due to this bug. This
affects environment variables and loglevel values.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 9 Feb 2016 18:27:22 +0000 (13:27 -0500)]
Fix: out-of-bound memory access
We need to check for end of stream before updating the current packet
index, else we access memory beyond the last stream packet index array
element. This fixes valgrind errors which appear at commit
480ef05 Support ctf index version 1.1
due to change of the element size, but actually caused by commit
2654fe9 Fix: events discarded timing inaccuracy
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 10 Feb 2016 16:25:33 +0000 (11:25 -0500)]
Fix out-of-tree tests: seek tests can't find traces
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Mon, 25 Jan 2016 21:00:41 +0000 (16:00 -0500)]
Tests: Fix test plans and do not skip on fail
Use fixed count test plans in all tests and make sure we do not skip
some tests on initialisation failures.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Fri, 4 Dec 2015 22:03:12 +0000 (17:03 -0500)]
Fix: Check return value of fpathconf
Current glibc has a bug in fpathconf(fd, _PC_NAME_MAX) where it will
fail with a 32bit userland on a 64bit kernel and where the filesystem
has a large block count, see glibc bug #18675.
In any case, we should check this return value because on a failure we
we don't allocate enough memory for dirent and then overflow on the
readdir_r call.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 5 Nov 2015 17:52:37 +0000 (12:52 -0500)]
Fix: BABELTRACE_HAVE_LIBC_UUID misspelled as BT_HAVE_LIBC_UUID
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 9 Feb 2016 23:50:22 +0000 (18:50 -0500)]
Fix: check for socket lib before function checks
On platforms that require extra libraries to link socket apps,
running this macro before the function checks will lead to
socket functions being correctly detected.
Signed-off by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 5 Nov 2015 17:51:55 +0000 (12:51 -0500)]
Port: Add OSX libuuid compat
OSX has the libuuid symbols built in the system libraries.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 5 Nov 2015 17:51:54 +0000 (12:51 -0500)]
Port: Add OSX mman.h compat
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Alexis Martin [Thu, 5 Nov 2015 17:51:53 +0000 (12:51 -0500)]
Port: Add OSX endian.h compat
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 15 Oct 2015 20:40:22 +0000 (16:40 -0400)]
Cleanup: remove unused label 'end'
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 26 Jan 2016 20:45:38 +0000 (15:45 -0500)]
Fix: Wrong variable checked for allocation failure
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.041975 seconds and 4 git commands to generate.