lib: rename "clock value" -> "clock snapshot"
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 8 Dec 2018 18:46:17 +0000 (13:46 -0500)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 2 May 2019 20:50:15 +0000 (20:50 +0000)
This is more consistent with the current counter snapshots in the packet
API.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
49 files changed:
include/Makefile.am
include/babeltrace/babeltrace.h
include/babeltrace/graph/message-inactivity-const.h
include/babeltrace/graph/message-inactivity-internal.h
include/babeltrace/graph/message-inactivity.h
include/babeltrace/graph/message-stream-const.h
include/babeltrace/graph/message-stream-internal.h
include/babeltrace/graph/message-stream.h
include/babeltrace/lib-logging-internal.h
include/babeltrace/trace-ir/clock-class-internal.h
include/babeltrace/trace-ir/clock-snapshot-const.h [new file with mode: 0644]
include/babeltrace/trace-ir/clock-snapshot-internal.h [new file with mode: 0644]
include/babeltrace/trace-ir/clock-snapshot-set-internal.h [new file with mode: 0644]
include/babeltrace/trace-ir/clock-value-const.h [deleted file]
include/babeltrace/trace-ir/clock-value-internal.h [deleted file]
include/babeltrace/trace-ir/clock-value-set-internal.h [deleted file]
include/babeltrace/trace-ir/event-const.h
include/babeltrace/trace-ir/event-internal.h
include/babeltrace/trace-ir/event.h
include/babeltrace/trace-ir/packet-const.h
include/babeltrace/trace-ir/packet-internal.h
include/babeltrace/trace-ir/packet.h
include/babeltrace/trace-ir/stream-class-const.h
include/babeltrace/trace-ir/stream-class-internal.h
include/babeltrace/trace-ir/stream-class.h
include/babeltrace/types.h
lib/graph/message/discarded-events.c
lib/graph/message/discarded-packets.c
lib/graph/message/inactivity.c
lib/graph/message/stream.c
lib/lib-logging.c
lib/trace-ir/Makefile.am
lib/trace-ir/clock-class.c
lib/trace-ir/clock-snapshot.c [new file with mode: 0644]
lib/trace-ir/clock-value.c [deleted file]
lib/trace-ir/event-class.c
lib/trace-ir/event.c
lib/trace-ir/packet.c
lib/trace-ir/stream-class.c
plugins/ctf/common/metadata/ctf-meta-translate.c
plugins/ctf/common/msg-iter/msg-iter.c
plugins/ctf/lttng-live/lttng-live.c
plugins/libctfcopytrace/clock-fields.c
plugins/libctfcopytrace/ctfcopytrace.c
plugins/lttng-utils/copy.c
plugins/text/dmesg/dmesg.c
plugins/text/pretty/print.c
plugins/utils/muxer/muxer.c
plugins/utils/trimmer/iterator.c

index 0edf60da0b8d2b928b9babcaade5fa0475afff9f..96d41927aef9a5716f6bed4226a0ca0247fab4d1 100644 (file)
@@ -119,7 +119,7 @@ babeltracetraceirincludedir = "$(includedir)/babeltrace/trace-ir"
 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 \
@@ -244,8 +244,8 @@ noinst_HEADERS = \
        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 \
index 01b220d1bb3dad0847a8b6ff050ac192162325e2..10595c2919f48e93f888fc0b96d85980d65dd290 100644 (file)
@@ -65,7 +65,7 @@
 /* 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>
index 7aab72baeaca2996b8115f9e7ec5789baf829380..9c1a825ba6aee5a2cdabdf7d3b0d87203961565e 100644 (file)
  * 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
index b0523cadf2d4f2bc9209be1d6f5098c37bf9c5af..5ac0f55e3f27eecbd14b31a0ef9164fd059f9264 100644 (file)
  */
 
 #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 */
