lib: add stream activity beginning/end messages
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 8 Feb 2019 22:36:38 +0000 (17:36 -0500)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 2 May 2019 20:50:15 +0000 (20:50 +0000)
Those new messages are meant to indicate the beginning and end of the
activity of a given stream, with optional clock snapshots. Eventually
all stream messages except stream beginning/end messages must be
"between" stream activity beginning and end messages.

The purpose of such messages is to indicate where tracing activity
starts and stops, for example when the LTTng `start` and `stop` commands
are executed (not supported by LTTng as of this date). This information
can be important for some filters and sinks to acknowledge the real
beginning and end of a stream, for example:

    [------------############################------#######-------------]

    ^ stream activity beginning                    stream activity end ^

     ^^^^^^^^^^^^ tracing, but no activity   ^^^^^^       ^^^^^^^^^^^^^

                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^      ^^^^^^^ activity

We also plan to make flt.utils.trimmer remove those messages for a given
stream and "inject" its own stream activity messages to emulate a
potentially reduced stream activity, depending on the message
intersection between the requested time range to keep and the stream's
time range.

You can use the following functions to set the message's default
clock snapshot:

* bt_message_stream_activity_beginning_set_default_clock_snapshot()
* bt_message_stream_activity_end_set_default_clock_snapshot()

and borrow it with:

* bt_message_stream_activity_beginning_borrow_default_clock_snapshot_const()
* bt_message_stream_activity_end_borrow_default_clock_snapshot_const()

The message's stream's class must have a defined default clock class in
order to use the setting functions.

When you set a stream activity message's default clock snapshot, the
clock snapshot's state within this message is
`BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_KNOWN`. The other
possible states are:

`BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_UNKNOWN` (default):
    It is not possible to know the exact time of this stream activity
    message at the source level.

`BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_INFINITE`:
    The stream is considered to have always existed (for a stream
    activity beginning message) or to exist forever (for a stream
    activity end message).

    A stream activity message with such a default clock snapshot state
    must either immediately follow a stream beginning message or
    immediately precede a stream end message.

You can set an explicit default clock snapshot state with:

* bt_message_stream_activity_beginning_set_default_clock_snapshot_state()
* bt_message_stream_activity_end_set_default_clock_snapshot_state()

bt_message_stream_activity_beginning_borrow_default_clock_snapshot_const()
and bt_message_stream_activity_end_borrow_default_clock_snapshot_const()
return the default clock snapshot's state.

Also in this patch: refactor the packet beginning/end and stream
beginning/end messages to avoid code duplication, and put the functions
in their own header file.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
32 files changed:
include/Makefile.am
include/babeltrace/babeltrace.h
include/babeltrace/graph/message-const.h
include/babeltrace/graph/message-internal.h
include/babeltrace/graph/message-packet-beginning-const.h [new file with mode: 0644]
include/babeltrace/graph/message-packet-beginning.h [new file with mode: 0644]
include/babeltrace/graph/message-packet-const.h [deleted file]
include/babeltrace/graph/message-packet-end-const.h [new file with mode: 0644]
include/babeltrace/graph/message-packet-end.h [new file with mode: 0644]
include/babeltrace/graph/message-packet-internal.h
include/babeltrace/graph/message-packet.h [deleted file]
include/babeltrace/graph/message-stream-activity-beginning-const.h [new file with mode: 0644]
include/babeltrace/graph/message-stream-activity-beginning.h [new file with mode: 0644]
include/babeltrace/graph/message-stream-activity-const.h [new file with mode: 0644]
include/babeltrace/graph/message-stream-activity-end-const.h [new file with mode: 0644]
include/babeltrace/graph/message-stream-activity-end.h [new file with mode: 0644]
include/babeltrace/graph/message-stream-activity-internal.h [new file with mode: 0644]
include/babeltrace/graph/message-stream-beginning-const.h [new file with mode: 0644]
include/babeltrace/graph/message-stream-beginning.h [new file with mode: 0644]
include/babeltrace/graph/message-stream-const.h [deleted file]
include/babeltrace/graph/message-stream-end-const.h [new file with mode: 0644]
include/babeltrace/graph/message-stream-end.h [new file with mode: 0644]
include/babeltrace/graph/message-stream-internal.h
include/babeltrace/graph/message-stream.h [deleted file]
lib/graph/graph.c
lib/graph/iterator.c
lib/graph/message/Makefile.am
lib/graph/message/message.c
lib/graph/message/packet.c
lib/graph/message/stream-activity.c [new file with mode: 0644]
lib/graph/message/stream.c
lib/lib-logging.c

index c3393e1738533272dbb9a17ec710f548a3c44386..4ed311a894de21f5502712ecdbbe57a6fe31e685 100644 (file)
@@ -173,10 +173,17 @@ babeltracegraphinclude_HEADERS = \
        babeltrace/graph/message-inactivity-const.h \
        babeltrace/graph/message-inactivity.h \
        babeltrace/graph/message-iterator-const.h \
-       babeltrace/graph/message-packet-const.h \
-       babeltrace/graph/message-packet.h \
-       babeltrace/graph/message-stream-const.h \
-       babeltrace/graph/message-stream.h \
+       babeltrace/graph/message-packet-beginning-const.h \
+       babeltrace/graph/message-packet-beginning.h \
+       babeltrace/graph/message-packet-end-const.h \
+       babeltrace/graph/message-packet-end.h \
+       babeltrace/graph/message-stream-activity-beginning.h \
+       babeltrace/graph/message-stream-activity-const.h \
+       babeltrace/graph/message-stream-activity-end.h \
+       babeltrace/graph/message-stream-beginning-const.h \
+       babeltrace/graph/message-stream-beginning.h \
+       babeltrace/graph/message-stream-end-const.h \
+       babeltrace/graph/message-stream-end.h \
        babeltrace/graph/port-const.h \
        babeltrace/graph/port-input-const.h \
        babeltrace/graph/port-output-const.h \
index 36d42258ccc25a24ef0de84a9a2fe3021b489ba8..253bd960567cd77e36d041502c47b9a03d541cf4 100644 (file)
 #include <babeltrace/graph/message-inactivity-const.h>
 #include <babeltrace/graph/message-inactivity.h>
 #include <babeltrace/graph/message-iterator-const.h>
-#include <babeltrace/graph/message-packet-const.h>
-#include <babeltrace/graph/message-packet.h>
-#include <babeltrace/graph/message-stream-const.h>
-#include <babeltrace/graph/message-stream.h>
+#include <babeltrace/graph/message-packet-beginning-const.h>
+#include <babeltrace/graph/message-packet-beginning.h>
+#include <babeltrace/graph/message-packet-end-const.h>
+#include <babeltrace/graph/message-packet-end.h>
+#include <babeltrace/graph/message-stream-activity-beginning.h>
+#include <babeltrace/graph/message-stream-activity-end.h>
+#include <babeltrace/graph/message-stream-beginning-const.h>
+#include <babeltrace/graph/message-stream-beginning.h>
+#include <babeltrace/graph/message-stream-end-const.h>
+#include <babeltrace/graph/message-stream-end.h>
 #include <babeltrace/graph/port-const.h>
 #include <babeltrace/graph/port-input-const.h>
 #include <babeltrace/graph/port-output-const.h>
index d445e5f7c15268885af6c11a047ffa14a5a7ab2f..5085192ace3c5db4188dce329a6a775598a192ac 100644 (file)
@@ -35,12 +35,14 @@ extern "C" {
  * Message types. Unhandled message types should be ignored.
  */
 typedef enum bt_message_type {
-       BT_MESSAGE_TYPE_EVENT =                 0,
-       BT_MESSAGE_TYPE_INACTIVITY =            1,
-       BT_MESSAGE_TYPE_STREAM_BEGINNING =      2,
-       BT_MESSAGE_TYPE_STREAM_END =            3,
-       BT_MESSAGE_TYPE_PACKET_BEGINNING =      4,
-       BT_MESSAGE_TYPE_PACKET_END =            5,
+       BT_MESSAGE_TYPE_EVENT = 0,
+       BT_MESSAGE_TYPE_INACTIVITY = 1,
+       BT_MESSAGE_TYPE_STREAM_BEGINNING = 2,
+       BT_MESSAGE_TYPE_STREAM_END = 3,
+       BT_MESSAGE_TYPE_PACKET_BEGINNING = 4,
+       BT_MESSAGE_TYPE_PACKET_END = 5,
+       BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING = 6,
+       BT_MESSAGE_TYPE_STREAM_ACTIVITY_END = 7,
 } bt_message_type;
 
 /**
index 967400241df30783f717f305f4bc1d297b54b64b..8c17ef9ea008865c46f125945c874cc0de606151 100644 (file)
@@ -124,6 +124,10 @@ const char *bt_message_type_string(enum bt_message_type type)
                return "BT_MESSAGE_TYPE_PACKET_BEGINNING";
        case BT_MESSAGE_TYPE_PACKET_END:
                return "BT_MESSAGE_TYPE_PACKET_END";
+       case BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING:
+               return "BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING";
+       case BT_MESSAGE_TYPE_STREAM_ACTIVITY_END:
+               return "BT_MESSAGE_TYPE_STREAM_ACTIVITY_END";
        default:
                return "(unknown)";
        }
diff --git a/include/babeltrace/graph/message-packet-beginning-const.h b/include/babeltrace/graph/message-packet-beginning-const.h
new file mode 100644 (file)
index 0000000..7806711
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_PACKET_BEGINNING_CONST_H
+#define BABELTRACE_GRAPH_MESSAGE_PACKET_BEGINNING_CONST_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message, bt_packet */
+#include <babeltrace/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const bt_packet *bt_message_packet_beginning_borrow_packet_const(
+               const bt_message *message);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_PACKET_BEGINNING_CONST_H */
diff --git a/include/babeltrace/graph/message-packet-beginning.h b/include/babeltrace/graph/message-packet-beginning.h
new file mode 100644 (file)
index 0000000..e7d4254
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_PACKET_BEGINNING_H
+#define BABELTRACE_GRAPH_MESSAGE_PACKET_BEGINNING_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message, bt_self_message_iterator, bt_packet */
+#include <babeltrace/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern
+bt_message *bt_message_packet_beginning_create(
+               bt_self_message_iterator *message_iterator,
+               bt_packet *packet);
+
+extern bt_packet *bt_message_packet_beginning_borrow_packet(
+               bt_message *message);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_PACKET_BEGINNING_H */
diff --git a/include/babeltrace/graph/message-packet-const.h b/include/babeltrace/graph/message-packet-const.h
deleted file mode 100644 (file)
index 997b39e..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef BABELTRACE_GRAPH_MESSAGE_PACKET_CONST_H
-#define BABELTRACE_GRAPH_MESSAGE_PACKET_CONST_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/* For bt_message, bt_packet */
-#include <babeltrace/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern const bt_packet *bt_message_packet_beginning_borrow_packet_const(
-               const bt_message *message);
-
-extern const bt_packet *bt_message_packet_end_borrow_packet_const(
-               const bt_message *message);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_MESSAGE_PACKET_CONST_H */
diff --git a/include/babeltrace/graph/message-packet-end-const.h b/include/babeltrace/graph/message-packet-end-const.h
new file mode 100644 (file)
index 0000000..8da580f
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_PACKET_END_CONST_H
+#define BABELTRACE_GRAPH_MESSAGE_PACKET_END_CONST_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message, bt_packet */
+#include <babeltrace/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const bt_packet *bt_message_packet_end_borrow_packet_const(
+               const bt_message *message);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_PACKET_END_CONST_H */
diff --git a/include/babeltrace/graph/message-packet-end.h b/include/babeltrace/graph/message-packet-end.h
new file mode 100644 (file)
index 0000000..12cf0fc
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_PACKET_END_H
+#define BABELTRACE_GRAPH_MESSAGE_PACKET_END_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message, bt_self_message_iterator, bt_packet */
+#include <babeltrace/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern
+bt_message *bt_message_packet_end_create(
+               bt_self_message_iterator *message_iterator,
+               bt_packet *packet);
+
+extern bt_packet *bt_message_packet_end_borrow_packet(
+               bt_message *message);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_PACKET_END_H */
index 5a60e006bb711220cfe0e93376a8609222a35234..e34adf65664411f28209101b41c67ae1c81c6310 100644 (file)
 #include <babeltrace/graph/message-internal.h>
 #include <babeltrace/assert-internal.h>
 
