From: Francis Deslauriers Date: Tue, 19 Feb 2019 21:12:16 +0000 (-0500) Subject: lib: rename inactivity msg to msg iterator inactivity msg X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=b9fd9cbba60297c02bea7473d4347c588d9724d7 lib: rename inactivity msg to msg iterator inactivity msg This is avoid confusion with stream activity message types. Signed-off-by: Francis Deslauriers --- diff --git a/include/Makefile.am b/include/Makefile.am index 172188f1..9e203037 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -174,8 +174,8 @@ babeltracegraphinclude_HEADERS = \ babeltrace/graph/message-discarded-packets.h \ babeltrace/graph/message-event-const.h \ babeltrace/graph/message-event.h \ - babeltrace/graph/message-inactivity-const.h \ - babeltrace/graph/message-inactivity.h \ + babeltrace/graph/message-message-iterator-inactivity-const.h \ + babeltrace/graph/message-message-iterator-inactivity.h \ babeltrace/graph/message-iterator-const.h \ babeltrace/graph/message-packet-beginning-const.h \ babeltrace/graph/message-packet-beginning.h \ @@ -286,7 +286,7 @@ noinst_HEADERS = \ babeltrace/graph/graph-internal.h \ babeltrace/graph/message-discarded-items-internal.h \ babeltrace/graph/message-event-internal.h \ - babeltrace/graph/message-inactivity-internal.h \ + babeltrace/graph/message-message-iterator-inactivity-internal.h \ babeltrace/graph/message-internal.h \ babeltrace/graph/message-iterator-internal.h \ babeltrace/graph/message-packet-internal.h \ diff --git a/include/babeltrace/babeltrace.h b/include/babeltrace/babeltrace.h index 5e1e36ec..903329b9 100644 --- a/include/babeltrace/babeltrace.h +++ b/include/babeltrace/babeltrace.h @@ -116,9 +116,9 @@ #include #include #include -#include -#include #include +#include +#include #include #include #include diff --git a/include/babeltrace/graph/message-const.h b/include/babeltrace/graph/message-const.h index 414124bb..564fdf53 100644 --- a/include/babeltrace/graph/message-const.h +++ b/include/babeltrace/graph/message-const.h @@ -36,7 +36,7 @@ extern "C" { */ typedef enum bt_message_type { BT_MESSAGE_TYPE_EVENT = 0, - BT_MESSAGE_TYPE_INACTIVITY = 1, + BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY = 1, BT_MESSAGE_TYPE_STREAM_BEGINNING = 2, BT_MESSAGE_TYPE_STREAM_END = 3, BT_MESSAGE_TYPE_PACKET_BEGINNING = 4, diff --git a/include/babeltrace/graph/message-inactivity-const.h b/include/babeltrace/graph/message-inactivity-const.h deleted file mode 100644 index b473b849..00000000 --- a/include/babeltrace/graph/message-inactivity-const.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef BABELTRACE_GRAPH_MESSAGE_INACTIVITY_CONST_H -#define BABELTRACE_GRAPH_MESSAGE_INACTIVITY_CONST_H - -/* - * Copyright 2017-2018 Philippe Proulx - * - * 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 */ -#include - -/* For bt_clock_snapshot_state */ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -extern bt_clock_snapshot_state -bt_message_inactivity_borrow_default_clock_snapshot_const( - const bt_message *msg, const bt_clock_snapshot **snapshot); - -#ifdef __cplusplus -} -#endif - -#endif /* BABELTRACE_GRAPH_MESSAGE_INACTIVITY_CONST_H */ diff --git a/include/babeltrace/graph/message-inactivity-internal.h b/include/babeltrace/graph/message-inactivity-internal.h deleted file mode 100644 index 5ac0f55e..00000000 --- a/include/babeltrace/graph/message-inactivity-internal.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef BABELTRACE_GRAPH_MESSAGE_INACTIVITY_INTERNAL_H -#define BABELTRACE_GRAPH_MESSAGE_INACTIVITY_INTERNAL_H - -/* - * Copyright 2017-2018 Philippe Proulx - * - * 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 -#include -#include - -struct bt_message_inactivity { - struct bt_message parent; - struct bt_clock_snapshot *default_cs; -}; - -#endif /* BABELTRACE_GRAPH_MESSAGE_INACTIVITY_INTERNAL_H */ diff --git a/include/babeltrace/graph/message-inactivity.h b/include/babeltrace/graph/message-inactivity.h deleted file mode 100644 index e7d1c404..00000000 --- a/include/babeltrace/graph/message-inactivity.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef BABELTRACE_GRAPH_MESSAGE_INACTIVITY_H -#define BABELTRACE_GRAPH_MESSAGE_INACTIVITY_H - -/* - * Copyright 2017-2018 Philippe Proulx - * - * 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 - -/* For bt_self_message_iterator, bt_message, bt_clock_class */ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -extern -bt_message *bt_message_inactivity_create( - bt_self_message_iterator *message_iterator, - const bt_clock_class *default_clock_class, uint64_t raw_value); - -#ifdef __cplusplus -} -#endif - -#endif /* BABELTRACE_GRAPH_MESSAGE_INACTIVITY_H */ diff --git a/include/babeltrace/graph/message-internal.h b/include/babeltrace/graph/message-internal.h index af687238..bfe561e5 100644 --- a/include/babeltrace/graph/message-internal.h +++ b/include/babeltrace/graph/message-internal.h @@ -114,8 +114,8 @@ const char *bt_message_type_string(enum bt_message_type type) switch (type) { case BT_MESSAGE_TYPE_EVENT: return "BT_MESSAGE_TYPE_EVENT"; - case BT_MESSAGE_TYPE_INACTIVITY: - return "BT_MESSAGE_TYPE_INACTIVITY"; + case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY: + return "BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY"; case BT_MESSAGE_TYPE_STREAM_BEGINNING: return "BT_MESSAGE_TYPE_STREAM_BEGINNING"; case BT_MESSAGE_TYPE_STREAM_END: diff --git a/include/babeltrace/graph/message-message-iterator-inactivity-const.h b/include/babeltrace/graph/message-message-iterator-inactivity-const.h new file mode 100644 index 00000000..02f5b008 --- /dev/null +++ b/include/babeltrace/graph/message-message-iterator-inactivity-const.h @@ -0,0 +1,44 @@ +#ifndef BABELTRACE_GRAPH_MESSAGE_MESSAGE_ITERATOR_INACTIVITY_CONST_H +#define BABELTRACE_GRAPH_MESSAGE_MESSAGE_ITERATOR_INACTIVITY_CONST_H + +/* + * Copyright 2017-2018 Philippe Proulx + * + * 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 */ +#include + +/* For bt_clock_snapshot_state */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern bt_clock_snapshot_state +bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const( + const bt_message *msg, const bt_clock_snapshot **snapshot); + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_GRAPH_MESSAGE_MESSAGE_ITERATOR_INACTIVITY_CONST_H */ diff --git a/include/babeltrace/graph/message-message-iterator-inactivity-internal.h b/include/babeltrace/graph/message-message-iterator-inactivity-internal.h new file mode 100644 index 00000000..cd41177a --- /dev/null +++ b/include/babeltrace/graph/message-message-iterator-inactivity-internal.h @@ -0,0 +1,35 @@ +#ifndef BABELTRACE_GRAPH_MESSAGE_MESSAGE_ITERATOR_INACTIVITY_INTERNAL_H +#define BABELTRACE_GRAPH_MESSAGE_MESSAGE_ITERATOR_INACTIVITY_INTERNAL_H + +/* + * Copyright 2017-2018 Philippe Proulx + * + * 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 +#include +#include + +struct bt_message_message_iterator_inactivity { + struct bt_message parent; + struct bt_clock_snapshot *default_cs; +}; + +#endif /* BABELTRACE_GRAPH_MESSAGE_MESSAGE_ITERATOR_INACTIVITY_INTERNAL_H */ diff --git a/include/babeltrace/graph/message-message-iterator-inactivity.h b/include/babeltrace/graph/message-message-iterator-inactivity.h new file mode 100644 index 00000000..8b8f83a1 --- /dev/null +++ b/include/babeltrace/graph/message-message-iterator-inactivity.h @@ -0,0 +1,44 @@ +#ifndef BABELTRACE_GRAPH_MESSAGE_MESSAGE_ITERATOR_INACTIVITY_H +#define BABELTRACE_GRAPH_MESSAGE_MESSAGE_ITERATOR_INACTIVITY_H + +/* + * Copyright 2017-2018 Philippe Proulx + * + * 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 + +/* For bt_self_message_iterator, bt_message, bt_clock_class */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern +bt_message *bt_message_message_iterator_inactivity_create( + bt_self_message_iterator *message_iterator, + const bt_clock_class *default_clock_class, uint64_t raw_value); + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_GRAPH_MESSAGE_MESSAGE_ITERATOR_INACTIVITY_H */ diff --git a/lib/graph/iterator.c b/lib/graph/iterator.c index c97ec94d..a7c9ea17 100644 --- a/lib/graph/iterator.c +++ b/lib/graph/iterator.c @@ -54,7 +54,7 @@ #include #include #include -#include +#include #include #include #include @@ -1003,9 +1003,9 @@ int get_message_ns_from_origin(const struct bt_message *msg, event_msg); break; } - case BT_MESSAGE_TYPE_INACTIVITY: + case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY: { - const struct bt_message_inactivity *inactivity_msg = + const struct bt_message_message_iterator_inactivity *inactivity_msg = (const void *) msg; clk_snapshot = inactivity_msg->default_cs; @@ -1174,7 +1174,7 @@ enum bt_message_iterator_status find_message_ge_ns_from_origin( * Find first message which has a default clock snapshot * that is greater than or equal to the requested value. * - * For event and inactivity messages, compare with the + * For event and message iterator inactivity messages, compare with the * default clock snapshot. * * For packet beginning messages, compare with the diff --git a/lib/graph/message/Makefile.am b/lib/graph/message/Makefile.am index 9e2039b4..9c69099f 100644 --- a/lib/graph/message/Makefile.am +++ b/lib/graph/message/Makefile.am @@ -5,6 +5,6 @@ libgraph_message_la_SOURCES = \ packet.c \ event.c \ stream.c \ - inactivity.c \ + message-iterator-inactivity.c \ stream-activity.c \ discarded-items.c diff --git a/lib/graph/message/inactivity.c b/lib/graph/message/inactivity.c deleted file mode 100644 index 9cee20e6..00000000 --- a/lib/graph/message/inactivity.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2017-2018 Philippe Proulx - * - * 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-INACTIVITY" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static -void bt_message_inactivity_destroy(struct bt_object *obj) -{ - struct bt_message_inactivity *message = - (struct bt_message_inactivity *) obj; - - BT_LIB_LOGD("Destroying inactivity message: %!+n", message); - - if (message->default_cs) { - bt_clock_snapshot_recycle(message->default_cs); - message->default_cs = NULL; - } - - g_free(message); -} - -struct bt_message *bt_message_inactivity_create( - struct bt_self_message_iterator *self_msg_iter, - const struct bt_clock_class *default_clock_class, - uint64_t value_cycles) -{ - struct bt_self_component_port_input_message_iterator *msg_iter = - (void *) self_msg_iter; - struct bt_message_inactivity *message; - struct bt_message *ret_msg = NULL; - - BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator"); - BT_ASSERT_PRE_NON_NULL(default_clock_class, "Default clock class"); - BT_LIB_LOGD("Creating inactivity message object: " - "%![iter-]+i, %![default-cc-]+K, value=%" PRIu64, msg_iter, - default_clock_class, value_cycles); - message = g_new0(struct bt_message_inactivity, 1); - if (!message) { - BT_LOGE_STR("Failed to allocate one inactivity message."); - goto error; - } - bt_message_init(&message->parent, - BT_MESSAGE_TYPE_INACTIVITY, - bt_message_inactivity_destroy, NULL); - ret_msg = &message->parent; - message->default_cs = bt_clock_snapshot_create( - (void *) default_clock_class); - if (!message->default_cs) { - goto error; - } - bt_clock_snapshot_set_raw_value(message->default_cs, value_cycles); - - BT_LIB_LOGD("Created inactivity message object: %!+n", ret_msg); - goto end; - -error: - BT_OBJECT_PUT_REF_AND_RESET(ret_msg); - -end: - return (void *) ret_msg; -} - -extern enum bt_clock_snapshot_state -bt_message_inactivity_borrow_default_clock_snapshot_const( - const bt_message *msg, const bt_clock_snapshot **snapshot) -{ - struct bt_message_inactivity *inactivity = (void *) msg; - - BT_ASSERT_PRE_NON_NULL(msg, "Message"); - BT_ASSERT_PRE_NON_NULL(snapshot, "Clock snapshot (output)"); - BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_INACTIVITY); - *snapshot = inactivity->default_cs; - return BT_CLOCK_SNAPSHOT_STATE_KNOWN; -} diff --git a/lib/graph/message/message-iterator-inactivity.c b/lib/graph/message/message-iterator-inactivity.c new file mode 100644 index 00000000..26b863f4 --- /dev/null +++ b/lib/graph/message/message-iterator-inactivity.c @@ -0,0 +1,107 @@ +/* + * Copyright 2017-2018 Philippe Proulx + * + * 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-MESSAGE-ITERATOR-INACTIVITY" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static +void bt_message_message_iterator_inactivity_destroy(struct bt_object *obj) +{ + struct bt_message_message_iterator_inactivity *message = + (struct bt_message_message_iterator_inactivity *) obj; + + BT_LIB_LOGD("Destroying message iterator inactivity message: %!+n", + message); + + if (message->default_cs) { + bt_clock_snapshot_recycle(message->default_cs); + message->default_cs = NULL; + } + + g_free(message); +} + +struct bt_message *bt_message_message_iterator_inactivity_create( + struct bt_self_message_iterator *self_msg_iter, + const struct bt_clock_class *default_clock_class, + uint64_t value_cycles) +{ + struct bt_self_component_port_input_message_iterator *msg_iter = + (void *) self_msg_iter; + struct bt_message_message_iterator_inactivity *message; + struct bt_message *ret_msg = NULL; + + BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator"); + BT_ASSERT_PRE_NON_NULL(default_clock_class, "Default clock class"); + BT_LIB_LOGD("Creating message iterator inactivity message object: " + "%![iter-]+i, %![default-cc-]+K, value=%" PRIu64, msg_iter, + default_clock_class, value_cycles); + message = g_new0(struct bt_message_message_iterator_inactivity, 1); + if (!message) { + BT_LOGE_STR("Failed to allocate one message iterator " + "inactivity message."); + goto error; + } + bt_message_init(&message->parent, + BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY, + bt_message_message_iterator_inactivity_destroy, NULL); + ret_msg = &message->parent; + message->default_cs = bt_clock_snapshot_create( + (void *) default_clock_class); + if (!message->default_cs) { + goto error; + } + bt_clock_snapshot_set_raw_value(message->default_cs, value_cycles); + + BT_LIB_LOGD("Created message iterator inactivity message object: %!+n", + ret_msg); + goto end; + +error: + BT_OBJECT_PUT_REF_AND_RESET(ret_msg); + +end: + return (void *) ret_msg; +} + +extern enum bt_clock_snapshot_state +bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const( + const bt_message *msg, const bt_clock_snapshot **snapshot) +{ + struct bt_message_message_iterator_inactivity *inactivity = (void *) msg; + + BT_ASSERT_PRE_NON_NULL(msg, "Message"); + BT_ASSERT_PRE_NON_NULL(snapshot, "Clock snapshot (output)"); + BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY); + *snapshot = inactivity->default_cs; + return BT_CLOCK_SNAPSHOT_STATE_KNOWN; +} diff --git a/lib/lib-logging.c b/lib/lib-logging.c index 3fd96dd1..4b5557aa 100644 --- a/lib/lib-logging.c +++ b/lib/lib-logging.c @@ -62,7 +62,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/plugins/text/pretty/pretty.c b/plugins/text/pretty/pretty.c index 1b5729ab..63a6c879 100644 --- a/plugins/text/pretty/pretty.c +++ b/plugins/text/pretty/pretty.c @@ -138,8 +138,8 @@ bt_self_component_status handle_message( ret = BT_SELF_COMPONENT_STATUS_ERROR; } break; - case BT_MESSAGE_TYPE_INACTIVITY: - fprintf(stderr, "Inactivity message\n"); + case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY: + fprintf(stderr, "Message iterator inactivity message\n"); break; case BT_MESSAGE_TYPE_DISCARDED_EVENTS: case BT_MESSAGE_TYPE_DISCARDED_PACKETS: diff --git a/plugins/utils/counter/counter.c b/plugins/utils/counter/counter.c index ec0a8dba..dab2d6bc 100644 --- a/plugins/utils/counter/counter.c +++ b/plugins/utils/counter/counter.c @@ -50,7 +50,7 @@ uint64_t get_total_count(struct counter *counter) counter->count.stream_end + counter->count.packet_begin + counter->count.packet_end + - counter->count.inactivity + + counter->count.msg_iter_inactivity + counter->count.other; } @@ -64,7 +64,8 @@ void print_count(struct counter *counter) PRINTF_COUNT("stream end", "stream ends", stream_end); PRINTF_COUNT("packet beginning", "packet beginnings", packet_begin); PRINTF_COUNT("packet end", "packet ends", packet_end); - PRINTF_COUNT("inactivity", "inactivities", inactivity); + PRINTF_COUNT("message iterator inactivity", + "message iterator inactivities", msg_iter_inactivity); if (counter->count.other > 0) { PRINTF_COUNT(" other (unknown) message", @@ -245,8 +246,8 @@ bt_self_component_status counter_consume( case BT_MESSAGE_TYPE_EVENT: counter->count.event++; break; - case BT_MESSAGE_TYPE_INACTIVITY: - counter->count.inactivity++; + case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY: + counter->count.msg_iter_inactivity++; break; case BT_MESSAGE_TYPE_STREAM_BEGINNING: counter->count.stream_begin++; diff --git a/plugins/utils/counter/counter.h b/plugins/utils/counter/counter.h index e4cbdde7..2994eb47 100644 --- a/plugins/utils/counter/counter.h +++ b/plugins/utils/counter/counter.h @@ -36,7 +36,7 @@ struct counter { uint64_t stream_end; uint64_t packet_begin; uint64_t packet_end; - uint64_t inactivity; + uint64_t msg_iter_inactivity; uint64_t other; } count; uint64_t last_printed_total; diff --git a/plugins/utils/muxer/muxer.c b/plugins/utils/muxer/muxer.c index aa5cbb23..05c844b0 100644 --- a/plugins/utils/muxer/muxer.c +++ b/plugins/utils/muxer/muxer.c @@ -577,9 +577,9 @@ int get_msg_ts_ns(struct muxer_comp *muxer_comp, } break; - case BT_MESSAGE_TYPE_INACTIVITY: + case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY: cs_state = - bt_message_inactivity_borrow_default_clock_snapshot_const( + bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const( msg, &clock_snapshot); break; default: