babeltracetraceirinclude_HEADERS = \
babeltrace/trace-ir/clock-class-const.h \
babeltrace/trace-ir/clock-class.h \
- babeltrace/trace-ir/clock-value-const.h \
+ babeltrace/trace-ir/clock-snapshot-const.h \
babeltrace/trace-ir/event-class-const.h \
babeltrace/trace-ir/event-class.h \
babeltrace/trace-ir/event-const.h \
babeltrace/endian-internal.h \
babeltrace/trace-ir/attributes-internal.h \
babeltrace/trace-ir/clock-class-internal.h \
- babeltrace/trace-ir/clock-value-internal.h \
- babeltrace/trace-ir/clock-value-set-internal.h \
+ babeltrace/trace-ir/clock-snapshot-internal.h \
+ babeltrace/trace-ir/clock-snapshot-set-internal.h \
babeltrace/trace-ir/event-class-internal.h \
babeltrace/trace-ir/event-internal.h \
babeltrace/trace-ir/field-class-internal.h \
/* Trace IR API */
#include <babeltrace/trace-ir/clock-class-const.h>
#include <babeltrace/trace-ir/clock-class.h>
-#include <babeltrace/trace-ir/clock-value-const.h>
+#include <babeltrace/trace-ir/clock-snapshot-const.h>
#include <babeltrace/trace-ir/event-class-const.h>
#include <babeltrace/trace-ir/event-class.h>
#include <babeltrace/trace-ir/event-const.h>
* SOFTWARE.
*/
-/* For bt_message, bt_clock_value */
+/* For bt_message, bt_clock_snapshot */
#include <babeltrace/types.h>
#ifdef __cplusplus
extern "C" {
#endif
-extern const bt_clock_value *
-bt_message_inactivity_borrow_default_clock_value_const(
+extern const bt_clock_snapshot *
+bt_message_inactivity_borrow_default_clock_snapshot_const(
const bt_message *msg);
#ifdef __cplusplus
*/
#include <glib.h>
-#include <babeltrace/trace-ir/clock-value-internal.h>
+#include <babeltrace/trace-ir/clock-snapshot-internal.h>
#include <babeltrace/graph/message-const.h>
struct bt_message_inactivity {
struct bt_message parent;
- struct bt_clock_value *default_cv;
+ struct bt_clock_snapshot *default_cs;
};
#endif /* BABELTRACE_GRAPH_MESSAGE_INACTIVITY_INTERNAL_H */
bt_self_message_iterator *message_iterator,
bt_clock_class *default_clock_class);
-extern void bt_message_inactivity_set_default_clock_value(
+extern void bt_message_inactivity_set_default_clock_snapshot(
bt_message *msg, uint64_t raw_value);
#ifdef __cplusplus
* SOFTWARE.
*/
-/* For bt_message, bt_clock_value, bt_stream */
+/* For bt_message, bt_clock_snapshot, bt_stream */
#include <babeltrace/types.h>
#ifdef __cplusplus
extern const bt_stream *bt_message_stream_beginning_borrow_stream_const(
const bt_message *message);
-extern const bt_clock_value *
-bt_message_stream_beginning_borrow_default_clock_value_const(
+extern const bt_clock_snapshot *
+bt_message_stream_beginning_borrow_default_clock_snapshot_const(
const bt_message *msg);
extern const bt_stream *bt_message_stream_end_borrow_stream_const(
const bt_message *message);
-extern const bt_clock_value *
-bt_message_stream_end_borrow_default_clock_value_const(
+extern const bt_clock_snapshot *
+bt_message_stream_end_borrow_default_clock_snapshot_const(
const bt_message *msg);
#ifdef __cplusplus
#include <babeltrace/compiler-internal.h>
#include <babeltrace/trace-ir/packet.h>
#include <babeltrace/graph/message-internal.h>
-#include <babeltrace/trace-ir/clock-value-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_clock_value *default_cv;
+ struct bt_clock_snapshot *default_cs;
};
struct bt_message_stream_end {
struct bt_message parent;
struct bt_stream *stream;
- struct bt_clock_value *default_cv;
+ struct bt_clock_snapshot *default_cs;
};
#endif /* BABELTRACE_GRAPH_MESSAGE_STREAM_INTERNAL_H */
extern bt_stream *bt_message_stream_beginning_borrow_stream(
bt_message *message);
-extern void bt_message_stream_beginning_set_default_clock_value(
+extern void bt_message_stream_beginning_set_default_clock_snapshot(
bt_message *msg, uint64_t value_cycles);
extern bt_stream *bt_message_stream_end_borrow_stream(
bt_message *message);
-extern void bt_message_stream_end_set_default_clock_value(
+extern void bt_message_stream_end_set_default_clock_snapshot(
bt_message *msg, uint64_t value_cycles);
#ifdef __cplusplus
* Clock class. The parameter type is `struct bt_clock_class *`.
*
* `k`:
- * Clock value. The parameter type is `struct bt_clock_value *`.
+ * Clock snapshot. The parameter type is `struct bt_clock_snapshot *`.
*
* `v`:
* Value. The parameter type is `struct bt_value *`.
* base offset in nanoseconds including both `offset_seconds`
* and `offset_cycles` above in the result. It is used to
* accelerate future calls to
- * bt_clock_value_get_ns_from_origin() and
+ * bt_clock_snapshot_get_ns_from_origin() and
* bt_clock_class_cycles_to_ns_from_origin().
*
* `overflows` is true if the base offset cannot be computed
bool overflows;
} base_offset;
- /* Pool of `struct bt_clock_value *` */
- struct bt_object_pool cv_pool;
+ /* Pool of `struct bt_clock_snapshot *` */
+ struct bt_object_pool cs_pool;
bool frozen;
};
--- /dev/null
+#ifndef BABELTRACE_TRACE_IR_CLOCK_SNAPSHOT_CONST_H
+#define BABELTRACE_TRACE_IR_CLOCK_SNAPSHOT_CONST_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2013, 2014 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.
+ *
+ * The Common Trace Format (CTF) Specification is available at
+ * http://www.efficios.com/ctf
+ */
+
+#include <stdint.h>
+
+/* For bt_clock_class, bt_clock_snapshot */
+#include <babeltrace/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum bt_clock_snapshot_status {
+ BT_CLOCK_SNAPSHOT_STATUS_KNOWN,
+ BT_CLOCK_SNAPSHOT_STATUS_UNKNOWN,
+};
+
+extern const bt_clock_class *bt_clock_snapshot_borrow_clock_class_const(
+ const bt_clock_snapshot *clock_snapshot);
+
+extern uint64_t bt_clock_snapshot_get_value(
+ const bt_clock_snapshot *clock_snapshot);
+
+extern int bt_clock_snapshot_get_ns_from_origin(
+ const bt_clock_snapshot *clock_snapshot,
+ int64_t *ns_from_origin);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_TRACE_IR_CLOCK_SNAPSHOT_CONST_H */
--- /dev/null
+#ifndef BABELTRACE_TRACE_IR_CLOCK_SNAPSHOT_INTERNAL_H
+#define BABELTRACE_TRACE_IR_CLOCK_SNAPSHOT_INTERNAL_H
+
+/*
+ * Copyright 2017-2018 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 <babeltrace/babeltrace-internal.h>
+#include <babeltrace/object-internal.h>
+#include <babeltrace/trace-ir/clock-class-internal.h>
+#include <babeltrace/trace-ir/utils-internal.h>
+#include <stdbool.h>
+#include <stdint.h>
+
+struct bt_clock_class;
+
+struct bt_clock_snapshot {
+ struct bt_object base;
+ struct bt_clock_class *clock_class;
+ uint64_t value_cycles;
+ bool ns_from_origin_overflows;
+ int64_t ns_from_origin;
+ bool is_set;
+};
+
+static inline
+void bt_clock_snapshot_set(struct bt_clock_snapshot *clock_snapshot)
+{
+ BT_ASSERT(clock_snapshot);
+ clock_snapshot->is_set = true;
+}
+
+static inline
+void bt_clock_snapshot_reset(struct bt_clock_snapshot *clock_snapshot)
+{
+ BT_ASSERT(clock_snapshot);
+ clock_snapshot->is_set = false;
+}
+
+static inline
+void set_ns_from_origin(struct bt_clock_snapshot *clock_snapshot)
+{
+ if (bt_util_ns_from_origin(clock_snapshot->clock_class, clock_snapshot->value_cycles,
+ &clock_snapshot->ns_from_origin)) {
+ clock_snapshot->ns_from_origin_overflows = true;
+ }
+
+}
+
+static inline
+void bt_clock_snapshot_set_raw_value(struct bt_clock_snapshot *clock_snapshot,
+ uint64_t cycles)
+{
+ BT_ASSERT(clock_snapshot);
+ clock_snapshot->value_cycles = cycles;
+ set_ns_from_origin(clock_snapshot);
+ bt_clock_snapshot_set(clock_snapshot);
+}
+
+static inline
+void bt_clock_snapshot_set_value_inline(struct bt_clock_snapshot *clock_snapshot,
+ uint64_t raw_value)
+{
+ bt_clock_snapshot_set_raw_value(clock_snapshot, raw_value);
+}
+
+BT_HIDDEN
+void bt_clock_snapshot_destroy(struct bt_clock_snapshot *clock_snapshot);
+
+BT_HIDDEN
+struct bt_clock_snapshot *bt_clock_snapshot_new(struct bt_clock_class *clock_class);
+
+BT_HIDDEN
+struct bt_clock_snapshot *bt_clock_snapshot_create(
+ struct bt_clock_class *clock_class);
+
+BT_HIDDEN
+void bt_clock_snapshot_recycle(struct bt_clock_snapshot *clock_snapshot);
+
+BT_HIDDEN
+void bt_clock_snapshot_set_raw_value(struct bt_clock_snapshot *clock_snapshot,
+ uint64_t cycles);
+
+#endif /* BABELTRACE_TRACE_IR_CLOCK_SNAPSHOT_INTERNAL_H */
--- /dev/null
+#ifndef BABELTRACE_GRAPH_CLOCK_SNAPSHOT_SET_H
+#define BABELTRACE_GRAPH_CLOCK_SNAPSHOT_SET_H
+
+/*
+ * Copyright 2018 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 <stdint.h>
+#include <glib.h>
+#include <babeltrace/trace-ir/clock-snapshot-internal.h>
+#include <babeltrace/trace-ir/clock-class-internal.h>
+#include <babeltrace/assert-internal.h>
+
+struct bt_clock_snapshot_set {
+ /* Unique objects owned by this */
+ GPtrArray *clock_snapshots;
+
+ /* Weak; points to one of the clock snapshots above */
+ struct bt_clock_snapshot *default_cs;
+};
+
+static inline
+int bt_clock_snapshot_set_initialize(struct bt_clock_snapshot_set *cs_set)
+{
+ int ret = 0;
+
+ cs_set->clock_snapshots = g_ptr_array_sized_new(1);
+ if (!cs_set->clock_snapshots) {
+#ifdef BT_LOGE_STR
+ BT_LOGE_STR("Failed to allocate one GPtrArray.");
+#endif
+
+ ret = -1;
+ goto end;
+ }
+
+ cs_set->default_cs = NULL;
+
+end:
+ return ret;
+}
+
+static inline
+void bt_clock_snapshot_set_reset(struct bt_clock_snapshot_set *cs_set)
+{
+ uint64_t i;
+
+ BT_ASSERT(cs_set);
+ BT_ASSERT(cs_set->clock_snapshots);
+
+ for (i = 0; i < cs_set->clock_snapshots->len; i++) {
+ struct bt_clock_snapshot *cs = cs_set->clock_snapshots->pdata[i];
+
+ BT_ASSERT(cs);
+ bt_clock_snapshot_reset(cs);
+ }
+
+ cs_set->default_cs = NULL;
+}
+
+static inline
+void bt_clock_snapshot_set_finalize(struct bt_clock_snapshot_set *cs_set)
+{
+ uint64_t i;
+
+ BT_ASSERT(cs_set);
+
+ if (cs_set->clock_snapshots) {
+ for (i = 0; i < cs_set->clock_snapshots->len; i++) {
+ struct bt_clock_snapshot *cs =
+ cs_set->clock_snapshots->pdata[i];
+
+ BT_ASSERT(cs);
+ bt_clock_snapshot_recycle(cs);
+ }
+
+ g_ptr_array_free(cs_set->clock_snapshots, TRUE);
+ }
+
+ cs_set->default_cs = NULL;
+}
+
+static inline
+int bt_clock_snapshot_set_set_clock_snapshot(struct bt_clock_snapshot_set *cs_set,
+ struct bt_clock_class *cc, uint64_t raw_value)
+{
+ int ret = 0;
+ struct bt_clock_snapshot *clock_snapshot = NULL;
+ uint64_t i;
+
+ BT_ASSERT(cs_set);
+ BT_ASSERT(cc);
+
+ /*
+ * Check if we already have a value for this clock class.
+ *
+ * TODO: When we have many clock classes, make this more
+ * efficient.
+ */
+ for (i = 0; i < cs_set->clock_snapshots->len; i++) {
+ struct bt_clock_snapshot *cs = cs_set->clock_snapshots->pdata[i];
+
+ BT_ASSERT(cs);
+
+ if (cs->clock_class == cc) {
+ clock_snapshot = cs;
+ break;
+ }
+ }
+
+ if (!clock_snapshot) {
+ clock_snapshot = bt_clock_snapshot_create(cc);
+ if (!clock_snapshot) {
+#ifdef BT_LIB_LOGE
+ BT_LIB_LOGE("Cannot create a clock snapshot from a clock class: "
+ "%![cc-]+K", cc);
+#endif
+
+ ret = -1;
+ goto end;
+ }
+
+ g_ptr_array_add(cs_set->clock_snapshots, clock_snapshot);
+ }
+
+ bt_clock_snapshot_set_value_inline(clock_snapshot, raw_value);
+
+end:
+ return ret;
+}
+
+static inline
+void bt_clock_snapshot_set_set_default_clock_snapshot(
+ struct bt_clock_snapshot_set *cs_set, uint64_t raw_value)
+{
+ BT_ASSERT(cs_set);
+ BT_ASSERT(cs_set->default_cs);
+ bt_clock_snapshot_set_value_inline(cs_set->default_cs, raw_value);
+}
+
+#endif /* BABELTRACE_GRAPH_CLOCK_SNAPSHOT_SET_H */
+++ /dev/null
-#ifndef BABELTRACE_TRACE_IR_CLOCK_VALUE_CONST_H
-#define BABELTRACE_TRACE_IR_CLOCK_VALUE_CONST_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2013, 2014 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.
- *
- * The Common Trace Format (CTF) Specification is available at
- * http://www.efficios.com/ctf
- */
-
-#include <stdint.h>
-
-/* For bt_clock_class, bt_clock_value */
-#include <babeltrace/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum bt_clock_value_status {
- BT_CLOCK_VALUE_STATUS_KNOWN,
- BT_CLOCK_VALUE_STATUS_UNKNOWN,
-};
-
-extern const bt_clock_class *bt_clock_value_borrow_clock_class_const(
- const bt_clock_value *clock_value);
-
-extern uint64_t bt_clock_value_get_value(
- const bt_clock_value *clock_value);
-
-extern int bt_clock_value_get_ns_from_origin(
- const bt_clock_value *clock_value,
- int64_t *ns_from_origin);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_TRACE_IR_CLOCK_VALUE_CONST_H */
+++ /dev/null
-#ifndef BABELTRACE_TRACE_IR_CLOCK_VALUE_INTERNAL_H
-#define BABELTRACE_TRACE_IR_CLOCK_VALUE_INTERNAL_H
-
-/*
- * Copyright 2017-2018 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 <babeltrace/babeltrace-internal.h>
-#include <babeltrace/object-internal.h>
-#include <babeltrace/trace-ir/clock-class-internal.h>
-#include <babeltrace/trace-ir/utils-internal.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-struct bt_clock_class;
-
-struct bt_clock_value {
- struct bt_object base;
- struct bt_clock_class *clock_class;
- uint64_t value_cycles;
- bool ns_from_origin_overflows;
- int64_t ns_from_origin;
- bool is_set;
-};
-
-static inline
-void bt_clock_value_set(struct bt_clock_value *clock_value)
-{
- BT_ASSERT(clock_value);
- clock_value->is_set = true;
-}
-
-static inline
-void bt_clock_value_reset(struct bt_clock_value *clock_value)
-{
- BT_ASSERT(clock_value);
- clock_value->is_set = false;
-}
-
-static inline
-void set_ns_from_origin(struct bt_clock_value *clock_value)
-{
- if (bt_util_ns_from_origin(clock_value->clock_class, clock_value->value_cycles,
- &clock_value->ns_from_origin)) {
- clock_value->ns_from_origin_overflows = true;
- }
-
-}
-
-static inline
-void bt_clock_value_set_raw_value(struct bt_clock_value *clock_value,
- uint64_t cycles)
-{
- BT_ASSERT(clock_value);
- clock_value->value_cycles = cycles;
- set_ns_from_origin(clock_value);
- bt_clock_value_set(clock_value);
-}
-
-static inline
-void bt_clock_value_set_value_inline(struct bt_clock_value *clock_value,
- uint64_t raw_value)
-{
- bt_clock_value_set_raw_value(clock_value, raw_value);
-}
-
-BT_HIDDEN
-void bt_clock_value_destroy(struct bt_clock_value *clock_value);
-
-BT_HIDDEN
-struct bt_clock_value *bt_clock_value_new(struct bt_clock_class *clock_class);
-
-BT_HIDDEN
-struct bt_clock_value *bt_clock_value_create(
- struct bt_clock_class *clock_class);
-
-BT_HIDDEN
-void bt_clock_value_recycle(struct bt_clock_value *clock_value);
-
-BT_HIDDEN
-void bt_clock_value_set_raw_value(struct bt_clock_value *clock_value,
- uint64_t cycles);
-
-#endif /* BABELTRACE_TRACE_IR_CLOCK_VALUE_INTERNAL_H */
+++ /dev/null
-#ifndef BABELTRACE_GRAPH_CLOCK_VALUE_SET_H
-#define BABELTRACE_GRAPH_CLOCK_VALUE_SET_H
-
-/*
- * Copyright 2018 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 <stdint.h>
-#include <glib.h>
-#include <babeltrace/trace-ir/clock-value-internal.h>
-#include <babeltrace/trace-ir/clock-class-internal.h>
-#include <babeltrace/assert-internal.h>
-
-struct bt_clock_value_set {
- /* Unique objects owned by this */
- GPtrArray *clock_values;
-
- /* Weak; points to one of the clock values above */
- struct bt_clock_value *default_cv;
-};
-
-static inline
-int bt_clock_value_set_initialize(struct bt_clock_value_set *cv_set)
-{
- int ret = 0;
-
- cv_set->clock_values = g_ptr_array_sized_new(1);
- if (!cv_set->clock_values) {
-#ifdef BT_LOGE_STR
- BT_LOGE_STR("Failed to allocate one GPtrArray.");
-#endif
-
- ret = -1;
- goto end;
- }
-
- cv_set->default_cv = NULL;
-
-end:
- return ret;
-}
-
-static inline
-void bt_clock_value_set_reset(struct bt_clock_value_set *cv_set)
-{
- uint64_t i;
-
- BT_ASSERT(cv_set);
- BT_ASSERT(cv_set->clock_values);
-
- for (i = 0; i < cv_set->clock_values->len; i++) {
- struct bt_clock_value *cv = cv_set->clock_values->pdata[i];
-
- BT_ASSERT(cv);
- bt_clock_value_reset(cv);
- }
-
- cv_set->default_cv = NULL;
-}
-
-static inline
-void bt_clock_value_set_finalize(struct bt_clock_value_set *cv_set)
-{
- uint64_t i;
-
- BT_ASSERT(cv_set);
-
- if (cv_set->clock_values) {
- for (i = 0; i < cv_set->clock_values->len; i++) {
- struct bt_clock_value *cv =
- cv_set->clock_values->pdata[i];
-
- BT_ASSERT(cv);
- bt_clock_value_recycle(cv);
- }
-
- g_ptr_array_free(cv_set->clock_values, TRUE);
- }
-
- cv_set->default_cv = NULL;
-}
-
-static inline
-int bt_clock_value_set_set_clock_value(struct bt_clock_value_set *cv_set,
- struct bt_clock_class *cc, uint64_t raw_value)
-{
- int ret = 0;
- struct bt_clock_value *clock_value = NULL;
- uint64_t i;
-
- BT_ASSERT(cv_set);
- BT_ASSERT(cc);
-
- /*
- * Check if we already have a value for this clock class.
- *
- * TODO: When we have many clock classes, make this more
- * efficient.
- */
- for (i = 0; i < cv_set->clock_values->len; i++) {
- struct bt_clock_value *cv = cv_set->clock_values->pdata[i];
-
- BT_ASSERT(cv);
-
- if (cv->clock_class == cc) {
- clock_value = cv;
- break;
- }
- }
-
- if (!clock_value) {
- clock_value = bt_clock_value_create(cc);
- if (!clock_value) {
-#ifdef BT_LIB_LOGE
- BT_LIB_LOGE("Cannot create a clock value from a clock class: "
- "%![cc-]+K", cc);
-#endif
-
- ret = -1;
- goto end;
- }
-
- g_ptr_array_add(cv_set->clock_values, clock_value);
- }
-
- bt_clock_value_set_value_inline(clock_value, raw_value);
-
-end:
- return ret;
-}
-
-static inline
-void bt_clock_value_set_set_default_clock_value(
- struct bt_clock_value_set *cv_set, uint64_t raw_value)
-{
- BT_ASSERT(cv_set);
- BT_ASSERT(cv_set->default_cv);
- bt_clock_value_set_value_inline(cv_set->default_cv, raw_value);
-}
-
-#endif /* BABELTRACE_GRAPH_CLOCK_VALUE_SET_H */
* http://www.efficios.com/ctf
*/
-/* For enum bt_clock_value_status */
-#include <babeltrace/trace-ir/clock-value-const.h>
+/* For enum bt_clock_snapshot_status */
+#include <babeltrace/trace-ir/clock-snapshot-const.h>
-/* For bt_event, bt_clock_value, bt_event_class, bt_field, bt_packet */
+/* For bt_event, bt_clock_snapshot, bt_event_class, bt_field, bt_packet */
#include <babeltrace/types.h>
#ifdef __cplusplus
extern const bt_field *bt_event_borrow_payload_field_const(
const bt_event *event);
-extern enum bt_clock_value_status bt_event_borrow_default_clock_value_const(
+extern enum bt_clock_snapshot_status bt_event_borrow_default_clock_snapshot_const(
const bt_event *event,
- const bt_clock_value **clock_value);
+ const bt_clock_snapshot **clock_snapshot);
#ifdef __cplusplus
}
#include <babeltrace/assert-pre-internal.h>
#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/value.h>
-#include <babeltrace/trace-ir/clock-value-internal.h>
+#include <babeltrace/trace-ir/clock-snapshot-internal.h>
#include <babeltrace/trace-ir/stream-class.h>
#include <babeltrace/trace-ir/stream.h>
#include <babeltrace/trace-ir/stream-internal.h>
struct bt_field *common_context_field;
struct bt_field *specific_context_field;
struct bt_field *payload_field;
- struct bt_clock_value *default_cv;
+ struct bt_clock_snapshot *default_cs;
bool frozen;
};
BT_LIB_LOGD("Resetting event: %!+e", event);
bt_event_set_is_frozen(event, false);
- if (event->default_cv) {
- bt_clock_value_reset(event->default_cv);
+ if (event->default_cs) {
+ bt_clock_snapshot_reset(event->default_cs);
}
bt_object_put_no_null_check(&event->packet->base);
extern bt_field *bt_event_borrow_payload_field(bt_event *event);
-extern void bt_event_set_default_clock_value(bt_event *event,
+extern void bt_event_set_default_clock_snapshot(bt_event *event,
uint64_t value_cycles);
#ifdef __cplusplus
/* For enum bt_property_availability */
#include <babeltrace/property.h>
-/* For enum bt_clock_value_status */
-#include <babeltrace/trace-ir/clock-value-const.h>
+/* For enum bt_clock_snapshot_status */
+#include <babeltrace/trace-ir/clock-snapshot-const.h>
/*
* For bt_packet, bt_packet_header_field, bt_packet_context_field,
- * bt_stream, bt_clock_value
+ * bt_stream, bt_clock_snapshot
*/
#include <babeltrace/types.h>
const bt_packet *packet);
extern
-enum bt_clock_value_status bt_packet_borrow_default_beginning_clock_value_const(
+enum bt_clock_snapshot_status bt_packet_borrow_default_beginning_clock_snapshot_const(
const bt_packet *packet,
- const bt_clock_value **clock_value);
+ const bt_clock_snapshot **clock_snapshot);
extern
-enum bt_clock_value_status bt_packet_borrow_default_end_clock_valeu_const(
+enum bt_clock_snapshot_status bt_packet_borrow_default_end_clock_valeu_const(
const bt_packet *packet,
- const bt_clock_value **clock_value);
+ const bt_clock_snapshot **clock_snapshot);
extern
enum bt_property_availability bt_packet_get_discarded_event_counter_snapshot(
#include <stdbool.h>
#include <babeltrace/assert-internal.h>
-#include <babeltrace/trace-ir/clock-value-const.h>
+#include <babeltrace/trace-ir/clock-snapshot-const.h>
#include <babeltrace/trace-ir/packet.h>
#include <babeltrace/trace-ir/field.h>
#include <babeltrace/trace-ir/stream.h>
struct bt_field_wrapper *header_field;
struct bt_field_wrapper *context_field;
struct bt_stream *stream;
- struct bt_clock_value *default_beginning_cv;
- struct bt_clock_value *default_end_cv;
+ struct bt_clock_snapshot *default_beginning_cs;
+ struct bt_clock_snapshot *default_end_cs;
struct bt_property_uint discarded_event_counter_snapshot;
struct bt_property_uint packet_counter_snapshot;
bool frozen;
bt_packet_context_field *context);
extern
-void bt_packet_set_default_beginning_clock_value(bt_packet *packet,
+void bt_packet_set_default_beginning_clock_snapshot(bt_packet *packet,
uint64_t value_cycles);
extern
-void bt_packet_set_default_end_clock_value(bt_packet *packet,
+void bt_packet_set_default_end_clock_snapshot(bt_packet *packet,
uint64_t value_cycles);
extern
extern bt_bool bt_stream_class_packets_have_packet_counter_snapshot(
const bt_stream_class *stream_class);
-extern bt_bool bt_stream_class_packets_have_default_beginning_clock_value(
+extern bt_bool bt_stream_class_packets_have_default_beginning_clock_snapshot(
const bt_stream_class *stream_class);
-extern bt_bool bt_stream_class_packets_have_default_end_clock_value(
+extern bt_bool bt_stream_class_packets_have_default_end_clock_snapshot(
const bt_stream_class *stream_class);
extern void bt_stream_class_get_ref(const bt_stream_class *stream_class);
bool assigns_automatic_stream_id;
bool packets_have_discarded_event_counter_snapshot;
bool packets_have_packet_counter_snapshot;
- bool packets_have_default_beginning_cv;
- bool packets_have_default_end_cv;
+ bool packets_have_default_beginning_cs;
+ bool packets_have_default_end_cs;
struct bt_field_class *packet_context_fc;
struct bt_field_class *event_header_fc;
struct bt_field_class *event_common_context_fc;
bt_stream_class *stream_class, bt_bool value);
extern void
-bt_stream_class_set_packets_have_default_beginning_clock_value(
+bt_stream_class_set_packets_have_default_beginning_clock_snapshot(
bt_stream_class *stream_class, bt_bool value);
extern void
-bt_stream_class_set_packets_have_default_end_clock_value(
+bt_stream_class_set_packets_have_default_end_clock_snapshot(
bt_stream_class *stream_class, bt_bool value);
#ifdef __cplusplus
typedef const uint8_t *bt_uuid;
typedef struct bt_clock_class bt_clock_class;
-typedef struct bt_clock_value bt_clock_value;
+typedef struct bt_clock_snapshot bt_clock_snapshot;
typedef struct bt_component bt_component;
typedef struct bt_component_class bt_component_class;
typedef struct bt_component_class_filter bt_component_class_filter;
#include <babeltrace/graph/message-discarded-elements-internal.h>
#include <stdint.h>
-struct bt_clock_value *
-bt_message_discarded_events_borrow_begin_clock_value(
+struct bt_clock_snapshot *
+bt_message_discarded_events_borrow_begin_clock_snapshot(
struct bt_message *message)
{
- return bt_message_discarded_elements_borrow_begin_clock_value(
+ return bt_message_discarded_elements_borrow_begin_clock_snapshot(
BT_MESSAGE_TYPE_DISCARDED_EVENTS, message);
}
-struct bt_clock_value *
-bt_message_discarded_events_borrow_end_clock_value(
+struct bt_clock_snapshot *
+bt_message_discarded_events_borrow_end_clock_snapshot(
struct bt_message *message)
{
- return bt_message_discarded_elements_borrow_end_clock_value(
+ return bt_message_discarded_elements_borrow_end_clock_snapshot(
BT_MESSAGE_TYPE_DISCARDED_EVENTS, message);
}
#include <babeltrace/graph/message-discarded-elements-internal.h>
#include <stdint.h>
-struct bt_clock_value *
-bt_message_discarded_packets_borrow_begin_clock_value(
+struct bt_clock_snapshot *
+bt_message_discarded_packets_borrow_begin_clock_snapshot(
struct bt_message *message)
{
- return bt_message_discarded_elements_borrow_begin_clock_value(
+ return bt_message_discarded_elements_borrow_begin_clock_snapshot(
BT_MESSAGE_TYPE_DISCARDED_PACKETS, message);
}
-struct bt_clock_value *
-bt_message_discarded_packets_borrow_end_clock_value(
+struct bt_clock_snapshot *
+bt_message_discarded_packets_borrow_end_clock_snapshot(
struct bt_message *message)
{
- return bt_message_discarded_elements_borrow_end_clock_value(
+ return bt_message_discarded_elements_borrow_end_clock_snapshot(
BT_MESSAGE_TYPE_DISCARDED_PACKETS, message);
}
#include <babeltrace/object-internal.h>
#include <babeltrace/compiler-internal.h>
#include <babeltrace/trace-ir/clock-class.h>
-#include <babeltrace/trace-ir/clock-value-internal.h>
+#include <babeltrace/trace-ir/clock-snapshot-internal.h>
#include <babeltrace/graph/message-internal.h>
#include <babeltrace/graph/message-inactivity-const.h>
#include <babeltrace/graph/message-inactivity.h>
BT_LIB_LOGD("Destroying inactivity message: %!+n", message);
- if (message->default_cv) {
- bt_clock_value_recycle(message->default_cv);
+ if (message->default_cs) {
+ bt_clock_snapshot_recycle(message->default_cs);
}
g_free(message);
BT_MESSAGE_TYPE_INACTIVITY,
bt_message_inactivity_destroy, NULL);
ret_msg = &message->parent;
- message->default_cv = bt_clock_value_create(default_clock_class);
- if (!message->default_cv) {
+ message->default_cs = bt_clock_snapshot_create(default_clock_class);
+ if (!message->default_cs) {
goto error;
}
return (void *) ret_msg;
}
-void bt_message_inactivity_set_default_clock_value(
+void bt_message_inactivity_set_default_clock_snapshot(
struct bt_message *msg, uint64_t value_cycles)
{
struct bt_message_inactivity *inactivity = (void *) msg;
BT_ASSERT_PRE_NON_NULL(msg, "Message");
BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_INACTIVITY);
BT_ASSERT_PRE_HOT(msg, "Message", ": %!+n", msg);
- bt_clock_value_set_value_inline(inactivity->default_cv, value_cycles);
- BT_LIB_LOGV("Set inactivity message's default clock value: "
+ bt_clock_snapshot_set_value_inline(inactivity->default_cs, value_cycles);
+ BT_LIB_LOGV("Set inactivity message's default clock snapshot: "
"%![msg-]+n, value=%" PRIu64, msg, value_cycles);
}
-const struct bt_clock_value *
-bt_message_inactivity_borrow_default_clock_value_const(
+const struct bt_clock_snapshot *
+bt_message_inactivity_borrow_default_clock_snapshot_const(
const struct bt_message *msg)
{
struct bt_message_inactivity *inactivity = (void *) msg;
BT_ASSERT_PRE_NON_NULL(msg, "Message");
BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_INACTIVITY);
- return inactivity->default_cv;
+ return inactivity->default_cs;
}
BT_LIB_LOGD("Putting stream: %!+s", message->stream);
BT_OBJECT_PUT_REF_AND_RESET(message->stream);
- if (message->default_cv) {
- bt_clock_value_recycle(message->default_cv);
- message->default_cv = NULL;
+ if (message->default_cs) {
+ bt_clock_snapshot_recycle(message->default_cs);
+ message->default_cs = NULL;
}
g_free(message);
(void *) message);
}
-void bt_message_stream_end_set_default_clock_value(
+void bt_message_stream_end_set_default_clock_snapshot(
struct bt_message *msg, uint64_t value_cycles)
{
struct bt_message_stream_end *se_msg = (void *) msg;
"%![msg-]+n, %![sc-]+S", msg, se_msg->stream->class);
/* TODO: have the object already created */
- se_msg->default_cv = bt_clock_value_create(
+ se_msg->default_cs = bt_clock_snapshot_create(
se_msg->stream->class->default_clock_class);
- BT_ASSERT(se_msg->default_cv);
- bt_clock_value_set_value_inline(se_msg->default_cv, value_cycles);
- BT_LIB_LOGV("Set message's default clock value: %![msg-]+n, "
+ BT_ASSERT(se_msg->default_cs);
+ bt_clock_snapshot_set_value_inline(se_msg->default_cs, value_cycles);
+ BT_LIB_LOGV("Set message's default clock snapshot: %![msg-]+n, "
"value=%" PRIu64, value_cycles);
}
-struct bt_clock_value *bt_message_stream_end_borrow_default_clock_value(
+struct bt_clock_snapshot *bt_message_stream_end_borrow_default_clock_snapshot(
struct bt_message *msg)
{
struct bt_message_stream_end *stream_end = (void *) msg;
BT_ASSERT_PRE_NON_NULL(msg, "Message");
BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_STREAM_END);
- return stream_end->default_cv;
+ return stream_end->default_cs;
}
static
BT_LIB_LOGD("Putting stream: %!+s", message->stream);
BT_OBJECT_PUT_REF_AND_RESET(message->stream);
- if (message->default_cv) {
- bt_clock_value_recycle(message->default_cv);
- message->default_cv = NULL;
+ if (message->default_cs) {
+ bt_clock_snapshot_recycle(message->default_cs);
+ message->default_cs = NULL;
}
g_free(message);
(void *) message);
}
-void bt_message_stream_beginning_set_default_clock_value(
+void bt_message_stream_beginning_set_default_clock_snapshot(
struct bt_message *msg,
uint64_t value_cycles)
{
"%![msg-]+n, %![sc-]+S", msg, sb_msg->stream->class);
/* TODO: have the object already created */
- sb_msg->default_cv = bt_clock_value_create(
+ sb_msg->default_cs = bt_clock_snapshot_create(
sb_msg->stream->class->default_clock_class);
- BT_ASSERT(sb_msg->default_cv);
- bt_clock_value_set_value_inline(sb_msg->default_cv, value_cycles);
- BT_LIB_LOGV("Set message's default clock value: %![msg-]+n, "
+ BT_ASSERT(sb_msg->default_cs);
+ bt_clock_snapshot_set_value_inline(sb_msg->default_cs, value_cycles);
+ BT_LIB_LOGV("Set message's default clock snapshot: %![msg-]+n, "
"value=%" PRIu64, value_cycles);
}
-struct bt_clock_value *bt_message_stream_beginning_borrow_default_clock_value(
+struct bt_clock_snapshot *bt_message_stream_beginning_borrow_default_clock_snapshot(
struct bt_message *msg)
{
struct bt_message_stream_beginning *stream_begin = (void *) msg;
BT_ASSERT_PRE_NON_NULL(msg, "Message");
BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_STREAM_BEGINNING);
- return stream_begin->default_cv;
+ return stream_begin->default_cs;
}
#include <babeltrace/trace-ir/trace-internal.h>
#include <babeltrace/trace-ir/trace-class-internal.h>
#include <babeltrace/trace-ir/clock-class-internal.h>
-#include <babeltrace/trace-ir/clock-value-internal.h>
+#include <babeltrace/trace-ir/clock-snapshot-internal.h>
#include <babeltrace/trace-ir/field-path-internal.h>
#include <babeltrace/trace-ir/utils-internal.h>
#include <babeltrace/graph/component-class-internal.h>
static inline void format_connection(char **buf_ch, bool extended,
const char *prefix, const struct bt_connection *connection);
-static inline void format_clock_value(char **buf_ch, bool extended,
- const char *prefix, const struct bt_clock_value *clock_value);
+static inline void format_clock_snapshot(char **buf_ch, bool extended,
+ const char *prefix, const struct bt_clock_snapshot *clock_snapshot);
static inline void format_field_path(char **buf_ch, bool extended,
const char *prefix, const struct bt_field_path *field_path);
BUF_APPEND(", %sassigns-auto-ec-id=%d, %sassigns-auto-stream-id=%d, "
"%spackets-have-discarded-ev-counter-snapshot=%d, "
"%spackets-have-packet-counter-snapshot=%d, "
- "%spackets-have-default-begin-cv=%d, "
- "%spackets-have-default-end-cv=%d",
+ "%spackets-have-default-begin-cs=%d, "
+ "%spackets-have-default-end-cs=%d",
PRFIELD(stream_class->assigns_automatic_event_class_id),
PRFIELD(stream_class->assigns_automatic_stream_id),
PRFIELD(stream_class->packets_have_discarded_event_counter_snapshot),
PRFIELD(stream_class->packets_have_packet_counter_snapshot),
- PRFIELD(stream_class->packets_have_default_beginning_cv),
- PRFIELD(stream_class->packets_have_default_end_cv));
+ PRFIELD(stream_class->packets_have_default_beginning_cs),
+ PRFIELD(stream_class->packets_have_default_end_cs));
BUF_APPEND(", %strace-class-addr=%p", PRFIELD(trace_class));
SET_TMP_PREFIX("trace-class-");
format_trace_class(buf_ch, false, tmp_prefix, trace_class);
return;
}
- if (packet->default_beginning_cv) {
- SET_TMP_PREFIX("default-begin-cv-");
- format_clock_value(buf_ch, true, tmp_prefix,
- packet->default_beginning_cv);
+ if (packet->default_beginning_cs) {
+ SET_TMP_PREFIX("default-begin-cs-");
+ format_clock_snapshot(buf_ch, true, tmp_prefix,
+ packet->default_beginning_cs);
}
- if (packet->default_end_cv) {
- SET_TMP_PREFIX("default-end-cv-");
- format_clock_value(buf_ch, true, tmp_prefix,
- packet->default_end_cv);
+ if (packet->default_end_cs) {
+ SET_TMP_PREFIX("default-end-cs-");
+ format_clock_snapshot(buf_ch, true, tmp_prefix,
+ packet->default_end_cs);
}
if (packet->discarded_event_counter_snapshot.base.avail) {
}
}
- if (event->default_cv) {
- SET_TMP_PREFIX("default-cv-");
- format_clock_value(buf_ch, true, tmp_prefix,
- event->default_cv);
+ if (event->default_cs) {
+ SET_TMP_PREFIX("default-cs-");
+ format_clock_snapshot(buf_ch, true, tmp_prefix,
+ event->default_cs);
}
packet = bt_event_borrow_packet_const(event);
PRFIELD(clock_class->is_absolute),
PRFIELD(clock_class->base_offset.value_ns));
- SET_TMP_PREFIX("cv-pool-");
- format_object_pool(buf_ch, extended, prefix, &clock_class->cv_pool);
+ SET_TMP_PREFIX("cs-pool-");
+ format_object_pool(buf_ch, extended, prefix, &clock_class->cs_pool);
}
-static inline void format_clock_value(char **buf_ch, bool extended,
- const char *prefix, const struct bt_clock_value *clock_value)
+static inline void format_clock_snapshot(char **buf_ch, bool extended,
+ const char *prefix, const struct bt_clock_snapshot *clock_snapshot)
{
char tmp_prefix[64];
BUF_APPEND(", %svalue=%" PRIu64 ", %sns-from-origin=%" PRId64,
- PRFIELD(clock_value->value_cycles),
- PRFIELD(clock_value->ns_from_origin));
+ PRFIELD(clock_snapshot->value_cycles),
+ PRFIELD(clock_snapshot->ns_from_origin));
if (!extended) {
return;
}
- BUF_APPEND(", %sis-set=%d", PRFIELD(clock_value->is_set));
+ BUF_APPEND(", %sis-set=%d", PRFIELD(clock_snapshot->is_set));
- if (clock_value->clock_class) {
+ if (clock_snapshot->clock_class) {
BUF_APPEND(", %sclock-class-addr=%p",
- PRFIELD(clock_value->clock_class));
+ PRFIELD(clock_snapshot->clock_class));
SET_TMP_PREFIX("clock-class-");
format_clock_class(buf_ch, false, tmp_prefix,
- clock_value->clock_class);
+ clock_snapshot->clock_class);
}
}
format_clock_class(buf_ch, extended, prefix, obj);
break;
case 'k':
- format_clock_value(buf_ch, extended, prefix, obj);
+ format_clock_snapshot(buf_ch, extended, prefix, obj);
break;
case 'v':
format_value(buf_ch, extended, prefix, obj);
libtrace_ir_la_SOURCES = \
attributes.c \
clock-class.c \
- clock-value.c \
+ clock-snapshot.c \
event.c \
event-class.c \
event-header-field.c \
#include <babeltrace/assert-pre-internal.h>
#include <babeltrace/compat/uuid-internal.h>
#include <babeltrace/trace-ir/clock-class-internal.h>
-#include <babeltrace/trace-ir/clock-value-internal.h>
+#include <babeltrace/trace-ir/clock-snapshot-internal.h>
#include <babeltrace/trace-ir/utils-internal.h>
#include <babeltrace/compiler-internal.h>
#include <babeltrace/types.h>
clock_class->description.value = NULL;
}
- bt_object_pool_finalize(&clock_class->cv_pool);
+ bt_object_pool_finalize(&clock_class->cs_pool);
g_free(clock_class);
}
static
-void free_clock_value(struct bt_clock_value *clock_value,
+void free_clock_snapshot(struct bt_clock_snapshot *clock_snapshot,
struct bt_clock_class *clock_class)
{
- bt_clock_value_destroy(clock_value);
+ bt_clock_snapshot_destroy(clock_snapshot);
}
static inline
clock_class->frequency = UINT64_C(1000000000);
clock_class->is_absolute = BT_TRUE;
set_base_offset(clock_class);
- ret = bt_object_pool_initialize(&clock_class->cv_pool,
- (bt_object_pool_new_object_func) bt_clock_value_new,
+ ret = bt_object_pool_initialize(&clock_class->cs_pool,
+ (bt_object_pool_new_object_func) bt_clock_snapshot_new,
(bt_object_pool_destroy_object_func)
- free_clock_value,
+ free_clock_snapshot,
clock_class);
if (ret) {
- BT_LOGE("Failed to initialize clock value pool: ret=%d",
+ BT_LOGE("Failed to initialize clock snapshot pool: ret=%d",
ret);
goto error;
}
--- /dev/null
+/*
+ * Copyright 2017-2018 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 "CLOCK-SNAPSHOT"
+#include <babeltrace/lib-logging-internal.h>
+
+#include <babeltrace/assert-pre-internal.h>
+#include <babeltrace/compat/uuid-internal.h>
+#include <babeltrace/trace-ir/clock-class-internal.h>
+#include <babeltrace/trace-ir/clock-snapshot-internal.h>
+#include <babeltrace/compiler-internal.h>
+#include <babeltrace/types.h>
+#include <babeltrace/compat/string-internal.h>
+#include <inttypes.h>
+#include <babeltrace/object-internal.h>
+#include <babeltrace/assert-internal.h>
+
+BT_HIDDEN
+void bt_clock_snapshot_destroy(struct bt_clock_snapshot *clock_snapshot)
+{
+ BT_LIB_LOGD("Destroying clock snapshot: %!+k", clock_snapshot);
+ BT_OBJECT_PUT_REF_AND_RESET(clock_snapshot->clock_class);
+ g_free(clock_snapshot);
+}
+
+BT_HIDDEN
+struct bt_clock_snapshot *bt_clock_snapshot_new(struct bt_clock_class *clock_class)
+{
+ struct bt_clock_snapshot *ret = NULL;
+
+ BT_ASSERT(clock_class);
+ BT_LIB_LOGD("Creating clock snapshot object: %![cc-]+K=",
+ clock_class);
+ ret = g_new0(struct bt_clock_snapshot, 1);
+ if (!ret) {
+ BT_LOGE_STR("Failed to allocate one clock snapshot.");
+ goto end;
+ }
+
+ bt_object_init_unique(&ret->base);
+ ret->clock_class = clock_class;
+ bt_object_get_no_null_check(clock_class);
+ bt_clock_class_freeze(clock_class);
+ BT_LIB_LOGD("Created clock snapshot object: %!+k", ret);
+
+end:
+ return ret;
+}
+
+BT_HIDDEN
+struct bt_clock_snapshot *bt_clock_snapshot_create(struct bt_clock_class *clock_class)
+{
+ struct bt_clock_snapshot *clock_snapshot = NULL;
+
+ BT_ASSERT(clock_class);
+ clock_snapshot = bt_object_pool_create_object(&clock_class->cs_pool);
+ if (!clock_snapshot) {
+ BT_LIB_LOGE("Cannot allocate one clock snapshot from clock class's clock snapshot pool: "
+ "%![cc-]+K", clock_class);
+ goto error;
+ }
+
+ if (likely(!clock_snapshot->clock_class)) {
+ clock_snapshot->clock_class = clock_class;
+ bt_object_get_no_null_check(clock_class);
+ }
+
+ goto end;
+
+error:
+ if (clock_snapshot) {
+ bt_clock_snapshot_recycle(clock_snapshot);
+ clock_snapshot = NULL;
+ }
+
+end:
+ return clock_snapshot;
+}
+
+BT_HIDDEN
+void bt_clock_snapshot_recycle(struct bt_clock_snapshot *clock_snapshot)
+{
+ struct bt_clock_class *clock_class;
+
+ BT_ASSERT(clock_snapshot);
+ BT_LIB_LOGD("Recycling clock snapshot: %!+k", clock_snapshot);
+
+ /*
+ * Those are the important ordered steps:
+ *
+ * 1. Reset the clock snapshot object, but do NOT put its clock
+ * class's reference. This clock class contains the pool to
+ * which we're about to recycle this clock snapshot object,
+ * so we must guarantee its existence thanks to this existing
+ * reference.
+ *
+ * 2. Move the clock class reference to our `clock_class`
+ * variable so that we can set the clock snapshot's clock
+ * class member to NULL before recycling it. We CANNOT do
+ * this after we put the clock class reference because this
+ * bt_object_put_ref() could destroy the clock class, also
+ * destroying its clock snapshot pool, thus also destroying
+ * our clock snapshot object (this would result in an invalid
+ * write access).
+ *
+ * 3. Recycle the clock snapshot object.
+ *
+ * 4. Put our clock class reference.
+ */
+ bt_clock_snapshot_reset(clock_snapshot);
+ clock_class = clock_snapshot->clock_class;
+ BT_ASSERT(clock_class);
+ clock_snapshot->clock_class = NULL;
+ bt_object_pool_recycle_object(&clock_class->cs_pool, clock_snapshot);
+ bt_object_put_ref(clock_class);
+}
+
+uint64_t bt_clock_snapshot_get_value(const struct bt_clock_snapshot *clock_snapshot)
+{
+ BT_ASSERT_PRE_NON_NULL(clock_snapshot, "Clock snapshot");
+ BT_ASSERT_PRE(clock_snapshot->is_set,
+ "Clock snapshot is not set: %!+k", clock_snapshot);
+ return clock_snapshot->value_cycles;
+}
+
+int bt_clock_snapshot_get_ns_from_origin(const struct bt_clock_snapshot *clock_snapshot,
+ int64_t *ret_value_ns)
+{
+ int ret = 0;
+ BT_ASSERT_PRE_NON_NULL(clock_snapshot, "Clock snapshot");
+ BT_ASSERT_PRE_NON_NULL(ret_value_ns, "Value (ns) (output)");
+ BT_ASSERT_PRE(clock_snapshot->is_set,
+ "Clock snapshot is not set: %!+k", clock_snapshot);
+
+ if (clock_snapshot->ns_from_origin_overflows) {
+ BT_LIB_LOGD("Clock snapshot, once converted to nanoseconds from origin, "
+ "overflows the signed 64-bit integer range: "
+ "%![cs-]+k", clock_snapshot);
+ ret = -1;
+ goto end;
+ }
+
+ *ret_value_ns = clock_snapshot->ns_from_origin;
+
+end:
+ return ret;
+}
+
+const struct bt_clock_class *bt_clock_snapshot_borrow_clock_class_const(
+ const struct bt_clock_snapshot *clock_snapshot)
+{
+ BT_ASSERT_PRE_NON_NULL(clock_snapshot, "Clock snapshot");
+ return clock_snapshot->clock_class;
+}
+++ /dev/null
-/*
- * Copyright 2017-2018 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 "CLOCK-VALUE"
-#include <babeltrace/lib-logging-internal.h>
-
-#include <babeltrace/assert-pre-internal.h>
-#include <babeltrace/compat/uuid-internal.h>
-#include <babeltrace/trace-ir/clock-class-internal.h>
-#include <babeltrace/trace-ir/clock-value-internal.h>
-#include <babeltrace/compiler-internal.h>
-#include <babeltrace/types.h>
-#include <babeltrace/compat/string-internal.h>
-#include <inttypes.h>
-#include <babeltrace/object-internal.h>
-#include <babeltrace/assert-internal.h>
-
-BT_HIDDEN
-void bt_clock_value_destroy(struct bt_clock_value *clock_value)
-{
- BT_LIB_LOGD("Destroying clock value: %!+k", clock_value);
- BT_OBJECT_PUT_REF_AND_RESET(clock_value->clock_class);
- g_free(clock_value);
-}
-
-BT_HIDDEN
-struct bt_clock_value *bt_clock_value_new(struct bt_clock_class *clock_class)
-{
- struct bt_clock_value *ret = NULL;
-
- BT_ASSERT(clock_class);
- BT_LIB_LOGD("Creating clock value object: %![cc-]+K=",
- clock_class);
- ret = g_new0(struct bt_clock_value, 1);
- if (!ret) {
- BT_LOGE_STR("Failed to allocate one clock value.");
- goto end;
- }
-
- bt_object_init_unique(&ret->base);
- ret->clock_class = clock_class;
- bt_object_get_no_null_check(clock_class);
- bt_clock_class_freeze(clock_class);
- BT_LIB_LOGD("Created clock value object: %!+k", ret);
-
-end:
- return ret;
-}
-
-BT_HIDDEN
-struct bt_clock_value *bt_clock_value_create(struct bt_clock_class *clock_class)
-{
- struct bt_clock_value *clock_value = NULL;
-
- BT_ASSERT(clock_class);
- clock_value = bt_object_pool_create_object(&clock_class->cv_pool);
- if (!clock_value) {
- BT_LIB_LOGE("Cannot allocate one clock value from clock class's clock value pool: "
- "%![cc-]+K", clock_class);
- goto error;
- }
-
- if (likely(!clock_value->clock_class)) {
- clock_value->clock_class = clock_class;
- bt_object_get_no_null_check(clock_class);
- }
-
- goto end;
-
-error:
- if (clock_value) {
- bt_clock_value_recycle(clock_value);
- clock_value = NULL;
- }
-
-end:
- return clock_value;
-}
-
-BT_HIDDEN
-void bt_clock_value_recycle(struct bt_clock_value *clock_value)
-{
- struct bt_clock_class *clock_class;
-
- BT_ASSERT(clock_value);
- BT_LIB_LOGD("Recycling clock value: %!+k", clock_value);
-
- /*
- * Those are the important ordered steps:
- *
- * 1. Reset the clock value object, but do NOT put its clock
- * class's reference. This clock class contains the pool to
- * which we're about to recycle this clock value object, so
- * we must guarantee its existence thanks to this existing
- * reference.
- *
- * 2. Move the clock class reference to our `clock_class`
- * variable so that we can set the clock value's clock class
- * member to NULL before recycling it. We CANNOT do this
- * after we put the clock class reference because this
- * bt_object_put_ref() could destroy the clock class, also destroying
- * its clock value pool, thus also destroying our clock value
- * object (this would result in an invalid write access).
- *
- * 3. Recycle the clock value object.
- *
- * 4. Put our clock class reference.
- */
- bt_clock_value_reset(clock_value);
- clock_class = clock_value->clock_class;
- BT_ASSERT(clock_class);
- clock_value->clock_class = NULL;
- bt_object_pool_recycle_object(&clock_class->cv_pool, clock_value);
- bt_object_put_ref(clock_class);
-}
-
-uint64_t bt_clock_value_get_value(const struct bt_clock_value *clock_value)
-{
- BT_ASSERT_PRE_NON_NULL(clock_value, "Clock value");
- BT_ASSERT_PRE(clock_value->is_set,
- "Clock value is not set: %!+k", clock_value);
- return clock_value->value_cycles;
-}
-
-int bt_clock_value_get_ns_from_origin(const struct bt_clock_value *clock_value,
- int64_t *ret_value_ns)
-{
- int ret = 0;
- BT_ASSERT_PRE_NON_NULL(clock_value, "Clock value");
- BT_ASSERT_PRE_NON_NULL(ret_value_ns, "Value (ns) (output)");
- BT_ASSERT_PRE(clock_value->is_set,
- "Clock value is not set: %!+k", clock_value);
-
- if (clock_value->ns_from_origin_overflows) {
- BT_LIB_LOGD("Clock value, once converted to nanoseconds from origin, "
- "overflows the signed 64-bit integer range: "
- "%![cv-]+k", clock_value);
- ret = -1;
- goto end;
- }
-
- *ret_value_ns = clock_value->ns_from_origin;
-
-end:
- return ret;
-}
-
-const struct bt_clock_class *bt_clock_value_borrow_clock_class_const(
- const struct bt_clock_value *clock_value)
-{
- BT_ASSERT_PRE_NON_NULL(clock_value, "Clock value");
- return clock_value->clock_class;
-}
#include <babeltrace/lib-logging-internal.h>
#include <babeltrace/assert-pre-internal.h>
-#include <babeltrace/trace-ir/clock-value-internal.h>
+#include <babeltrace/trace-ir/clock-snapshot-internal.h>
#include <babeltrace/trace-ir/field-internal.h>
#include <babeltrace/trace-ir/field-class.h>
#include <babeltrace/trace-ir/field-class-internal.h>
#include <babeltrace/trace-ir/field-internal.h>
#include <babeltrace/trace-ir/field-class-internal.h>
#include <babeltrace/trace-ir/clock-class.h>
-#include <babeltrace/trace-ir/clock-value-const.h>
-#include <babeltrace/trace-ir/clock-value-internal.h>
+#include <babeltrace/trace-ir/clock-snapshot-const.h>
+#include <babeltrace/trace-ir/clock-snapshot-internal.h>
#include <babeltrace/trace-ir/clock-class-internal.h>
#include <babeltrace/trace-ir/event-const.h>
#include <babeltrace/trace-ir/event-internal.h>
}
if (stream_class->default_clock_class) {
- event->default_cv = bt_clock_value_create(
+ event->default_cs = bt_clock_snapshot_create(
stream_class->default_clock_class);
- if (!event->default_cv) {
- /* bt_clock_value_create() logs errors */
+ if (!event->default_cs) {
+ /* bt_clock_snapshot_create() logs errors */
goto error;
}
}
BT_LOGD_STR("Putting event's class.");
bt_object_put_ref(event->class);
- if (event->default_cv) {
- bt_clock_value_recycle(event->default_cv);
- event->default_cv = NULL;
+ if (event->default_cs) {
+ bt_clock_snapshot_recycle(event->default_cs);
+ event->default_cs = NULL;
}
BT_LOGD_STR("Putting event's packet.");
g_free(event);
}
-void bt_event_set_default_clock_value(struct bt_event *event,
+void bt_event_set_default_clock_snapshot(struct bt_event *event,
uint64_t value_cycles)
{
struct bt_stream_class *sc;
BT_ASSERT_PRE(sc->default_clock_class,
"Event's stream class has no default clock class: "
"%![ev-]+e, %![sc-]+S", event, sc);
- BT_ASSERT(event->default_cv);
- bt_clock_value_set_value_inline(event->default_cv, value_cycles);
- BT_LIB_LOGV("Set event's default clock value: %![event-]+e, "
+ BT_ASSERT(event->default_cs);
+ bt_clock_snapshot_set_value_inline(event->default_cs, value_cycles);
+ BT_LIB_LOGV("Set event's default clock snapshot: %![event-]+e, "
"value=%" PRIu64, event, value_cycles);
}
-enum bt_clock_value_status bt_event_borrow_default_clock_value_const(
+enum bt_clock_snapshot_status bt_event_borrow_default_clock_snapshot_const(
const struct bt_event *event,
- const struct bt_clock_value **clock_value)
+ const struct bt_clock_snapshot **clock_snapshot)
{
BT_ASSERT_PRE_NON_NULL(event, "Event");
- BT_ASSERT_PRE_NON_NULL(clock_value, "Clock value (output)");
- *clock_value = event->default_cv;
- return BT_CLOCK_VALUE_STATUS_KNOWN;
+ BT_ASSERT_PRE_NON_NULL(clock_snapshot, "Clock snapshot (output)");
+ *clock_snapshot = event->default_cs;
+ return BT_CLOCK_SNAPSHOT_STATUS_KNOWN;
}
struct bt_packet *bt_event_borrow_packet(struct bt_event *event)
#include <babeltrace/trace-ir/stream-class.h>
#include <babeltrace/trace-ir/stream.h>
#include <babeltrace/trace-ir/stream-internal.h>
-#include <babeltrace/trace-ir/clock-value-internal.h>
+#include <babeltrace/trace-ir/clock-snapshot-internal.h>
#include <babeltrace/trace-ir/trace-internal.h>
#include <babeltrace/object-internal.h>
#include <babeltrace/assert-internal.h>
bt_field_reset(packet->context_field->field);
}
- if (packet->default_beginning_cv) {
- bt_clock_value_reset(packet->default_beginning_cv);
+ if (packet->default_beginning_cs) {
+ bt_clock_snapshot_reset(packet->default_beginning_cs);
}
- if (packet->default_end_cv) {
- bt_clock_value_reset(packet->default_end_cv);
+ if (packet->default_end_cs) {
+ bt_clock_snapshot_reset(packet->default_end_cs);
}
reset_counter_snapshots(packet);
packet->context_field = NULL;
}
- if (packet->default_beginning_cv) {
- BT_LOGD_STR("Recycling beginning clock value.");
- bt_clock_value_recycle(packet->default_beginning_cv);
- packet->default_beginning_cv = NULL;
+ if (packet->default_beginning_cs) {
+ BT_LOGD_STR("Recycling beginning clock snapshot.");
+ bt_clock_snapshot_recycle(packet->default_beginning_cs);
+ packet->default_beginning_cs = NULL;
}
- if (packet->default_end_cv) {
- BT_LOGD_STR("Recycling end clock value.");
- bt_clock_value_recycle(packet->default_end_cv);
- packet->default_end_cv = NULL;
+ if (packet->default_end_cs) {
+ BT_LOGD_STR("Recycling end clock snapshot.");
+ bt_clock_snapshot_recycle(packet->default_end_cs);
+ packet->default_end_cs = NULL;
}
BT_LOGD_STR("Putting packet's stream.");
}
if (stream->class->default_clock_class) {
- if (stream->class->packets_have_default_beginning_cv) {
- packet->default_beginning_cv = bt_clock_value_create(
+ if (stream->class->packets_have_default_beginning_cs) {
+ packet->default_beginning_cs = bt_clock_snapshot_create(
stream->class->default_clock_class);
- if (!packet->default_beginning_cv) {
- /* bt_clock_value_create() logs errors */
+ if (!packet->default_beginning_cs) {
+ /* bt_clock_snapshot_create() logs errors */
goto error;
}
}
- if (stream->class->packets_have_default_end_cv) {
- packet->default_end_cv = bt_clock_value_create(
+ if (stream->class->packets_have_default_end_cs) {
+ packet->default_end_cs = bt_clock_snapshot_create(
stream->class->default_clock_class);
- if (!packet->default_end_cv) {
- /* bt_clock_value_create() logs errors */
+ if (!packet->default_end_cs) {
+ /* bt_clock_snapshot_create() logs errors */
goto error;
}
}
return 0;
}
-void bt_packet_set_default_beginning_clock_value(struct bt_packet *packet,
+void bt_packet_set_default_beginning_clock_snapshot(struct bt_packet *packet,
uint64_t value_cycles)
{
struct bt_stream_class *sc;
BT_ASSERT_PRE(sc->default_clock_class,
"Packet's stream class has no default clock class: "
"%![packet-]+a, %![sc-]+S", packet, sc);
- BT_ASSERT_PRE(sc->packets_have_default_beginning_cv,
+ BT_ASSERT_PRE(sc->packets_have_default_beginning_cs,
"Packet's stream class indicates that its packets have "
- "no default beginning clock value: %![packet-]+a, %![sc-]+S",
+ "no default beginning clock snapshot: %![packet-]+a, %![sc-]+S",
packet, sc);
- BT_ASSERT(packet->default_beginning_cv);
- bt_clock_value_set_value_inline(packet->default_beginning_cv,
+ BT_ASSERT(packet->default_beginning_cs);
+ bt_clock_snapshot_set_value_inline(packet->default_beginning_cs,
value_cycles);
- BT_LIB_LOGV("Set packet's default beginning clock value: "
+ BT_LIB_LOGV("Set packet's default beginning clock snapshot: "
"%![packet-]+a, value=%" PRIu64, packet, value_cycles);
}
-enum bt_clock_value_status bt_packet_borrow_default_beginning_clock_value(
+enum bt_clock_snapshot_status bt_packet_borrow_default_beginning_clock_snapshot(
const struct bt_packet *packet,
- const struct bt_clock_value **clock_value)
+ const struct bt_clock_snapshot **clock_snapshot)
{
BT_ASSERT_PRE_NON_NULL(packet, "Packet");
- BT_ASSERT_PRE_NON_NULL(clock_value, "Clock value (output)");
- *clock_value = packet->default_beginning_cv;
- return BT_CLOCK_VALUE_STATUS_KNOWN;
+ BT_ASSERT_PRE_NON_NULL(clock_snapshot, "Clock snapshot (output)");
+ *clock_snapshot = packet->default_beginning_cs;
+ return BT_CLOCK_SNAPSHOT_STATUS_KNOWN;
}
-void bt_packet_set_default_end_clock_value(struct bt_packet *packet,
+void bt_packet_set_default_end_clock_snapshot(struct bt_packet *packet,
uint64_t value_cycles)
{
struct bt_stream_class *sc;
BT_ASSERT_PRE(sc->default_clock_class,
"Packet's stream class has no default clock class: "
"%![packet-]+a, %![sc-]+S", packet, sc);
- BT_ASSERT_PRE(sc->packets_have_default_end_cv,
+ BT_ASSERT_PRE(sc->packets_have_default_end_cs,
"Packet's stream class indicates that its packets have "
- "no default end clock value: %![packet-]+a, %![sc-]+S",
+ "no default end clock snapshot: %![packet-]+a, %![sc-]+S",
packet, sc);
- BT_ASSERT(packet->default_end_cv);
- bt_clock_value_set_value_inline(packet->default_end_cv, value_cycles);
- BT_LIB_LOGV("Set packet's default end clock value: "
+ BT_ASSERT(packet->default_end_cs);
+ bt_clock_snapshot_set_value_inline(packet->default_end_cs, value_cycles);
+ BT_LIB_LOGV("Set packet's default end clock snapshot: "
"%![packet-]+a, value=%" PRIu64, packet, value_cycles);
}
-enum bt_clock_value_status bt_packet_borrow_default_end_clock_value(
+enum bt_clock_snapshot_status bt_packet_borrow_default_end_clock_snapshot(
const struct bt_packet *packet,
- const struct bt_clock_value **clock_value)
+ const struct bt_clock_snapshot **clock_snapshot)
{
BT_ASSERT_PRE_NON_NULL(packet, "Packet");
- BT_ASSERT_PRE_NON_NULL(clock_value, "Clock value (output)");
- *clock_value = packet->default_end_cv;
- return BT_CLOCK_VALUE_STATUS_KNOWN;
+ BT_ASSERT_PRE_NON_NULL(clock_snapshot, "Clock snapshot (output)");
+ *clock_snapshot = packet->default_end_cs;
+ return BT_CLOCK_SNAPSHOT_STATUS_KNOWN;
}
enum bt_property_availability bt_packet_get_discarded_event_counter_snapshot(
"%!+S", stream_class);
}
-bt_bool bt_stream_class_packets_have_default_beginning_clock_value(
+bt_bool bt_stream_class_packets_have_default_beginning_clock_snapshot(
const struct bt_stream_class *stream_class)
{
BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
- return (bt_bool) stream_class->packets_have_default_beginning_cv;
+ return (bt_bool) stream_class->packets_have_default_beginning_cs;
}
-void bt_stream_class_set_packets_have_default_beginning_clock_value(
+void bt_stream_class_set_packets_have_default_beginning_clock_snapshot(
struct bt_stream_class *stream_class,
bt_bool value)
{
BT_ASSERT_PRE(!value || stream_class->default_clock_class,
"Stream class does not have a default clock class: %!+S",
stream_class);
- stream_class->packets_have_default_beginning_cv = (bool) value;
+ stream_class->packets_have_default_beginning_cs = (bool) value;
BT_LIB_LOGV("Set stream class's "
- "\"packets have default beginning clock value\" property: "
+ "\"packets have default beginning clock snapshot\" property: "
"%!+S", stream_class);
}
-bt_bool bt_stream_class_packets_have_default_end_clock_value(
+bt_bool bt_stream_class_packets_have_default_end_clock_snapshot(
const struct bt_stream_class *stream_class)
{
BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
- return (bt_bool) stream_class->packets_have_default_end_cv;
+ return (bt_bool) stream_class->packets_have_default_end_cs;
}
-void bt_stream_class_set_packets_have_default_end_clock_value(
+void bt_stream_class_set_packets_have_default_end_clock_snapshot(
struct bt_stream_class *stream_class,
bt_bool value)
{
BT_ASSERT_PRE(!value || stream_class->default_clock_class,
"Stream class does not have a default clock class: %!+S",
stream_class);
- stream_class->packets_have_default_end_cv = (bool) value;
+ stream_class->packets_have_default_end_cs = (bool) value;
BT_LIB_LOGV("Set stream class's "
- "\"packets have default end clock value\" property: "
+ "\"packets have default end clock snapshot\" property: "
"%!+S", stream_class);
}
bt_bool bt_stream_class_default_clock_is_always_known(
const struct bt_stream_class *stream_class)
{
- /* BT_CLOCK_VALUE_STATUS_UNKNOWN is not supported as of 2.0 */
+ /* BT_CLOCK_SNAPSHOT_STATUS_UNKNOWN is not supported as of 2.0 */
return BT_TRUE;
}
"timestamp_begin");
if (int_fc) {
if (int_fc->meaning == CTF_FIELD_CLASS_MEANING_PACKET_BEGINNING_TIME) {
- bt_stream_class_set_packets_have_default_beginning_clock_value(
+ bt_stream_class_set_packets_have_default_beginning_clock_snapshot(
ir_sc, BT_TRUE);
}
}
"timestamp_end");
if (int_fc) {
if (int_fc->meaning == CTF_FIELD_CLASS_MEANING_PACKET_END_TIME) {
- bt_stream_class_set_packets_have_default_end_clock_value(
+ bt_stream_class_set_packets_have_default_end_clock_snapshot(
ir_sc, BT_TRUE);
}
}
off_t cur_packet_offset;
/* Default clock's current value */
- uint64_t default_clock_val;
+ uint64_t default_clock_snapshot;
/* End of packet snapshots */
struct {
* current value directly.
*/
if (new_val_size == 64) {
- notit->default_clock_val = new_val;
+ notit->default_clock_snapshot = new_val;
goto end;
}
new_val_mask = (1ULL << new_val_size) - 1;
- cur_value_masked = notit->default_clock_val & new_val_mask;
+ cur_value_masked = notit->default_clock_snapshot & new_val_mask;
if (new_val < cur_value_masked) {
/*
* of the requested new value. Assume that the clock
* value wrapped only one time.
*/
- notit->default_clock_val += new_val_mask + 1;
+ notit->default_clock_snapshot += new_val_mask + 1;
}
/* Clear the low bits of the current clock value. */
- notit->default_clock_val &= ~new_val_mask;
+ notit->default_clock_snapshot &= ~new_val_mask;
/* Set the low bits of the current clock value. */
- notit->default_clock_val |= new_val;
+ notit->default_clock_snapshot |= new_val;
end:
BT_LOGV("Updated default clock's value from integer field's value: "
- "value=%" PRIu64, notit->default_clock_val);
+ "value=%" PRIu64, notit->default_clock_snapshot);
}
static
}
static
-void set_event_default_clock_value(struct bt_msg_iter *notit)
+void set_event_default_clock_snapshot(struct bt_msg_iter *notit)
{
bt_event *event =
bt_message_event_borrow_event(
BT_ASSERT(event);
if (bt_stream_class_borrow_default_clock_class(sc)) {
- bt_event_set_default_clock_value(event,
- notit->default_clock_val);
+ bt_event_set_default_clock_snapshot(event,
+ notit->default_clock_snapshot);
}
}
notit->packet, notit->snapshots.packets);
}
- if (bt_stream_class_packets_have_default_beginning_clock_value(sc)) {
+ if (bt_stream_class_packets_have_default_beginning_clock_snapshot(sc)) {
BT_ASSERT(notit->snapshots.beginning_clock != UINT64_C(-1));
- bt_packet_set_default_beginning_clock_value(
+ bt_packet_set_default_beginning_clock_snapshot(
notit->packet, notit->snapshots.beginning_clock);
}
- if (bt_stream_class_packets_have_default_end_clock_value(sc)) {
+ if (bt_stream_class_packets_have_default_end_clock_snapshot(sc)) {
BT_ASSERT(notit->snapshots.end_clock != UINT64_C(-1));
- bt_packet_set_default_end_clock_value(
+ bt_packet_set_default_end_clock_snapshot(
notit->packet, notit->snapshots.end_clock);
}
/* Update default clock from packet's end time */
if (notit->snapshots.end_clock != UINT64_C(-1)) {
- notit->default_clock_val = notit->snapshots.end_clock;
+ notit->default_clock_snapshot = notit->snapshots.end_clock;
}
BT_ASSERT(notit->msg_iter);
goto end;
case STATE_EMIT_MSG_EVENT:
BT_ASSERT(notit->event_msg);
- set_event_default_clock_value(notit);
+ set_event_default_clock_snapshot(notit);
*message = notit->event_msg;
notit->event_msg = NULL;
goto end;
BT_LTTNG_LIVE_ITERATOR_STATUS_OK;
struct lttng_live_trace *trace;
const bt_clock_class *clock_class = NULL;
- bt_clock_value *clock_value = NULL;
+ bt_clock_snapshot *clock_snapshot = NULL;
const bt_message *msg = NULL;
int retval;
if (!clock_class) {
goto error;
}
- clock_value = bt_clock_value_create(clock_class, timestamp);
- if (!clock_value) {
+ clock_snapshot = bt_clock_snapshot_create(clock_class, timestamp);
+ if (!clock_snapshot) {
goto error;
}
msg = bt_message_inactivity_create(trace->cc_prio_map);
if (!msg) {
goto error;
}
- retval = bt_message_inactivity_set_clock_value(msg, clock_value);
+ retval = bt_message_inactivity_set_clock_snapshot(msg, clock_snapshot);
if (retval) {
goto error;
}
*message = msg;
end:
- bt_object_put_ref(clock_value);
+ bt_object_put_ref(clock_snapshot);
bt_clock_class_put_ref(clock_class);
return ret;
enum bt_lttng_live_iterator_status ret =
BT_LTTNG_LIVE_ITERATOR_STATUS_OK;
const bt_clock_class *clock_class = NULL;
- bt_clock_value *clock_value = NULL;
+ bt_clock_snapshot *clock_snapshot = NULL;
if (lttng_live_stream->state != LTTNG_LIVE_STREAM_QUIESCENT) {
return BT_LTTNG_LIVE_ITERATOR_STATUS_OK;
lttng_live_stream->last_returned_inactivity_timestamp =
lttng_live_stream->current_inactivity_timestamp;
end:
- bt_object_put_ref(clock_value);
+ bt_object_put_ref(clock_snapshot);
bt_clock_class_put_ref(clock_class);
return ret;
}
const bt_field *copy_field)
{
const bt_clock_class *clock_class = NULL, *writer_clock_class = NULL;
- bt_clock_value *clock_value = NULL, *writer_clock_value = NULL;
+ bt_clock_snapshot *clock_snapshot = NULL, *writer_clock_snapshot = NULL;
uint64_t value;
int ret;
return set_int_value(err, field, copy_field, type);
}
- clock_value = bt_event_get_clock_value(event, clock_class);
+ clock_snapshot = bt_event_get_clock_snapshot(event, clock_class);
BT_CLOCK_CLASS_PUT_REF_AND_RESET(clock_class);
- BT_ASSERT(clock_value);
+ BT_ASSERT(clock_snapshot);
- ret = bt_clock_value_get_value(clock_value, &value);
- BT_OBJECT_PUT_REF_AND_RESET(clock_value);
+ ret = bt_clock_snapshot_get_value(clock_snapshot, &value);
+ BT_OBJECT_PUT_REF_AND_RESET(clock_snapshot);
if (ret) {
BT_LOGE("Failed to get clock value.");
goto error;
writer_clock_class = event_get_clock_class(err, writer_event);
BT_ASSERT(writer_clock_class);
- writer_clock_value = bt_clock_value_create(writer_clock_class, value);
+ writer_clock_snapshot = bt_clock_snapshot_create(writer_clock_class, value);
BT_CLOCK_CLASS_PUT_REF_AND_RESET(writer_clock_class);
- if (!writer_clock_value) {
+ if (!writer_clock_snapshot) {
BT_LOGE_STR("Failed to create clock value.");
goto error;
}
- ret = bt_event_set_clock_value(writer_event, writer_clock_value);
- BT_OBJECT_PUT_REF_AND_RESET(writer_clock_value);
+ ret = bt_event_set_clock_snapshot(writer_event, writer_clock_snapshot);
+ BT_OBJECT_PUT_REF_AND_RESET(writer_clock_snapshot);
if (ret) {
BT_LOGE_STR("Failed to set clock value.");
goto error;
const bt_field *event_header)
{
const bt_clock_class *clock_class = NULL, *writer_clock_class = NULL;
- bt_clock_value *clock_value = NULL, *writer_clock_value = NULL;
+ bt_clock_snapshot *clock_snapshot = NULL, *writer_clock_snapshot = NULL;
int ret;
const bt_field *writer_event_header = NULL;
goto error;
}
- clock_value = bt_event_get_clock_value(event, clock_class);
+ clock_snapshot = bt_event_get_clock_snapshot(event, clock_class);
BT_CLOCK_CLASS_PUT_REF_AND_RESET(clock_class);
- BT_ASSERT(clock_value);
+ BT_ASSERT(clock_snapshot);
- ret = bt_clock_value_get_value(clock_value, &value);
- BT_OBJECT_PUT_REF_AND_RESET(clock_value);
+ ret = bt_clock_snapshot_get_value(clock_snapshot, &value);
+ BT_OBJECT_PUT_REF_AND_RESET(clock_snapshot);
if (ret) {
BT_LOGE_STR("Failed to get clock value.");
goto error;
goto error;
}
- writer_clock_value = bt_clock_value_create(writer_clock_class, value);
+ writer_clock_snapshot = bt_clock_snapshot_create(writer_clock_class, value);
BT_CLOCK_CLASS_PUT_REF_AND_RESET(writer_clock_class);
- if (!writer_clock_value) {
+ if (!writer_clock_snapshot) {
BT_LOGE_STR("Failed to create clock value.");
goto error;
}
- ret = bt_event_set_clock_value(writer_event, writer_clock_value);
- BT_OBJECT_PUT_REF_AND_RESET(writer_clock_value);
+ ret = bt_event_set_clock_snapshot(writer_event, writer_clock_snapshot);
+ BT_OBJECT_PUT_REF_AND_RESET(writer_clock_snapshot);
if (ret) {
BT_LOGE_STR("Failed to set clock value.");
goto error;
}
static
-int set_event_clock_value(FILE *err, const bt_event *event,
+int set_event_clock_snapshot(FILE *err, const bt_event *event,
const bt_event *writer_event)
{
const bt_clock_class *clock_class = NULL;
- bt_clock_value *clock_value = NULL;
+ bt_clock_snapshot *clock_snapshot = NULL;
int ret = 0;
clock_class = event_get_clock_class(err, event);
goto end;
}
- clock_value = bt_event_get_clock_value(event, clock_class);
- if (!clock_value) {
+ clock_snapshot = bt_event_get_clock_snapshot(event, clock_class);
+ if (!clock_snapshot) {
ret = 0;
goto end;
}
* We share the same clocks, so we can assign the clock value to the
* writer event.
*/
- ret = bt_event_set_clock_value(writer_event, clock_value);
+ ret = bt_event_set_clock_snapshot(writer_event, clock_snapshot);
if (ret) {
BT_LOGE_STR("Failed to set clock value.");
goto error;
ret = -1;
end:
bt_clock_class_put_ref(clock_class);
- bt_object_put_ref(clock_value);
+ bt_object_put_ref(clock_snapshot);
return ret;
}
goto error;
}
- ret = set_event_clock_value(err, event, writer_event);
+ ret = set_event_clock_snapshot(err, event, writer_event);
if (ret) {
BT_LOGE_STR("Failed to set clock value.");
goto error;
BT_ASSERT(event);
if (dmesg_comp->clock_class) {
- bt_event_set_default_clock_value(event, ts);
+ bt_event_set_default_clock_snapshot(event, ts);
}
goto end;
struct timestamp {
int64_t real_timestamp; /* Relative to UNIX epoch. */
- uint64_t clock_value; /* In cycles. */
+ uint64_t clock_snapshot; /* In cycles. */
};
static
void print_timestamp_cycles(struct pretty_component *pretty,
const bt_event *event)
{
- const bt_clock_value *clock_value;
+ const bt_clock_snapshot *clock_snapshot;
uint64_t cycles;
- enum bt_clock_value_status cv_status;
+ enum bt_clock_snapshot_status cv_status;
- cv_status = bt_event_borrow_default_clock_value_const(event, &clock_value);
- if (cv_status != BT_CLOCK_VALUE_STATUS_KNOWN || !clock_value) {
+ cv_status = bt_event_borrow_default_clock_snapshot_const(event, &clock_snapshot);
+ if (cv_status != BT_CLOCK_SNAPSHOT_STATUS_KNOWN || !clock_snapshot) {
g_string_append(pretty->string, "????????????????????");
return;
}
- cycles = bt_clock_value_get_value(clock_value);
+ cycles = bt_clock_snapshot_get_value(clock_snapshot);
g_string_append_printf(pretty->string, "%020" PRIu64, cycles);
if (pretty->last_cycles_timestamp != -1ULL) {
static
void print_timestamp_wall(struct pretty_component *pretty,
- const bt_clock_value *clock_value)
+ const bt_clock_snapshot *clock_snapshot)
{
int ret;
int64_t ts_nsec = 0; /* add configurable offset */
uint64_t ts_sec_abs, ts_nsec_abs;
bool is_negative;
- if (!clock_value) {
+ if (!clock_snapshot) {
g_string_append(pretty->string, "??:??:??.?????????");
return;
}
- ret = bt_clock_value_get_ns_from_origin(clock_value, &ts_nsec);
+ ret = bt_clock_snapshot_get_ns_from_origin(clock_snapshot, &ts_nsec);
if (ret) {
// TODO: log, this is unexpected
g_string_append(pretty->string, "Error");
int ret = 0;
const bt_stream *stream = NULL;
const bt_stream_class *stream_class = NULL;
- const bt_clock_value *clock_value = NULL;
- enum bt_clock_value_status cv_status;
+ const bt_clock_snapshot *clock_snapshot = NULL;
+ enum bt_clock_snapshot_status cv_status;
stream = bt_event_borrow_stream_const(event);
if (!stream) {
goto end;
}
- cv_status = bt_event_borrow_default_clock_value_const(event,
- &clock_value);
- if (cv_status != BT_CLOCK_VALUE_STATUS_KNOWN || !clock_value) {
+ cv_status = bt_event_borrow_default_clock_snapshot_const(event,
+ &clock_snapshot);
+ if (cv_status != BT_CLOCK_SNAPSHOT_STATUS_KNOWN || !clock_snapshot) {
/* No default clock value: skip the timestamp without an error */
goto end;
}
if (pretty->options.print_timestamp_cycles) {
print_timestamp_cycles(pretty, event);
} else {
- clock_value = NULL;
- cv_status = bt_event_borrow_default_clock_value_const(event,
- &clock_value);
- print_timestamp_wall(pretty, clock_value);
+ clock_snapshot = NULL;
+ cv_status = bt_event_borrow_default_clock_snapshot_const(event,
+ &clock_snapshot);
+ print_timestamp_wall(pretty, clock_snapshot);
}
if (pretty->use_colors) {
g_string_append(pretty->string, COLOR_RST);
const unsigned char *trace_uuid;
int64_t stream_class_id;
int64_t stream_id;
- bt_clock_value *begin_clock_value = NULL;
- bt_clock_value *end_clock_value = NULL;
+ bt_clock_snapshot *begin_clock_snapshot = NULL;
+ bt_clock_snapshot *end_clock_snapshot = NULL;
/* Stream name */
BT_ASSERT(packet);
trace_uuid = bt_trace_get_uuid(trace);
/* Beginning and end times */
- (void) bt_packet_borrow_previous_packet_default_end_clock_value_const(
- packet, &begin_clock_value);
- (void) bt_packet_borrow_default_end_clock_value_const(packet,
- &end_clock_value);
+ (void) bt_packet_borrow_previous_packet_default_end_clock_snapshot_const(
+ packet, &begin_clock_snapshot);
+ (void) bt_packet_borrow_default_end_clock_snapshot_const(packet,
+ &end_clock_snapshot);
/* Format message */
g_string_assign(pretty->string, "");
bt_common_color_fg_yellow(),
count, elem_type, count == 1 ? "" : "s");
- if (begin_clock_value && end_clock_value) {
+ if (begin_clock_snapshot && end_clock_snapshot) {
g_string_append(pretty->string, "between [");
- print_timestamp_wall(pretty, begin_clock_value);
+ print_timestamp_wall(pretty, begin_clock_snapshot);
g_string_append(pretty->string, "] and [");
- print_timestamp_wall(pretty, end_clock_value);
+ print_timestamp_wall(pretty, end_clock_snapshot);
g_string_append(pretty->string, "]");
} else {
g_string_append(pretty->string, "(unknown time range)");
int64_t *ts_ns)
{
const bt_clock_class *clock_class = NULL;
- const bt_clock_value *clock_value = NULL;
+ const bt_clock_snapshot *clock_snapshot = NULL;
const bt_event *event = NULL;
int ret = 0;
const unsigned char *cc_uuid;
const char *cc_name;
- enum bt_clock_value_status cv_status = BT_CLOCK_VALUE_STATUS_KNOWN;
+ enum bt_clock_snapshot_status cv_status = BT_CLOCK_SNAPSHOT_STATUS_KNOWN;
BT_ASSERT(msg);
BT_ASSERT(ts_ns);
case BT_MESSAGE_TYPE_EVENT:
event = bt_message_event_borrow_event_const(msg);
BT_ASSERT(event);
- cv_status = bt_event_borrow_default_clock_value_const(event,
- &clock_value);
+ cv_status = bt_event_borrow_default_clock_snapshot_const(event,
+ &clock_snapshot);
break;
case BT_MESSAGE_TYPE_INACTIVITY:
- clock_value =
- bt_message_inactivity_borrow_default_clock_value_const(
+ clock_snapshot =
+ bt_message_inactivity_borrow_default_clock_snapshot_const(
msg);
break;
default:
goto end;
}
- if (cv_status != BT_CLOCK_VALUE_STATUS_KNOWN) {
- BT_LOGE_STR("Unsupported unknown clock value.");
+ if (cv_status != BT_CLOCK_SNAPSHOT_STATUS_KNOWN) {
+ BT_LOGE_STR("Unsupported unknown clock snapshot.");
ret = -1;
goto end;
}
/*
- * If the clock value is missing, then we consider that this
+ * If the clock snapshot is missing, then we consider that this
* message has no time. In this case it's always the
* youngest.
*/
- if (!clock_value) {
- BT_LOGV_STR("Message's default clock value is missing: "
+ if (!clock_snapshot) {
+ BT_LOGV_STR("Message's default clock snapshot is missing: "
"using the last returned timestamp.");
*ts_ns = last_returned_ts_ns;
goto end;
}
- clock_class = bt_clock_value_borrow_clock_class_const(clock_value);
+ clock_class = bt_clock_snapshot_borrow_clock_class_const(clock_snapshot);
BT_ASSERT(clock_class);
cc_uuid = bt_clock_class_get_uuid(clock_class);
cc_name = bt_clock_class_get_name(clock_class);
}
}
- ret = bt_clock_value_get_ns_from_origin(clock_value, ts_ns);
+ ret = bt_clock_snapshot_get_ns_from_origin(clock_snapshot, ts_ns);
if (ret) {
- BT_LOGE("Cannot get nanoseconds from Epoch of clock value: "
- "clock-value-addr=%p", clock_value);
+ BT_LOGE("Cannot get nanoseconds from Epoch of clock snapshot: "
+ "clock-snapshot-addr=%p", clock_snapshot);
goto error;
}
const bt_trace *trace = NULL;
const bt_stream *stream = NULL;
const bt_stream_class *stream_class = NULL;
- bt_clock_value *clock_value = NULL;
+ bt_clock_snapshot *clock_snapshot = NULL;
bool lazy_update = false;
const bt_message *new_message = NULL;
bt_clock_class_priority_map *cc_prio_map;
goto end;
}
- clock_value = bt_event_get_clock_value(event, clock_class);
- if (!clock_value) {
+ clock_snapshot = bt_event_get_clock_snapshot(event, clock_class);
+ if (!clock_snapshot) {
BT_LOGE_STR("Failed to retrieve clock value.");
goto error;
}
- clock_ret = bt_clock_value_get_value_ns_from_epoch(
- clock_value, &ts);
+ clock_ret = bt_clock_snapshot_get_value_ns_from_epoch(
+ clock_snapshot, &ts);
if (clock_ret) {
BT_LOGE_STR("Failed to retrieve clock value timestamp.");
goto error;
bt_trace_put_ref(trace);
bt_stream_put_ref(stream);
bt_stream_class_put_ref(stream_class);
- bt_object_put_ref(clock_value);
+ bt_object_put_ref(clock_snapshot);
*_event_in_range = in_range;
return new_message;
}
{
int ret = 0;
int is_signed;
- uint64_t raw_clock_value;
+ uint64_t raw_clock_snapshot;
const bt_field_class *integer_class = NULL;
const bt_clock_class *clock_class = NULL;
- bt_clock_value *clock_value = NULL;
+ bt_clock_snapshot *clock_snapshot = NULL;
integer_class = bt_field_get_class(integer);
BT_ASSERT(integer_class);
is_signed = bt_field_class_integer_is_signed(integer_class);
if (!is_signed) {
ret = bt_field_unsigned_integer_get_value(integer,
- &raw_clock_value);
+ &raw_clock_snapshot);
if (ret) {
goto end;
}
goto end;
}
- clock_value = bt_clock_value_create(clock_class, raw_clock_value);
- if (!clock_value) {
+ clock_snapshot = bt_clock_snapshot_create(clock_class, raw_clock_snapshot);
+ if (!clock_snapshot) {
goto end;
}
- ret = bt_clock_value_get_value_ns_from_epoch(clock_value, ns);
+ ret = bt_clock_snapshot_get_value_ns_from_epoch(clock_snapshot, ns);
end:
bt_field_class_put_ref(integer_class);
bt_clock_class_put_ref(clock_class);
- bt_object_put_ref(clock_value);
+ bt_object_put_ref(clock_snapshot);
return ret;
}