-struct bt_message_packet_beginning {
+struct bt_message_packet {
        struct bt_message parent;
        struct bt_packet *packet;
 };
 
-struct bt_message_packet_end {
-       struct bt_message parent;
-       struct bt_packet *packet;
-};
+BT_HIDDEN
+void bt_message_packet_destroy(struct bt_message *msg);
 
 BT_HIDDEN
 struct bt_message *bt_message_packet_beginning_new(
@@ -45,16 +43,10 @@ struct bt_message *bt_message_packet_beginning_new(
 BT_HIDDEN
 void bt_message_packet_beginning_recycle(struct bt_message *msg);
 
-BT_HIDDEN
-void bt_message_packet_beginning_destroy(struct bt_message *msg);
-
 BT_HIDDEN
 struct bt_message *bt_message_packet_end_new(struct bt_graph *graph);
 
 BT_HIDDEN
 void bt_message_packet_end_recycle(struct bt_message *msg);
 
-BT_HIDDEN
-void bt_message_packet_end_destroy(struct bt_message *msg);
-
 #endif /* BABELTRACE_GRAPH_MESSAGE_PACKET_INTERNAL_H */
diff --git a/include/babeltrace/graph/message-packet.h b/include/babeltrace/graph/message-packet.h
deleted file mode 100644 (file)
index 0ee0f6d..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef BABELTRACE_GRAPH_MESSAGE_PACKET_H
-#define BABELTRACE_GRAPH_MESSAGE_PACKET_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/* For bt_message, bt_self_message_iterator, bt_packet */
-#include <babeltrace/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern
-bt_message *bt_message_packet_beginning_create(
-               bt_self_message_iterator *message_iterator,
-               bt_packet *packet);
-
-extern
-bt_message *bt_message_packet_end_create(
-               bt_self_message_iterator *message_iterator,
-               bt_packet *packet);
-
-extern bt_packet *bt_message_packet_beginning_borrow_packet(
-               bt_message *message);
-
-extern bt_packet *bt_message_packet_end_borrow_packet(
-               bt_message *message);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_MESSAGE_PACKET_H */
diff --git a/include/babeltrace/graph/message-stream-activity-beginning-const.h b/include/babeltrace/graph/message-stream-activity-beginning-const.h
new file mode 100644 (file)
index 0000000..919b118
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_STREAM_ACTIVITY_BEGINNING_CONST_H
+#define BABELTRACE_GRAPH_MESSAGE_STREAM_ACTIVITY_BEGINNING_CONST_H
+
+/*
+ * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message, bt_clock_snapshot, bt_stream */
+#include <babeltrace/types.h>
+
+/* For bt_message_stream_activity_clock_snapshot_state */
+#include <babeltrace/graph/message-stream-activity-const.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern bt_message_stream_activity_clock_snapshot_state
+bt_message_stream_activity_beginning_borrow_default_clock_snapshot_const(
+               const bt_message *msg, const bt_clock_snapshot **snapshot);
+
+extern const bt_stream *
+bt_message_stream_activity_beginning_borrow_stream_const(
+               const bt_message *message);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_STREAM_ACTIVITY_BEGINNING_CONST_H */
diff --git a/include/babeltrace/graph/message-stream-activity-beginning.h b/include/babeltrace/graph/message-stream-activity-beginning.h
new file mode 100644 (file)
index 0000000..2449a72
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_STREAM_ACTIVITY_BEGINNING_H
+#define BABELTRACE_GRAPH_MESSAGE_STREAM_ACTIVITY_BEGINNING_H
+
+/*
+ * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message, bt_self_message_iterator, bt_stream */
+#include <babeltrace/types.h>
+
+/* For bt_message_stream_activity_clock_snapshot_state */
+#include <babeltrace/graph/message-stream-activity-const.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern bt_message *bt_message_stream_activity_beginning_create(
+               bt_self_message_iterator *message_iterator,
+               bt_stream *stream);
+
+extern bt_stream *bt_message_stream_activity_beginning_borrow_stream(
+               bt_message *message);
+
+extern void bt_message_stream_activity_beginning_set_default_clock_snapshot_state(
+               bt_message *msg,
+               bt_message_stream_activity_clock_snapshot_state state);
+
+extern void bt_message_stream_activity_beginning_set_default_clock_snapshot(
+               bt_message *msg, uint64_t raw_value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_STREAM_ACTIVITY_BEGINNING_H */
diff --git a/include/babeltrace/graph/message-stream-activity-const.h b/include/babeltrace/graph/message-stream-activity-const.h
new file mode 100644 (file)
index 0000000..b84e27b
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_STREAM_ACTIVITY_CONST_H
+#define BABELTRACE_GRAPH_MESSAGE_STREAM_ACTIVITY_CONST_H
+
+/*
+ * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum bt_message_stream_activity_clock_snapshot_state {
+       BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_KNOWN,
+       BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_UNKNOWN,
+       BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_INFINITE,
+} bt_message_stream_activity_clock_snapshot_state;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_STREAM_ACTIVITY_CONST_H */
diff --git a/include/babeltrace/graph/message-stream-activity-end-const.h b/include/babeltrace/graph/message-stream-activity-end-const.h
new file mode 100644 (file)
index 0000000..d10540a
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_STREAM_ACTIVITY_END_CONST_H
+#define BABELTRACE_GRAPH_MESSAGE_STREAM_ACTIVITY_END_CONST_H
+
+/*
+ * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message, bt_clock_snapshot, bt_stream */
+#include <babeltrace/types.h>
+
+/* For bt_message_stream_activity_clock_snapshot_state */
+#include <babeltrace/graph/message-stream-activity-const.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern bt_message_stream_activity_clock_snapshot_state
+bt_message_stream_activity_end_borrow_default_clock_snapshot_const(
+               const bt_message *msg, const bt_clock_snapshot **snapshot);
+
+extern const bt_stream *
+bt_message_stream_activity_end_borrow_stream_const(
+               const bt_message *message);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_STREAM_ACTIVITY_END_CONST_H */
diff --git a/include/babeltrace/graph/message-stream-activity-end.h b/include/babeltrace/graph/message-stream-activity-end.h
new file mode 100644 (file)
index 0000000..7836745
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_STREAM_ACTIVITY_END_H
+#define BABELTRACE_GRAPH_MESSAGE_STREAM_ACTIVITY_END_H
+
+/*
+ * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message, bt_self_message_iterator, bt_stream */
+#include <babeltrace/types.h>
+
+/* For bt_message_stream_activity_clock_snapshot_state */
+#include <babeltrace/graph/message-stream-activity-const.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern bt_message *bt_message_stream_activity_end_create(
+               bt_self_message_iterator *message_iterator,
+               bt_stream *stream);
+
+extern void bt_message_stream_activity_end_set_default_clock_snapshot_state(
+               bt_message *msg,
+               bt_message_stream_activity_clock_snapshot_state state);
+
+extern void bt_message_stream_activity_end_set_default_clock_snapshot(
+               bt_message *msg, uint64_t raw_value);
+
+extern bt_stream *bt_message_stream_activity_end_borrow_stream(
+               bt_message *message);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_STREAM_ACTIVITY_END_H */
diff --git a/include/babeltrace/graph/message-stream-activity-internal.h b/include/babeltrace/graph/message-stream-activity-internal.h
new file mode 100644 (file)
index 0000000..d90409d
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_STREAM_ACTIVITY_INTERNAL_H
+#define BABELTRACE_GRAPH_MESSAGE_STREAM_ACTIVITY_INTERNAL_H
+
+/*
+ * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <glib.h>
+#include <babeltrace/trace-ir/clock-snapshot-internal.h>
+#include <babeltrace/trace-ir/stream-internal.h>
+#include <babeltrace/graph/message-const.h>
+#include <babeltrace/graph/message-stream-activity-const.h>
+
+struct bt_message_stream_activity {
+       struct bt_message parent;
+       struct bt_stream *stream;
+       struct bt_clock_snapshot *default_cs;
+       enum bt_message_stream_activity_clock_snapshot_state default_cs_state;
+};
+
+static inline
+const char *bt_message_stream_activity_clock_snapshot_state_string(
+               enum bt_message_stream_activity_clock_snapshot_state state)
+{
+       switch (state) {
+       case BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_KNOWN:
+               return "BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_KNOWN";
+       case BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_UNKNOWN:
+               return "BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_UNKNOWN";
+       case BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_INFINITE:
+               return "BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_INFINITE";
+       default:
+               return "(unknown)";
+       }
+}
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_STREAM_ACTIVITY_INTERNAL_H */
diff --git a/include/babeltrace/graph/message-stream-beginning-const.h b/include/babeltrace/graph/message-stream-beginning-const.h
new file mode 100644 (file)
index 0000000..09960f7
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_STREAM_BEGINNING_CONST_H
+#define BABELTRACE_GRAPH_MESSAGE_STREAM_BEGINNING_CONST_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message, bt_clock_snapshot, bt_stream */
+#include <babeltrace/types.h>
+
+/* For bt_clock_snapshot_state */
+#include <babeltrace/trace-ir/clock-snapshot-const.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const bt_stream *bt_message_stream_beginning_borrow_stream_const(
+               const bt_message *message);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_STREAM_BEGINNING_CONST_H */
diff --git a/include/babeltrace/graph/message-stream-beginning.h b/include/babeltrace/graph/message-stream-beginning.h
new file mode 100644 (file)
index 0000000..339c819
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_STREAM_BEGINNING_H
+#define BABELTRACE_GRAPH_MESSAGE_STREAM_BEGINNING_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message, bt_self_message_iterator, bt_stream */
+#include <babeltrace/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern
+bt_message *bt_message_stream_beginning_create(
+               bt_self_message_iterator *message_iterator,
+               bt_stream *stream);
+
+extern bt_stream *bt_message_stream_beginning_borrow_stream(
+               bt_message *message);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_STREAM_BEGINNING_H */
diff --git a/include/babeltrace/graph/message-stream-const.h b/include/babeltrace/graph/message-stream-const.h
deleted file mode 100644 (file)
index fbac596..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef BABELTRACE_GRAPH_MESSAGE_STREAM_CONST_H
-#define BABELTRACE_GRAPH_MESSAGE_STREAM_CONST_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/* For bt_message, bt_clock_snapshot, bt_stream */
-#include <babeltrace/types.h>
-
-/* For bt_clock_snapshot_state */
-#include <babeltrace/trace-ir/clock-snapshot-const.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern const bt_stream *bt_message_stream_beginning_borrow_stream_const(
-               const bt_message *message);
-
-extern const bt_stream *bt_message_stream_end_borrow_stream_const(
-               const bt_message *message);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_MESSAGE_STREAM_CONST_H */
diff --git a/include/babeltrace/graph/message-stream-end-const.h b/include/babeltrace/graph/message-stream-end-const.h
new file mode 100644 (file)
index 0000000..1ee0a47
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_STREAM_BEGINNING_END_H
+#define BABELTRACE_GRAPH_MESSAGE_STREAM_BEGINNING_END_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message, bt_clock_snapshot, bt_stream */
+#include <babeltrace/types.h>
+
+/* For bt_clock_snapshot_state */
+#include <babeltrace/trace-ir/clock-snapshot-const.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const bt_stream *bt_message_stream_end_borrow_stream_const(
+               const bt_message *message);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_STREAM_BEGINNING_END_H */
diff --git a/include/babeltrace/graph/message-stream-end.h b/include/babeltrace/graph/message-stream-end.h
new file mode 100644 (file)
index 0000000..a9865d4
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_STREAM_END_H
+#define BABELTRACE_GRAPH_MESSAGE_STREAM_END_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message, bt_self_message_iterator, bt_stream */
+#include <babeltrace/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern
+bt_message *bt_message_stream_end_create(
+               bt_self_message_iterator *message_iterator,
+               bt_stream *stream);
+
+extern bt_stream *bt_message_stream_end_borrow_stream(
+               bt_message *message);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_STREAM_END_H */
index 36e4580c04e5def7baf19b4c3b494767acd2113e..8cdcdda09e645e4dc98bb9779b495d2d313fbf88 100644 (file)
  */
 
 #include <babeltrace/compiler-internal.h>
