X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=plugins%2Ftext%2Fdmesg%2Fdmesg.c;h=b10c94252201c2a040bb22e932ce2475411fd5d9;hb=3fadfbc0c91f82c46bd36e6e0657ea93570c9db1;hp=90d1d634b3b3330ec7fd9a357bce9ad6f676e171;hpb=21029722ce6f0eec583754c81d3da03a93f3dfa9;p=babeltrace.git diff --git a/plugins/text/dmesg/dmesg.c b/plugins/text/dmesg/dmesg.c index 90d1d634..b10c9425 100644 --- a/plugins/text/dmesg/dmesg.c +++ b/plugins/text/dmesg/dmesg.c @@ -28,12 +28,12 @@ #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #define NSEC_PER_USEC 1000UL @@ -141,17 +141,18 @@ int create_meta(struct dmesg_component *dmesg_comp, bool has_ts) if (has_ts) { dmesg_comp->clock_class = bt_clock_class_create( - dmesg_comp->trace_class); + bt_self_component_source_as_self_component( + dmesg_comp->self_comp)); if (!dmesg_comp->clock_class) { BT_LOGE_STR("Cannot create clock class."); goto error; } /* - * The `dmesg` timestamp is not absolute, it's relative - * to the boot time. + * The `dmesg` timestamp's origin is not the Unix epoch, + * it's the boot time. */ - bt_clock_class_set_is_absolute(dmesg_comp->clock_class, + bt_clock_class_set_origin_is_unix_epoch(dmesg_comp->clock_class, BT_FALSE); ret = bt_stream_class_set_default_clock_class( @@ -160,6 +161,11 @@ int create_meta(struct dmesg_component *dmesg_comp, bool has_ts) BT_LOGE_STR("Cannot set stream class's default clock class."); goto error; } + + bt_stream_class_set_packets_have_beginning_default_clock_snapshot( + dmesg_comp->stream_class, BT_TRUE); + bt_stream_class_set_packets_have_end_default_clock_snapshot( + dmesg_comp->stream_class, BT_TRUE); } dmesg_comp->event_class = bt_event_class_create( @@ -298,12 +304,6 @@ int create_packet_and_stream_and_trace(struct dmesg_component *dmesg_comp) goto error; } - ret = bt_trace_make_static(dmesg_comp->trace); - if (ret) { - BT_LOGE_STR("Cannot make trace static."); - goto error; - } - goto end; error: @@ -647,6 +647,8 @@ void destroy_dmesg_msg_iter(struct dmesg_msg_iter *dmesg_msg_iter) g_free(dmesg_msg_iter); } + + BT_HIDDEN bt_self_message_iterator_status dmesg_msg_iter_init( bt_self_message_iterator *self_msg_iter, @@ -897,3 +899,29 @@ bt_self_message_iterator_status dmesg_msg_iter_next( return status; } + +BT_HIDDEN +bt_bool dmesg_msg_iter_can_seek_beginning( + bt_self_message_iterator *self_msg_iter) +{ + struct dmesg_msg_iter *dmesg_msg_iter = + bt_self_message_iterator_get_data(self_msg_iter); + + /* Can't seek the beginning of the standard input stream */ + return !dmesg_msg_iter->dmesg_comp->params.read_from_stdin; +} + +BT_HIDDEN +bt_self_message_iterator_status dmesg_msg_iter_seek_beginning( + bt_self_message_iterator *self_msg_iter) +{ + struct dmesg_msg_iter *dmesg_msg_iter = + bt_self_message_iterator_get_data(self_msg_iter); + + BT_ASSERT(!dmesg_msg_iter->dmesg_comp->params.read_from_stdin); + + BT_MESSAGE_PUT_REF_AND_RESET(dmesg_msg_iter->tmp_event_msg); + dmesg_msg_iter->last_clock_value = 0; + dmesg_msg_iter->state = STATE_EMIT_STREAM_BEGINNING; + return BT_SELF_MESSAGE_ITERATOR_STATUS_OK; +}