index 8425d57b6d2188f2ca538285945ef0aa29e54968..f958eb668a73456c7b81a425aeca0842d90371eb 100644 (file)
@@ -37,7 +37,7 @@ bt_message *bt_message_inactivity_create(
                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
index 9c050e9193e44c0e2166bcbfbb3916fd902989c7..f1c2c2ec8ee46bb7921baa5a3b88e204805421a0 100644 (file)
@@ -24,7 +24,7 @@
  * SOFTWARE.
  */
 
-/* For bt_message, bt_clock_value, bt_stream */
+/* For bt_message, bt_clock_snapshot, bt_stream */
 #include <babeltrace/types.h>
 
 #ifdef __cplusplus
@@ -34,15 +34,15 @@ extern "C" {
 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
index b9601b4ff1ea184452fe5d250cfcfd1d082db1ad..3752c109e44acb25aaf36d97feaf430c309a6503 100644 (file)
 #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 */
index f025396e742c50cb522bcc221305eb7d763a810d..e810a6616a554a4bc9f29b288c4655af380439a2 100644 (file)
@@ -44,13 +44,13 @@ bt_message *bt_message_stream_end_create(
 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
index 5c3fad42a88e585f4ccbd19d497f663ade88ca27..74d1cc0952d84dac6940459fc6e4df80bf6a8232 100644 (file)
@@ -115,7 +115,7 @@ int bt_lib_log_level;
  *       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 *`.
index a2fcc303367a2c584f8e0784191bd91ba5ecde4a..236d70b41699260d1d6654f478ed2a197b1a20c6 100644 (file)
@@ -73,7 +73,7 @@ struct bt_clock_class {
         * 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
@@ -84,8 +84,8 @@ struct bt_clock_class {
                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;
 };
diff --git a/include/babeltrace/trace-ir/clock-snapshot-const.h b/include/babeltrace/trace-ir/clock-snapshot-const.h
new file mode 100644 (file)
index 0000000..e0b0e39
--- /dev/null
@@ -0,0 +1,58 @@
+#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 */
diff --git a/include/babeltrace/trace-ir/clock-snapshot-internal.h b/include/babeltrace/trace-ir/clock-snapshot-internal.h
new file mode 100644 (file)
index 0000000..3ba604e
--- /dev/null
@@ -0,0 +1,102 @@
+#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 */
diff --git a/include/babeltrace/trace-ir/clock-snapshot-set-internal.h b/include/babeltrace/trace-ir/clock-snapshot-set-internal.h
new file mode 100644 (file)
index 0000000..69412ca
--- /dev/null
@@ -0,0 +1,159 @@
+#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 */
diff --git a/include/babeltrace/trace-ir/clock-value-const.h b/include/babeltrace/trace-ir/clock-value-const.h
deleted file mode 100644 (file)
index 53ed627..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#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 */
diff --git a/include/babeltrace/trace-ir/clock-value-internal.h b/include/babeltrace/trace-ir/clock-value-internal.h
deleted file mode 100644 (file)
index b397904..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-#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 */
diff --git a/include/babeltrace/trace-ir/clock-value-set-internal.h b/include/babeltrace/trace-ir/clock-value-set-internal.h
deleted file mode 100644 (file)
index 5c7e7bd..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-#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 */
index 87877e7889ffb1b425a779c188ef49fcb1f78d17..9aa4e692f0d307f79d3b3f3c3e5aab73554ea740 100644 (file)
  * 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
@@ -58,9 +58,9 @@ extern const bt_field *bt_event_borrow_specific_context_field_const(
 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
 }
index 1753f964d53d0caa9da8137e96b3ef548872584d..8e84596ad558235f20778c727b5f44fe25fb0c5c 100644 (file)
@@ -32,7 +32,7 @@
 #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>
@@ -63,7 +63,7 @@ struct bt_event {
        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;
 };
 
@@ -128,8 +128,8 @@ void bt_event_reset(struct bt_event *event)
        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);
index 4440b14523c0fcf57fb2b9973082ead39d753647..2f432e718ccac685235678617c28756181c63fb2 100644 (file)
@@ -53,7 +53,7 @@ bt_event_borrow_specific_context_field(bt_event *event);
 
 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
index 62ee8d1ef9af96e5e0b67285836c61f5055ade42..877def8113682bda14341d0ba46142a36b2f849f 100644 (file)
 /* 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>
 
@@ -56,14 +56,14 @@ const bt_field *bt_packet_borrow_context_field_const(
                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(
index 2414a6af1bd8a512eabb85e3a129289a4c6975df..c94318165b7bbf02d8d209f348144ba20794875f 100644 (file)
@@ -25,7 +25,7 @@
 
 #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>
@@ -39,8 +39,8 @@ struct bt_packet {
        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;
index b485e9bc39db2c1fde3c456627219b8931f75897..2b1d9b06b0f2c9efef9dc093c7f546edcc806485 100644 (file)
@@ -54,11 +54,11 @@ int bt_packet_move_context_field(bt_packet *packet,
                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
index d954c05779a1e364f72e9fe28a76520a249bc082..476a40eb0e3c49829af361eddee0c337a08c484f 100644 (file)
@@ -90,10 +90,10 @@ extern bt_bool bt_stream_class_packets_have_discarded_event_counter_snapshot(
 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);
index 4d45e8e48ea1a84c80caeaf5a8a574fb8bc54d5f..dcb50b62bedf5bb6fb07cd90d2f64bc301f2b459 100644 (file)
@@ -50,8 +50,8 @@ struct bt_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;
index aec3be3432c5601843db096d0b188f67d86b7dc6..074d4584e5d9f7fe9d0e480f2495afcd637a147d 100644 (file)
@@ -94,11 +94,11 @@ bt_stream_class_set_packets_have_packet_counter_snapshot(
                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
index bf4c72d93f7a47925709283124dd2a347f0d2b55..39f3f423a6c719216b90f31a7135b64ecb7d89fe 100644 (file)
@@ -77,7 +77,7 @@ typedef int bt_bool;
 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;
index e594fe1d68d7d64bdb90d5fb1e373ddf24727a07..cb5d1a681b63a865ceea08e87f981787ae5e38e1 100644 (file)
 #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);
 }
 
index 953ba04c9c8f9133a8fd0d192755f8a1f184f66b..73ae909a1a74082f68667986c21de7af34c0c4bb 100644 (file)
 #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);
 }
 
index 0b7dff907e78b5d0845cb017ea90ac661a8d5fb8..f61f1fdcaf0bf9b698f58850856001fdc8ac3e9d 100644 (file)
@@ -27,7 +27,7 @@
 #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>
@@ -41,8 +41,8 @@ void bt_message_inactivity_destroy(struct bt_object *obj)
 
        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);
@@ -71,8 +71,8 @@ struct bt_message *bt_message_inactivity_create(
                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;
        }
 
@@ -86,7 +86,7 @@ end:
        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;
@@ -94,18 +94,18 @@ void bt_message_inactivity_set_default_clock_value(
        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;
 }
index 46039696e77a0808db23d05f91abb1252e385313..d2483b4b058b8bcda7ad3fcf7edf0c8b3501b75c 100644 (file)
@@ -46,9 +46,9 @@ void bt_message_stream_end_destroy(struct bt_object *obj)
        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);
@@ -106,7 +106,7 @@ const struct bt_stream *bt_message_stream_end_borrow_stream_const(
                (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;
@@ -119,22 +119,22 @@ void bt_message_stream_end_set_default_clock_value(
                "%![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
@@ -148,9 +148,9 @@ void bt_message_stream_beginning_destroy(struct bt_object *obj)
        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);
@@ -207,7 +207,7 @@ const struct bt_stream *bt_message_stream_beginning_borrow_stream_const(
                (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)
 {
@@ -221,20 +221,20 @@ void bt_message_stream_beginning_set_default_clock_value(
                "%![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;
 }
index d418310fbf89fe161808aac1ca7edfe99b103080..403c2a173a98107dc582fd9fc76aa722a55d5502 100644 (file)
@@ -50,7 +50,7 @@
 #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>
@@ -113,8 +113,8 @@ static inline void format_port(char **buf_ch, bool extended,
 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);
@@ -533,14 +533,14 @@ static inline void format_stream_class(char **buf_ch, bool extended,
        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);
@@ -671,16 +671,16 @@ static inline void format_packet(char **buf_ch, bool extended,
                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) {
@@ -755,10 +755,10 @@ static inline void format_event(char **buf_ch, bool extended,
                }
        }
 
-       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);
@@ -813,30 +813,30 @@ static inline void format_clock_class(char **buf_ch, bool extended,
                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);
        }
 }
 
@@ -1332,7 +1332,7 @@ static inline void handle_conversion_specifier_bt(void *priv_data,
                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);
index f51103b18fa8042926404c81e99130198e53110d..5c35796eeabebd101ac5884e5cd257ebe173c60f 100644 (file)
@@ -3,7 +3,7 @@ noinst_LTLIBRARIES = libtrace-ir.la
 libtrace_ir_la_SOURCES = \
        attributes.c \
        clock-class.c \
-       clock-value.c \
+       clock-snapshot.c \
        event.c \
        event-class.c \
        event-header-field.c \
index 45b47c1e139179b8791afebf1f49b5c213891885..a2465b41396bebe7b0e05261c32960b320b723bc 100644 (file)
@@ -27,7 +27,7 @@
 #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>
@@ -58,15 +58,15 @@ void destroy_clock_class(struct bt_object *obj)
                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
@@ -133,13 +133,13 @@ struct bt_clock_class *bt_clock_class_create(void)
        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;
        }
diff --git a/lib/trace-ir/clock-snapshot.c b/lib/trace-ir/clock-snapshot.c
new file mode 100644 (file)
index 0000000..7dcf289
--- /dev/null
@@ -0,0 +1,173 @@
+/*
+ * 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;
+}
diff --git a/lib/trace-ir/clock-value.c b/lib/trace-ir/clock-value.c
deleted file mode 100644 (file)
index 8bd2b1c..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * 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;
-}
index 0c8b9f6cda42f183ed724a2c69b84d2f80e37d52..7c09f78bf468305fce15d568124a392e9086b137 100644 (file)
@@ -25,7 +25,7 @@
 #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>
index d65d76379f37240d2bd701ab7e26cdf2bd210270..1b3a085f494fb27e2bbb3d301ea78b0c94e33a7a 100644 (file)
@@ -28,8 +28,8 @@
 #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>
@@ -177,10 +177,10 @@ struct bt_event *bt_event_new(struct bt_event_class *event_class)
        }
 
        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;
                }
        }
@@ -321,9 +321,9 @@ void bt_event_destroy(struct bt_event *event)
        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.");
@@ -331,7 +331,7 @@ void bt_event_destroy(struct bt_event *event)
        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;
@@ -343,20 +343,20 @@ void bt_event_set_default_clock_value(struct bt_event *event,
        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)
index cf320389dace89cfa34af3d61024146a636a4151..41bd4119cd24e7023ce46759e86154a7d7b4791e 100644 (file)
@@ -34,7 +34,7 @@
 #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>
@@ -130,12 +130,12 @@ void reset_packet(struct bt_packet *packet)
                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);
@@ -233,16 +233,16 @@ void bt_packet_destroy(struct bt_packet *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.");
@@ -294,20 +294,20 @@ struct bt_packet *bt_packet_new(struct bt_stream *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;
                        }
                }
@@ -401,7 +401,7 @@ int bt_packet_move_context_field(struct bt_packet *packet,
        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;
@@ -413,28 +413,28 @@ void bt_packet_set_default_beginning_clock_value(struct bt_packet *packet,
        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;
@@ -446,24 +446,24 @@ void bt_packet_set_default_end_clock_value(struct bt_packet *packet,
        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(
index b032b8ee6f2f2a704a2033d22fad80d1b2318a63..9b3dd621293df3faba890837018759434fa41ef7 100644 (file)
@@ -550,14 +550,14 @@ void bt_stream_class_set_packets_have_packet_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)
 {
@@ -566,20 +566,20 @@ void bt_stream_class_set_packets_have_default_beginning_clock_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)
 {
@@ -588,16 +588,16 @@ void bt_stream_class_set_packets_have_default_end_clock_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;
 }
 
index 54b7d9713fbf4182a91916b8b16d28dda5e7680d..516b499fa5c4ee3f886245363101ba62c84d8c52 100644 (file)
@@ -541,7 +541,7 @@ bt_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class *sc,
                "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);
                }
        }
@@ -550,7 +550,7 @@ bt_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class *sc,
                "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);
                }
        }
index 4843f275e516a5a9db5df8da00da54562c8c5ab7..8bed03784ce3503c25c61627066efda7c79219a3 100644 (file)
@@ -213,7 +213,7 @@ struct bt_msg_iter {
        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 {
@@ -1731,12 +1731,12 @@ void update_default_clock(struct bt_msg_iter *notit, uint64_t new_val,
         * 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) {
                /*
@@ -1744,18 +1744,18 @@ void update_default_clock(struct bt_msg_iter *notit, uint64_t new_val,
                 * 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
@@ -2244,7 +2244,7 @@ end:
 }
 
 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(
@@ -2254,8 +2254,8 @@ void set_event_default_clock_value(struct bt_msg_iter *notit)
        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);
        }
 }
 
@@ -2341,15 +2341,15 @@ void notify_new_packet(struct bt_msg_iter *notit,
                        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);
        }
 
@@ -2419,7 +2419,7 @@ void notify_end_of_packet(struct bt_msg_iter *notit,
 
        /* 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);
@@ -2610,7 +2610,7 @@ enum bt_msg_iter_status bt_msg_iter_get_next_message(
                        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;
index 1bc5dc60ce865dc6501d69998e3d5f7266a6a660..f703630411467901a4b544855a387d9d942589af 100644 (file)
@@ -563,7 +563,7 @@ enum bt_lttng_live_iterator_status emit_inactivity_message(
                        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;
 
@@ -575,21 +575,21 @@ enum bt_lttng_live_iterator_status emit_inactivity_message(
        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;
 
@@ -608,7 +608,7 @@ enum bt_lttng_live_iterator_status lttng_live_iterator_next_handle_one_quiescent
        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;
@@ -627,7 +627,7 @@ enum bt_lttng_live_iterator_status lttng_live_iterator_next_handle_one_quiescent
        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;
 }
index ef5368c0be73d1003269b5fd872307d26d18b3e5..07d129d286778e53a39bbfbbfa954ac66437a36b 100644 (file)
@@ -763,7 +763,7 @@ int copy_find_clock_int_field(FILE *err,
                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;
 
@@ -772,12 +772,12 @@ int copy_find_clock_int_field(FILE *err,
                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;
@@ -792,15 +792,15 @@ int copy_find_clock_int_field(FILE *err,
        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;
index 140a7ad8797c9fd5c7eedc71dd253af935cd0573..cb1f7aa7bbe5263d6a16e39c18ccbdb7ffe38b87 100644 (file)
@@ -655,7 +655,7 @@ int ctf_copy_event_header(FILE *err, const bt_event *event,
                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;
@@ -667,12 +667,12 @@ int ctf_copy_event_header(FILE *err, const bt_event *event,
                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;
@@ -684,15 +684,15 @@ int ctf_copy_event_header(FILE *err, const bt_event *event,
                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;
index 00ec45b71afb91464830f10bbc72be50c4a0c4b7..fa0298b27171662e6231f6058e2edcd67d1c928c 100644 (file)
@@ -1721,11 +1721,11 @@ end:
 }
 
 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);
@@ -1734,8 +1734,8 @@ int set_event_clock_value(FILE *err, const bt_event *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;
        }
@@ -1744,7 +1744,7 @@ int set_event_clock_value(FILE *err, const bt_event *event,
         * 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;
@@ -1757,7 +1757,7 @@ 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;
 }
 
@@ -1777,7 +1777,7 @@ const bt_event *debug_info_copy_event(FILE *err, const bt_event *event,
                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;
index c85eb16a54a83fa2aceb0a417d560d47d5f31777..8a80df3bba7b833ec3aeb3bb97e02d8132da1b14 100644 (file)
@@ -518,7 +518,7 @@ skip_ts:
        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;
index d0639817b7a61746e05d8a159af8774616a025c5..cdbbc1b66084804ed5c8411ab56a6e2b8aa5522f 100644 (file)
@@ -46,7 +46,7 @@
 
 struct timestamp {
        int64_t real_timestamp; /* Relative to UNIX epoch. */
-       uint64_t clock_value;   /* In cycles. */
+       uint64_t clock_snapshot;        /* In cycles. */
 };
 
 static
@@ -80,17 +80,17 @@ 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) {
@@ -101,7 +101,7 @@ void print_timestamp_cycles(struct pretty_component *pretty,
 
 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 */
@@ -109,12 +109,12 @@ void print_timestamp_wall(struct pretty_component *pretty,
        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");
@@ -222,8 +222,8 @@ int print_event_timestamp(struct pretty_component *pretty,
        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) {
@@ -237,9 +237,9 @@ int print_event_timestamp(struct pretty_component *pretty,
                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;
        }
@@ -255,10 +255,10 @@ int print_event_timestamp(struct pretty_component *pretty,
        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);
@@ -1262,8 +1262,8 @@ int print_discarded_elements_msg(
        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);
@@ -1291,10 +1291,10 @@ int print_discarded_elements_msg(
        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, "");
@@ -1306,11 +1306,11 @@ int print_discarded_elements_msg(
                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)");
index bb786ed9f54a42624c27b6b9d669f14f1baa6a2e..077a8f8d3d3323203c4017711498ebd0d8376a26 100644 (file)
@@ -603,12 +603,12 @@ int get_msg_ts_ns(struct muxer_comp *muxer_comp,
                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);
@@ -622,13 +622,13 @@ int get_msg_ts_ns(struct muxer_comp *muxer_comp,
        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:
@@ -638,25 +638,25 @@ int get_msg_ts_ns(struct muxer_comp *muxer_comp,
                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);
@@ -809,10 +809,10 @@ int get_msg_ts_ns(struct muxer_comp *muxer_comp,
                }
        }
 
-       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;
        }
 
index 0e01511928bd824767f862c0212c86be910cfe20..82f3410e0ed72465b8d1ce7cf7c931a714f49a52 100644 (file)
@@ -188,7 +188,7 @@ const bt_message *evaluate_event_message(
        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;
@@ -219,14 +219,14 @@ const bt_message *evaluate_event_message(
                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;
@@ -262,7 +262,7 @@ end:
        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;
 }
@@ -272,10 +272,10 @@ int ns_from_integer_field(const bt_field *integer, int64_t *ns)
 {
        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);
@@ -289,7 +289,7 @@ int ns_from_integer_field(const bt_field *integer, int64_t *ns)
        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;
                }
@@ -299,16 +299,16 @@ int ns_from_integer_field(const bt_field *integer, int64_t *ns)
                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;
 }
 
This page took 0.077966 seconds and 4 git commands to generate.