-#include <babeltrace/trace-ir/packet.h>
+#include <babeltrace/trace-ir/stream-internal.h>
 #include <babeltrace/graph/message-internal.h>
 #include <babeltrace/trace-ir/clock-snapshot-internal.h>
 #include <babeltrace/assert-internal.h>
 
-struct bt_message_stream_beginning {
-       struct bt_message parent;
-       struct bt_stream *stream;
-};
-
-struct bt_message_stream_end {
+struct bt_message_stream {
        struct bt_message parent;
        struct bt_stream *stream;
 };
diff --git a/include/babeltrace/graph/message-stream.h b/include/babeltrace/graph/message-stream.h
deleted file mode 100644 (file)
index e12b909..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef BABELTRACE_GRAPH_MESSAGE_STREAM_H
-#define BABELTRACE_GRAPH_MESSAGE_STREAM_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/* For bt_message, bt_self_message_iterator, bt_stream */
-#include <babeltrace/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern
-bt_message *bt_message_stream_beginning_create(
-               bt_self_message_iterator *message_iterator,
-               bt_stream *stream);
-
-extern
-bt_message *bt_message_stream_end_create(
-               bt_self_message_iterator *message_iterator,
-               bt_stream *stream);
-
-extern bt_stream *bt_message_stream_beginning_borrow_stream(
-               bt_message *message);
-
-extern bt_stream *bt_message_stream_end_borrow_stream(
-               bt_message *message);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_MESSAGE_STREAM_H */
index f0a919f681705e7b27661e6b98af61ec2c6c8cce..d5fc0b6b54c36eec69ad9a2f89204469da46f6fa 100644 (file)
@@ -233,14 +233,14 @@ static
 void destroy_message_packet_begin(struct bt_message *msg,
                struct bt_graph *graph)
 {
-       bt_message_packet_beginning_destroy(msg);
+       bt_message_packet_destroy(msg);
 }
 
 static
 void destroy_message_packet_end(struct bt_message *msg,
                struct bt_graph *graph)
 {
-       bt_message_packet_end_destroy(msg);
+       bt_message_packet_destroy(msg);
 }
 
 static
index 9fc612cce5bfd1e8e1d0a48dbe7ef08b5721f3a7..a0da4e6650b9f75755b702286cd1868f56a08a3f 100644 (file)
 #include <babeltrace/graph/message-internal.h>
 #include <babeltrace/graph/message-event-const.h>
 #include <babeltrace/graph/message-event-internal.h>
-#include <babeltrace/graph/message-packet-const.h>
+#include <babeltrace/graph/message-packet-beginning-const.h>
+#include <babeltrace/graph/message-packet-end-const.h>
 #include <babeltrace/graph/message-packet-internal.h>
-#include <babeltrace/graph/message-stream-const.h>
+#include <babeltrace/graph/message-stream-beginning-const.h>
+#include <babeltrace/graph/message-stream-end-const.h>
 #include <babeltrace/graph/message-stream-internal.h>
 #include <babeltrace/graph/message-inactivity-internal.h>
 #include <babeltrace/graph/port-const.h>
@@ -1002,7 +1004,7 @@ int get_message_ns_from_origin(const struct bt_message *msg,
                goto end;
        case BT_MESSAGE_TYPE_PACKET_BEGINNING:
        {
-               const struct bt_message_packet_beginning *pkt_msg =
+               const struct bt_message_packet *pkt_msg =
                        (const void *) msg;
 
                clk_snapshot = pkt_msg->packet->default_beginning_cs;
@@ -1010,7 +1012,7 @@ int get_message_ns_from_origin(const struct bt_message *msg,
        }
        case BT_MESSAGE_TYPE_PACKET_END:
        {
-               const struct bt_message_packet_end *pkt_msg =
+               const struct bt_message_packet *pkt_msg =
                        (const void *) msg;
 
                clk_snapshot = pkt_msg->packet->default_end_cs;
index d111f5b8736975a7ab3d1f71b35cf90609a5c39f..20f6a00010fe1f7269fa03ff9a5cb2286a0bc167 100644 (file)
@@ -5,4 +5,5 @@ libgraph_message_la_SOURCES = \
        packet.c \
        event.c \
        stream.c \
-       inactivity.c
+       inactivity.c \
+       stream-activity.c
index 545d67cbcc574771a6e8b232bc909e3d74ee89df..f258eb1ed78d8162ed2f04ac34b1bb660bd758f4 100644 (file)
@@ -36,7 +36,7 @@ void bt_message_init(struct bt_message *message,
                bt_object_release_func release,
                struct bt_graph *graph)
 {
-       BT_ASSERT(type >= 0 && type <= BT_MESSAGE_TYPE_PACKET_END);
+       BT_ASSERT(type >= 0 && type <= BT_MESSAGE_TYPE_STREAM_ACTIVITY_END);
        message->type = type;
        bt_object_init_shared(&message->base, release);
        message->graph = graph;
index 22894c9b611c3b088be5b82e64316c101e2931f9..32ce5698091daa10d67d569f290af546f89c470d 100644 (file)
 #include <babeltrace/trace-ir/stream.h>
 #include <babeltrace/trace-ir/stream-internal.h>
 #include <babeltrace/graph/graph-internal.h>
-#include <babeltrace/graph/message-packet-const.h>
-#include <babeltrace/graph/message-packet.h>
+#include <babeltrace/graph/message-packet-beginning-const.h>
+#include <babeltrace/graph/message-packet-end-const.h>
+#include <babeltrace/graph/message-packet-beginning.h>
+#include <babeltrace/graph/message-packet-end.h>
 #include <babeltrace/graph/message-packet-internal.h>
 #include <babeltrace/assert-internal.h>
 #include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/object-internal.h>
 #include <inttypes.h>
 
-BT_HIDDEN
-struct bt_message *bt_message_packet_beginning_new(struct bt_graph *graph)
+static inline
+struct bt_message *new_packet_message(struct bt_graph *graph,
+               enum bt_message_type type, bt_object_release_func recycle_func)
 {
-       struct bt_message_packet_beginning *message;
+       struct bt_message_packet *message;
 
-       message = g_new0(struct bt_message_packet_beginning, 1);
+       message = g_new0(struct bt_message_packet, 1);
        if (!message) {
-               BT_LOGE_STR("Failed to allocate one packet beginning message.");
+               BT_LOGE_STR("Failed to allocate one packet message.");
                goto error;
        }
 
-       bt_message_init(&message->parent,
-                       BT_MESSAGE_TYPE_PACKET_BEGINNING,
-                       (bt_object_release_func) bt_message_packet_beginning_recycle,
-                       graph);
+       bt_message_init(&message->parent, type, recycle_func, graph);
        goto end;
 
 error:
@@ -63,27 +63,39 @@ end:
        return (void *) message;
 }
 
-struct bt_message *bt_message_packet_beginning_create(
-               struct bt_self_message_iterator *self_msg_iter,
-               struct bt_packet *packet)
+BT_HIDDEN
+struct bt_message *bt_message_packet_beginning_new(struct bt_graph *graph)
 {
-       struct bt_self_component_port_input_message_iterator *msg_iter =
-               (void *) self_msg_iter;
-       struct bt_message_packet_beginning *message = NULL;
+       return new_packet_message(graph, BT_MESSAGE_TYPE_PACKET_BEGINNING,
+               (bt_object_release_func) bt_message_packet_beginning_recycle);
+}
+
+BT_HIDDEN
+struct bt_message *bt_message_packet_end_new(struct bt_graph *graph)
+{
+       return new_packet_message(graph, BT_MESSAGE_TYPE_PACKET_END,
+               (bt_object_release_func) bt_message_packet_end_recycle);
+}
+
+static inline
+struct bt_message *bt_message_packet_create(
+               struct bt_self_component_port_input_message_iterator *msg_iter,
+               struct bt_packet *packet, struct bt_object_pool *pool)
+{
+       struct bt_message_packet *message = NULL;
        struct bt_stream *stream;
        struct bt_stream_class *stream_class;
 
-       BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator");
+       BT_ASSERT(msg_iter);
        BT_ASSERT_PRE_NON_NULL(packet, "Packet");
        stream = bt_packet_borrow_stream(packet);
        BT_ASSERT(stream);
        stream_class = bt_stream_borrow_class(stream);
        BT_ASSERT(stream_class);
-       BT_LIB_LOGD("Creating packet beginning message object: "
+       BT_LIB_LOGD("Creating packet message object: "
                "%![packet-]+a, %![stream-]+s, %![sc-]+S",
                packet, stream, stream_class);
-       message = (void *) bt_message_create_from_pool(
-               &msg_iter->graph->packet_begin_msg_pool, msg_iter->graph);
+       message = (void *) bt_message_create_from_pool(pool, msg_iter->graph);
        if (!message) {
                /* bt_message_create_from_pool() logs errors */
                goto end;
@@ -94,7 +106,7 @@ struct bt_message *bt_message_packet_beginning_create(
        bt_object_get_no_null_check_no_parent_check(
                &message->packet->base);
        bt_packet_set_is_frozen(packet, true);
-       BT_LIB_LOGD("Created packet beginning message object: "
+       BT_LIB_LOGD("Created packet message object: "
                "%![msg-]+n, %![packet-]+a, %![stream-]+s, %![sc-]+S",
                message, packet, stream, stream_class);
        goto end;
@@ -103,164 +115,107 @@ end:
        return (void *) message;
 }
 
-BT_HIDDEN
-void bt_message_packet_beginning_destroy(struct bt_message *msg)
+struct bt_message *bt_message_packet_beginning_create(
+               struct bt_self_message_iterator *self_msg_iter,
+               struct bt_packet *packet)
 {
-       struct bt_message_packet_beginning *packet_begin_msg = (void *) msg;
+       struct bt_self_component_port_input_message_iterator *msg_iter =
+               (void *) self_msg_iter;
 
-       BT_LIB_LOGD("Destroying packet beginning message: %!+n", msg);
-       BT_LIB_LOGD("Putting packet: %!+a", packet_begin_msg->packet);
-       BT_OBJECT_PUT_REF_AND_RESET(packet_begin_msg->packet);
-       g_free(msg);
+       BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator");
+       return bt_message_packet_create(msg_iter, packet,
+               &msg_iter->graph->packet_begin_msg_pool);
 }
 
-BT_HIDDEN
-void bt_message_packet_beginning_recycle(struct bt_message *msg)
+struct bt_message *bt_message_packet_end_create(
+               struct bt_self_message_iterator *self_msg_iter,
+               struct bt_packet *packet)
 {
-       struct bt_message_packet_beginning *packet_begin_msg = (void *) msg;
-       struct bt_graph *graph;
-
-       BT_ASSERT(packet_begin_msg);
-
-       if (unlikely(!msg->graph)) {
-               bt_message_packet_beginning_destroy(msg);
-               return;
-       }
+       struct bt_self_component_port_input_message_iterator *msg_iter =
+               (void *) self_msg_iter;
 
-       BT_LIB_LOGD("Recycling packet beginning message: %!+n", msg);
-       bt_message_reset(msg);
-       bt_object_put_no_null_check(&packet_begin_msg->packet->base);
-       packet_begin_msg->packet = NULL;
-       graph = msg->graph;
-       msg->graph = NULL;
-       bt_object_pool_recycle_object(&graph->packet_begin_msg_pool, msg);
+       BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator");
+       return bt_message_packet_create(msg_iter, packet,
+               &msg_iter->graph->packet_end_msg_pool);
 }
 
-struct bt_packet *bt_message_packet_beginning_borrow_packet(
-               struct bt_message *message)
+BT_HIDDEN
+void bt_message_packet_destroy(struct bt_message *msg)
 {
-       struct bt_message_packet_beginning *packet_begin;
+       struct bt_message_packet *packet_msg = (void *) msg;
 
-       BT_ASSERT_PRE_NON_NULL(message, "Message");
-       BT_ASSERT_PRE_MSG_IS_TYPE(message,
-               BT_MESSAGE_TYPE_PACKET_BEGINNING);
-       packet_begin = (void *) message;
-       return packet_begin->packet;
+       BT_LIB_LOGD("Destroying packet message: %!+n", msg);
+       BT_LIB_LOGD("Putting packet: %!+a", packet_msg->packet);
+       BT_OBJECT_PUT_REF_AND_RESET(packet_msg->packet);
+       g_free(msg);
 }
 
-const struct bt_packet *bt_message_packet_beginning_borrow_packet_const(
-               const struct bt_message *message)
+static inline
+void recycle_packet_message(struct bt_message *msg, struct bt_object_pool *pool)
 {
-       return bt_message_packet_beginning_borrow_packet(
-               (void *) message);
+       struct bt_message_packet *packet_msg = (void *) msg;
+
+       BT_LIB_LOGD("Recycling packet message: %!+n", msg);
+       bt_message_reset(msg);
+       bt_object_put_no_null_check(&packet_msg->packet->base);
+       packet_msg->packet = NULL;
+       msg->graph = NULL;
+       bt_object_pool_recycle_object(pool, msg);
 }
 
 BT_HIDDEN
-struct bt_message *bt_message_packet_end_new(struct bt_graph *graph)
+void bt_message_packet_beginning_recycle(struct bt_message *msg)
 {
-       struct bt_message_packet_end *message;
+       BT_ASSERT(msg);
 
-       message = g_new0(struct bt_message_packet_end, 1);
-       if (!message) {
-               BT_LOGE_STR("Failed to allocate one packet end message.");
-               goto error;
+       if (unlikely(!msg->graph)) {
+               bt_message_packet_destroy(msg);
+               return;
        }
 
-       bt_message_init(&message->parent,
-                       BT_MESSAGE_TYPE_PACKET_END,
-                       (bt_object_release_func) bt_message_packet_end_recycle,
-                       graph);
-       goto end;
-
-error:
-       BT_OBJECT_PUT_REF_AND_RESET(message);
-
-end:
-       return (void *) message;
+       recycle_packet_message(msg, &msg->graph->packet_begin_msg_pool);
 }
 
-struct bt_message *bt_message_packet_end_create(
-               struct bt_self_message_iterator *self_msg_iter,
-               struct bt_packet *packet)
+BT_HIDDEN
+void bt_message_packet_end_recycle(struct bt_message *msg)
 {
-       struct bt_self_component_port_input_message_iterator *msg_iter =
-               (void *) self_msg_iter;
-       struct bt_message_packet_end *message = NULL;
-       struct bt_stream *stream;
-       struct bt_stream_class *stream_class;
+       BT_ASSERT(msg);
 
-       BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator");
-       BT_ASSERT_PRE_NON_NULL(packet, "Packet");
-       stream = bt_packet_borrow_stream(packet);
-       BT_ASSERT(stream);
-       stream_class = bt_stream_borrow_class(stream);
-       BT_ASSERT(stream_class);
-       BT_LIB_LOGD("Creating packet end message object: "
-               "%![packet-]+a, %![stream-]+s, %![sc-]+S",
-               packet, stream, stream_class);
-       message = (void *) bt_message_create_from_pool(
-               &msg_iter->graph->packet_end_msg_pool, msg_iter->graph);
-       if (!message) {
-               /* bt_message_create_from_pool() logs errors */
-               goto end;
+       if (unlikely(!msg->graph)) {
+               bt_message_packet_destroy(msg);
+               return;
        }
 
-       BT_ASSERT(!message->packet);
-       message->packet = packet;
-       bt_object_get_no_null_check_no_parent_check(
-               &message->packet->base);
-       bt_packet_set_is_frozen(packet, true);
-       BT_LIB_LOGD("Created packet end message object: "
-               "%![msg-]+n, %![packet-]+a, %![stream-]+s, %![sc-]+S",
-               message, packet, stream, stream_class);
-       goto end;
-
-end:
-       return (void *) message;
+       recycle_packet_message(msg, &msg->graph->packet_end_msg_pool);
 }
 
-BT_HIDDEN
-void bt_message_packet_end_destroy(struct bt_message *msg)
+struct bt_packet *bt_message_packet_beginning_borrow_packet(
+               struct bt_message *message)
 {
-       struct bt_message_packet_end *packet_end_msg = (void *) msg;
+       struct bt_message_packet *packet_msg = (void *) message;
 
-       BT_LIB_LOGD("Destroying packet end message: %!+n", msg);
-       BT_LIB_LOGD("Putting packet: %!+a", packet_end_msg->packet);
-       BT_OBJECT_PUT_REF_AND_RESET(packet_end_msg->packet);
-       g_free(msg);
+       BT_ASSERT_PRE_NON_NULL(message, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(message,
+               BT_MESSAGE_TYPE_PACKET_BEGINNING);
+       return packet_msg->packet;
 }
 
-BT_HIDDEN
-void bt_message_packet_end_recycle(struct bt_message *msg)
+const struct bt_packet *bt_message_packet_beginning_borrow_packet_const(
+               const struct bt_message *message)
 {
-       struct bt_message_packet_end *packet_end_msg = (void *) msg;
-       struct bt_graph *graph;
-
-       BT_ASSERT(packet_end_msg);
-
-       if (!msg->graph) {
-               bt_message_packet_end_destroy(msg);
-               return;
-       }
-
-       BT_LIB_LOGD("Recycling packet end message: %!+n", msg);
-       bt_message_reset(msg);
-       BT_OBJECT_PUT_REF_AND_RESET(packet_end_msg->packet);
-       graph = msg->graph;
-       msg->graph = NULL;
-       bt_object_pool_recycle_object(&graph->packet_end_msg_pool, msg);
+       return bt_message_packet_beginning_borrow_packet(
+               (void *) message);
 }
 
 struct bt_packet *bt_message_packet_end_borrow_packet(
                struct bt_message *message)
 {
-       struct bt_message_packet_end *packet_end;
+       struct bt_message_packet *packet_msg = (void *) message;
 
        BT_ASSERT_PRE_NON_NULL(message, "Message");
        BT_ASSERT_PRE_MSG_IS_TYPE(message,
                BT_MESSAGE_TYPE_PACKET_END);
-       packet_end = (void *) message;
-       return packet_end->packet;
+       return packet_msg->packet;
 }
 
 const struct bt_packet *bt_message_packet_end_borrow_packet_const(
diff --git a/lib/graph/message/stream-activity.c b/lib/graph/message/stream-activity.c
new file mode 100644 (file)
index 0000000..79f4319
--- /dev/null
@@ -0,0 +1,270 @@
+/*
+ * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#define BT_LOG_TAG "MSG-STREAM-ACTIVITY"
+#include <babeltrace/lib-logging-internal.h>
+
+#include <babeltrace/assert-pre-internal.h>
+#include <babeltrace/object-internal.h>
+#include <babeltrace/compiler-internal.h>
+#include <babeltrace/trace-ir/clock-class.h>
+#include <babeltrace/trace-ir/clock-snapshot-internal.h>
+#include <babeltrace/trace-ir/stream-class-internal.h>
+#include <babeltrace/trace-ir/stream-internal.h>
+#include <babeltrace/graph/message-internal.h>
+#include <babeltrace/graph/message-stream-activity-beginning-const.h>
+#include <babeltrace/graph/message-stream-activity-end-const.h>
+#include <babeltrace/graph/message-stream-activity-beginning.h>
+#include <babeltrace/graph/message-stream-activity-end.h>
+#include <babeltrace/graph/message-stream-activity-internal.h>
+
+static
+void destroy_stream_activity_message(struct bt_object *obj)
+{
+       struct bt_message_stream_activity *message = (void *) obj;
+
+       BT_LIB_LOGD("Destroying stream activity message: %!+n", message);
+       BT_LIB_LOGD("Putting stream: %!+s", message->stream);
+       BT_OBJECT_PUT_REF_AND_RESET(message->stream);
+
+       if (message->default_cs) {
+               bt_clock_snapshot_recycle(message->default_cs);
+       }
+
+       g_free(message);
+}
+
+static inline
+struct bt_message *create_stream_activity_message(
+               struct bt_self_message_iterator *self_msg_iter,
+               struct bt_stream *stream, enum bt_message_type type)
+{
+       struct bt_message_stream_activity *message;
+       struct bt_stream_class *stream_class;
+
+       BT_ASSERT_PRE_NON_NULL(self_msg_iter, "Message iterator");
+       BT_ASSERT_PRE_NON_NULL(stream, "Stream");
+       stream_class = bt_stream_borrow_class(stream);
+       BT_ASSERT(stream_class);
+       BT_LIB_LOGD("Creating stream activity message object: "
+               "type=%s, %![stream-]+s, %![sc-]+S",
+               bt_message_type_string(type), stream, stream_class);
+       message = g_new0(struct bt_message_stream_activity, 1);
+       if (!message) {
+               BT_LOGE_STR("Failed to allocate one stream activity message.");
+               goto error;
+       }
+
+       bt_message_init(&message->parent, type,
+               destroy_stream_activity_message, NULL);
+       message->stream = stream;
+       bt_object_get_no_null_check(message->stream);
+
+       if (stream_class->default_clock_class) {
+               message->default_cs = bt_clock_snapshot_create(
+                       stream_class->default_clock_class);
+               if (!message->default_cs) {
+                       goto error;
+               }
+       }
+
+       message->default_cs_state =
+               BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_UNKNOWN;
+       BT_LIB_LOGD("Created stream activity message object: "
+               "%![msg-]+n, %![stream-]+s, %![sc-]+S", message,
+               stream, stream_class);
+
+       return (void *) &message->parent;
+
+error:
+       return NULL;
+}
+
+struct bt_message *bt_message_stream_activity_beginning_create(
+               struct bt_self_message_iterator *self_msg_iter,
+               struct bt_stream *stream)
+{
+       return create_stream_activity_message(self_msg_iter, stream,
+               BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING);
+}
+
+struct bt_message *bt_message_stream_activity_end_create(
+               struct bt_self_message_iterator *self_msg_iter,
+               struct bt_stream *stream)
+{
+       return create_stream_activity_message(self_msg_iter, stream,
+               BT_MESSAGE_TYPE_STREAM_ACTIVITY_END);
+}
+
+static inline
+struct bt_stream *borrow_stream_activity_message_stream(
+               struct bt_message *message)
+{
+       struct bt_message_stream_activity *stream_act_msg = (void *) message;
+
+       BT_ASSERT(message);
+       return stream_act_msg->stream;
+}
+
+struct bt_stream *bt_message_stream_activity_beginning_borrow_stream(
+               struct bt_message *message)
+{
+       BT_ASSERT_PRE_NON_NULL(message, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(message,
+               BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING);
+       return borrow_stream_activity_message_stream(message);
+}
+
+struct bt_stream *bt_message_stream_activity_end_borrow_stream(
+               struct bt_message *message)
+{
+       BT_ASSERT_PRE_NON_NULL(message, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(message,
+               BT_MESSAGE_TYPE_STREAM_ACTIVITY_END);
+       return borrow_stream_activity_message_stream(message);
+}
+
+const struct bt_stream *bt_message_stream_activity_beginning_borrow_stream_const(
+               const struct bt_message *message)
+{
+       return bt_message_stream_activity_beginning_borrow_stream(
+               (void *) message);
+}
+
+const struct bt_stream *bt_message_stream_activity_end_borrow_stream_const(
+               const struct bt_message *message)
+{
+       return bt_message_stream_activity_end_borrow_stream((void *) message);
+}
+
+static inline
+void set_stream_activity_message_default_clock_snapshot(
+               struct bt_message *msg, uint64_t value_cycles)
+{
+       struct bt_message_stream_activity *stream_act_msg = (void *) msg;
+       struct bt_stream_class *sc;
+
+       BT_ASSERT(msg);
+       BT_ASSERT_PRE_HOT(msg, "Message", ": %!+n", msg);
+       sc = stream_act_msg->stream->class;
+       BT_ASSERT(sc);
+       BT_ASSERT_PRE(sc->default_clock_class,
+               "Message's stream's class has no default clock class: "
+               "%![msg-]+n, %![sc-]+S", msg, sc);
+       bt_clock_snapshot_set_raw_value(stream_act_msg->default_cs,
+               value_cycles);
+       stream_act_msg->default_cs_state =
+               BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_KNOWN;
+       BT_LIB_LOGV("Set stream activity message's default clock snapshot: "
+               "%![msg-]+n, value=%" PRIu64, msg, value_cycles);
+}
+
+void bt_message_stream_activity_beginning_set_default_clock_snapshot(
+               struct bt_message *msg, uint64_t raw_value)
+{
+       BT_ASSERT_PRE_NON_NULL(msg, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(msg,
+               BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING);
+       set_stream_activity_message_default_clock_snapshot(msg, raw_value);
+}
+
+void bt_message_stream_activity_end_set_default_clock_snapshot(
+               struct bt_message *msg, uint64_t raw_value)
+{
+       BT_ASSERT_PRE_NON_NULL(msg, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(msg,
+               BT_MESSAGE_TYPE_STREAM_ACTIVITY_END);
+       set_stream_activity_message_default_clock_snapshot(msg, raw_value);
+}
+
+static inline
+enum bt_message_stream_activity_clock_snapshot_state
+borrow_stream_activity_message_default_clock_snapshot_const(
+               const bt_message *msg, const bt_clock_snapshot **snapshot)
+{
+       const struct bt_message_stream_activity *stream_act_msg =
+               (const void *) msg;
+
+       BT_ASSERT_PRE_NON_NULL(snapshot, "Clock snapshot (output)");
+       *snapshot = stream_act_msg->default_cs;
+       return stream_act_msg->default_cs_state;
+}
+
+enum bt_message_stream_activity_clock_snapshot_state
+bt_message_stream_activity_beginning_borrow_default_clock_snapshot_const(
+               const bt_message *msg, const bt_clock_snapshot **snapshot)
+{
+       BT_ASSERT_PRE_NON_NULL(msg, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(msg,
+               BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING);
+       return borrow_stream_activity_message_default_clock_snapshot_const(msg,
+               snapshot);
+}
+
+enum bt_message_stream_activity_clock_snapshot_state
+bt_message_stream_activity_end_borrow_default_clock_snapshot_const(
+               const bt_message *msg, const bt_clock_snapshot **snapshot)
+{
+       BT_ASSERT_PRE_NON_NULL(msg, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_STREAM_ACTIVITY_END);
+       return borrow_stream_activity_message_default_clock_snapshot_const(msg,
+               snapshot);
+}
+
+static inline
+void set_stream_activity_message_default_clock_snapshot_state(
+               struct bt_message *msg,
+               enum bt_message_stream_activity_clock_snapshot_state state)
+{
+       struct bt_message_stream_activity *stream_act_msg = (void *) msg;
+
+       BT_ASSERT(msg);
+       BT_ASSERT_PRE_HOT(msg, "Message", ": %!+n", msg);
+       BT_ASSERT_PRE(state != BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_KNOWN,
+               "Invalid clock snapshot state: %![msg-]+n, state=%s",
+               msg,
+               bt_message_stream_activity_clock_snapshot_state_string(state));
+       stream_act_msg->default_cs_state = state;
+       BT_LIB_LOGV("Set stream activity message's default clock snapshot state: "
+               "%![msg-]+n, state=%s", msg,
+               bt_message_stream_activity_clock_snapshot_state_string(state));
+}
+
+void bt_message_stream_activity_beginning_set_default_clock_snapshot_state(
+               struct bt_message *msg,
+               enum bt_message_stream_activity_clock_snapshot_state state)
+{
+       BT_ASSERT_PRE_NON_NULL(msg, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(msg,
+               BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING);
+       set_stream_activity_message_default_clock_snapshot_state(msg, state);
+}
+
+void bt_message_stream_activity_end_set_default_clock_snapshot_state(
+               struct bt_message *msg,
+               enum bt_message_stream_activity_clock_snapshot_state state)
+{
+       BT_ASSERT_PRE_NON_NULL(msg, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(msg,
+               BT_MESSAGE_TYPE_STREAM_ACTIVITY_END);
+       set_stream_activity_message_default_clock_snapshot_state(msg, state);
+}
index 0d6f374c2ab88cec6ed8afda6610c14a3a07b5f0..212e6482f805e016111bf597c5cf21551e742214 100644 (file)
 #include <babeltrace/trace-ir/stream-internal.h>
 #include <babeltrace/trace-ir/stream-class.h>
 #include <babeltrace/trace-ir/stream-class-internal.h>
-#include <babeltrace/graph/message-stream.h>
-#include <babeltrace/graph/message-stream-const.h>
+#include <babeltrace/graph/message-stream-beginning.h>
+#include <babeltrace/graph/message-stream-end.h>
+#include <babeltrace/graph/message-stream-beginning-const.h>
+#include <babeltrace/graph/message-stream-end-const.h>
 #include <babeltrace/graph/message-stream-internal.h>
 #include <babeltrace/assert-internal.h>
 #include <inttypes.h>
 
 static
-void bt_message_stream_end_destroy(struct bt_object *obj)
+void destroy_stream_message(struct bt_object *obj)
 {
-       struct bt_message_stream_end *message =
-                       (struct bt_message_stream_end *) obj;
+       struct bt_message_stream *message = (void *) obj;
 
-       BT_LIB_LOGD("Destroying stream end message: %!+n",
-               message);
+       BT_LIB_LOGD("Destroying stream message: %!+n", message);
        BT_LIB_LOGD("Putting stream: %!+s", message->stream);
        BT_OBJECT_PUT_REF_AND_RESET(message->stream);
        g_free(message);
 }
 
-struct bt_message *bt_message_stream_end_create(
+static inline
+struct bt_message *create_stream_message(
                struct bt_self_message_iterator *self_msg_iter,
-               struct bt_stream *stream)
+               struct bt_stream *stream, enum bt_message_type type)
 {
-       struct bt_message_stream_end *message;
+       struct bt_message_stream *message;
        struct bt_stream_class *stream_class;
 
        BT_ASSERT_PRE_NON_NULL(self_msg_iter, "Message iterator");
        BT_ASSERT_PRE_NON_NULL(stream, "Stream");
        stream_class = bt_stream_borrow_class(stream);
        BT_ASSERT(stream_class);
-       BT_LIB_LOGD("Creating stream end message object: "
-               "%![stream-]+s, %![sc-]+S", stream, stream_class);
-       message = g_new0(struct bt_message_stream_end, 1);
+       BT_LIB_LOGD("Creating stream message object: "
+               "type=%s, %![stream-]+s, %![sc-]+S",
+               bt_message_type_string(type), stream, stream_class);
+       message = g_new0(struct bt_message_stream, 1);
        if (!message) {
-               BT_LOGE_STR("Failed to allocate one stream end message.");
+               BT_LOGE_STR("Failed to allocate one stream message.");
                goto error;
        }
 
-       bt_message_init(&message->parent,
-                       BT_MESSAGE_TYPE_STREAM_END,
-                       bt_message_stream_end_destroy, NULL);
+       bt_message_init(&message->parent, type,
+               destroy_stream_message, NULL);
        message->stream = stream;
        bt_object_get_no_null_check(message->stream);
-       BT_LIB_LOGD("Created stream end message object: "
+       BT_LIB_LOGD("Created stream message object: "
                "%![msg-]+n, %![stream-]+s, %![sc-]+S", message,
                stream, stream_class);
 
        return (void *) &message->parent;
+
 error:
        return NULL;
 }
 
-struct bt_stream *bt_message_stream_end_borrow_stream(
-               struct bt_message *message)
+struct bt_message *bt_message_stream_beginning_create(
+               struct bt_self_message_iterator *self_msg_iter,
+               struct bt_stream *stream)
 {
-       struct bt_message_stream_end *stream_end;
-
-       BT_ASSERT_PRE_NON_NULL(message, "Message");
-       BT_ASSERT_PRE_MSG_IS_TYPE(message,
-               BT_MESSAGE_TYPE_STREAM_END);
-       stream_end = (void *) message;
-       return stream_end->stream;
+       return create_stream_message(self_msg_iter, stream,
+               BT_MESSAGE_TYPE_STREAM_BEGINNING);
 }
 
-const struct bt_stream *bt_message_stream_end_borrow_stream_const(
-               const struct bt_message *message)
+struct bt_message *bt_message_stream_end_create(
+               struct bt_self_message_iterator *self_msg_iter,
+               struct bt_stream *stream)
 {
-       return bt_message_stream_end_borrow_stream(
-               (void *) message);
+       return create_stream_message(self_msg_iter, stream,
+               BT_MESSAGE_TYPE_STREAM_END);
 }
 
-static
-void bt_message_stream_beginning_destroy(struct bt_object *obj)
+static inline
+struct bt_stream *borrow_stream_message_stream(struct bt_message *message)
 {
-       struct bt_message_stream_beginning *message =
-                       (struct bt_message_stream_beginning *) obj;
+       struct bt_message_stream *stream_msg;
 
-       BT_LIB_LOGD("Destroying stream beginning message: %!+n",
-               message);
-       BT_LIB_LOGD("Putting stream: %!+s", message->stream);
-       BT_OBJECT_PUT_REF_AND_RESET(message->stream);
-       g_free(message);
+       BT_ASSERT(message);
+       stream_msg = (void *) message;
+       return stream_msg->stream;
 }
 
-struct bt_message *bt_message_stream_beginning_create(
-               struct bt_self_message_iterator *self_msg_iter,
-               struct bt_stream *stream)
+struct bt_stream *bt_message_stream_beginning_borrow_stream(
+               struct bt_message *message)
 {
-       struct bt_message_stream_beginning *message;
-       struct bt_stream_class *stream_class;
-
-       BT_ASSERT_PRE_NON_NULL(self_msg_iter, "Message iterator");
-       BT_ASSERT_PRE_NON_NULL(stream, "Stream");
-       stream_class = bt_stream_borrow_class(stream);
-       BT_ASSERT(stream_class);
-       BT_LIB_LOGD("Creating stream beginning message object: "
-               "%![stream-]+s, %![sc-]+S", stream, stream_class);
-       message = g_new0(struct bt_message_stream_beginning, 1);
-       if (!message) {
-               BT_LOGE_STR("Failed to allocate one stream beginning message.");
-               goto error;
-       }
-
-       bt_message_init(&message->parent,
-                       BT_MESSAGE_TYPE_STREAM_BEGINNING,
-                       bt_message_stream_beginning_destroy, NULL);
-       message->stream = stream;
-       bt_object_get_no_null_check(message->stream);
-       BT_LIB_LOGD("Created stream beginning message object: "
-               "%![msg-]+n, %![stream-]+s, %![sc-]+S", message,
-               stream, stream_class);
-       return (void *) &message->parent;
-error:
-       return NULL;
+       BT_ASSERT_PRE_NON_NULL(message, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(message, BT_MESSAGE_TYPE_STREAM_BEGINNING);
+       return borrow_stream_message_stream(message);
 }
 
-struct bt_stream *bt_message_stream_beginning_borrow_stream(
+struct bt_stream *bt_message_stream_end_borrow_stream(
                struct bt_message *message)
 {
-       struct bt_message_stream_beginning *stream_begin;
-
        BT_ASSERT_PRE_NON_NULL(message, "Message");
-       BT_ASSERT_PRE_MSG_IS_TYPE(message,
-               BT_MESSAGE_TYPE_STREAM_BEGINNING);
-       stream_begin = (void *) message;
-       return stream_begin->stream;
+       BT_ASSERT_PRE_MSG_IS_TYPE(message, BT_MESSAGE_TYPE_STREAM_END);
+       return borrow_stream_message_stream(message);
 }
 
 const struct bt_stream *bt_message_stream_beginning_borrow_stream_const(
@@ -164,3 +132,10 @@ const struct bt_stream *bt_message_stream_beginning_borrow_stream_const(
        return bt_message_stream_beginning_borrow_stream(
                (void *) message);
 }
+
+const struct bt_stream *bt_message_stream_end_borrow_stream_const(
+               const struct bt_message *message)
+{
+       return bt_message_stream_end_borrow_stream(
+               (void *) message);
+}
index 017f2540bc1c9cdae7b96d7d5b0ac7596afe0710..096428e1de4d268bbc261c0402e8261d55660348 100644 (file)
@@ -67,6 +67,7 @@
 #include <babeltrace/graph/message-iterator-internal.h>
 #include <babeltrace/graph/message-packet-internal.h>
 #include <babeltrace/graph/message-stream-internal.h>
+#include <babeltrace/graph/message-stream-activity-internal.h>
 #include <babeltrace/graph/port-internal.h>
 #include <babeltrace/plugin/plugin-internal.h>
 #include <babeltrace/plugin/plugin-so-internal.h>
@@ -908,55 +909,58 @@ static inline void format_message(char **buf_ch, bool extended,
 
                if (msg_event->event) {
                        SET_TMP_PREFIX("event-");
-                       format_event(buf_ch, true, tmp_prefix, msg_event->event);
+                       format_event(buf_ch, true, tmp_prefix,
+                               msg_event->event);
                }
 
                break;
        }
        case BT_MESSAGE_TYPE_STREAM_BEGINNING:
+       case BT_MESSAGE_TYPE_STREAM_END:
        {
-               const struct bt_message_stream_beginning *msg_stream =
-                       (const void *) msg;
+               const struct bt_message_stream *msg_stream = (const void *) msg;
 
                if (msg_stream->stream) {
                        SET_TMP_PREFIX("stream-");
-                       format_stream(buf_ch, true, tmp_prefix, msg_stream->stream);
+                       format_stream(buf_ch, true, tmp_prefix,
+                               msg_stream->stream);
                }
 
                break;
        }
-       case BT_MESSAGE_TYPE_STREAM_END:
+       case BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING:
+       case BT_MESSAGE_TYPE_STREAM_ACTIVITY_END:
        {
-               const struct bt_message_stream_end *msg_stream =
+               const struct bt_message_stream_activity *msg_stream_activity =
                        (const void *) msg;
 
-               if (msg_stream->stream) {
+               if (msg_stream_activity->stream) {
                        SET_TMP_PREFIX("stream-");
-                       format_stream(buf_ch, true, tmp_prefix, msg_stream->stream);
+                       format_stream(buf_ch, true, tmp_prefix,
+                               msg_stream_activity->stream);
                }
 
-               break;
-       }
-       case BT_MESSAGE_TYPE_PACKET_BEGINNING:
-       {
-               const struct bt_message_packet_beginning *msg_packet =
-                       (const void *) msg;
+               BUF_APPEND(", %sdefault-cs-state=%s",
+                       PRFIELD(bt_message_stream_activity_clock_snapshot_state_string(
+                               msg_stream_activity->default_cs_state)));
 
-               if (msg_packet->packet) {
-                       SET_TMP_PREFIX("packet-");
-                       format_packet(buf_ch, true, tmp_prefix, msg_packet->packet);
+               if (msg_stream_activity->default_cs) {
+                       SET_TMP_PREFIX("default-cs-");
+                       format_clock_snapshot(buf_ch, true, tmp_prefix,
+                               msg_stream_activity->default_cs);
                }
 
                break;
        }
+       case BT_MESSAGE_TYPE_PACKET_BEGINNING:
        case BT_MESSAGE_TYPE_PACKET_END:
        {
-               const struct bt_message_packet_end *msg_packet =
-                       (const void *) msg;
+               const struct bt_message_packet *msg_packet = (const void *) msg;
 
                if (msg_packet->packet) {
                        SET_TMP_PREFIX("packet-");
-                       format_packet(buf_ch, true, tmp_prefix, msg_packet->packet);
+                       format_packet(buf_ch, true, tmp_prefix,
+                               msg_packet->packet);
                }
 
                break;
This page took 0.051675 seconds and 4 git commands to generate.