#define BT_LOG_TAG "PLUGIN-CTF-FS-SINK-TRANSLATE-CTF-IR-TO-TSDL"
#include "logging.h"
-#include <babeltrace/babeltrace.h>
-#include <babeltrace/babeltrace-internal.h>
+#include <babeltrace2/babeltrace.h>
+#include <babeltrace2/babeltrace-internal.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <glib.h>
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/endian-internal.h>
+#include <babeltrace2/assert-internal.h>
+#include <babeltrace2/endian-internal.h>
#include "fs-sink-ctf-meta.h"
BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL,
NULL, "content_size", true);
- if (sc->default_clock_class) {
+ if (sc->packets_have_ts_begin) {
append_indent(ctx);
append_integer_field_class_from_props(ctx, 64, 8, false,
BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL,
sc->default_clock_class_name->str,
"timestamp_begin", true);
+ }
+
+ if (sc->packets_have_ts_end) {
append_indent(ctx);
append_integer_field_class_from_props(ctx, 64, 8, false,
BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL,
"timestamp_end", true);
}
- append_indent(ctx);
- append_integer_field_class_from_props(ctx, 64, 8, false,
- BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL,
- NULL, "events_discarded", true);
+ if (sc->has_discarded_events) {
+ append_indent(ctx);
+ append_integer_field_class_from_props(ctx, 64, 8, false,
+ BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL,
+ NULL, "events_discarded", true);
+ }
+
+ /*
+ * Unconditionnally write the packet sequence number as, even if
+ * there's no possible discarded packets message, it's still
+ * useful information to have.
+ */
append_indent(ctx);
append_integer_field_class_from_props(ctx, 64, 8, false,
BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL,
g_string_append_printf(tsdl, "%s = ", name);
switch (bt_value_get_type(val)) {
- case BT_VALUE_TYPE_INTEGER:
+ case BT_VALUE_TYPE_SIGNED_INTEGER:
g_string_append_printf(tsdl, "%" PRId64,
- bt_value_integer_get(val));
+ bt_value_signed_integer_get(val));
break;
case BT_VALUE_TYPE_STRING:
append_quoted_string(&ctx, bt_value_string_get(val));