Babeltrace wrapper update
[babeltrace.git] / formats / ctf / ctf.c
index fa19648155964faa6a8dbedc283a2fbb2d655ab2..4f14d7a0b8a45a1994e46d355aabb7af0a930734 100644 (file)
 #include <babeltrace/ctf/metadata.h>
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/ctf/events-internal.h>
+#include <babeltrace/uuid.h>
+#include <babeltrace/endian.h>
 #include <inttypes.h>
 #include <stdio.h>
-#include <uuid/uuid.h>
 #include <sys/mman.h>
 #include <errno.h>
-#include <endian.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -40,6 +40,7 @@
 #include "metadata/ctf-scanner.h"
 #include "metadata/ctf-parser.h"
 #include "metadata/ctf-ast.h"
+#include "events-private.h"
 
 /*
  * We currently simply map a page to read the packet header and packet
@@ -47,7 +48,6 @@
  */
 #define MAX_PACKET_HEADER_LEN  (getpagesize() * CHAR_BIT)
 #define WRITE_PACKET_LEN       (getpagesize() * 8 * CHAR_BIT)
-#define UUID_LEN 16    /* uuid by value len */
 
 #ifndef min
 #define min(a, b)      (((a) < (b)) ? (a) : (b))
@@ -149,21 +149,14 @@ void ctf_print_timestamp(FILE *fp,
                        uint64_t timestamp)
 {
        uint64_t ts_sec = 0, ts_nsec;
-       struct ctf_trace *trace = stream->stream_class->trace;
-       struct trace_collection *tc = trace->collection;
-       uint64_t tc_offset = tc->single_clock_offset_avg;
 
-       if (stream->current_clock->freq == 1000000000ULL) {
-               ts_nsec = timestamp;
+       if (opt_clock_raw) {
+               ts_nsec = ctf_get_timestamp_raw(stream, timestamp);
        } else {
-               ts_nsec = (uint64_t) ((double) timestamp * 1000000000.0
-                               / (double) stream->current_clock->freq);
+               ts_nsec = ctf_get_timestamp(stream, timestamp);
        }
 
-       /* Add offsets */
-       if (!opt_clock_raw) {
-               ts_nsec += tc_offset;
-       }
+       /* Add command-line offset */
        ts_sec += opt_clock_offset;
 
        ts_sec += ts_nsec / NSEC_PER_SEC;
@@ -695,7 +688,7 @@ int ctf_open_trace_metadata_packet_read(struct ctf_trace *td, FILE *in,
                memcpy(td->uuid, header.uuid, sizeof(header.uuid));
                CTF_TRACE_SET_FIELD(td, uuid);
        } else {
-               if (uuid_compare(header.uuid, td->uuid))
+               if (babeltrace_uuid_compare(header.uuid, td->uuid))
                        return -EINVAL;
        }
 
@@ -1083,20 +1076,20 @@ int create_stream_packet_index(struct ctf_trace *td,
                                struct definition_array *defarray;
                                struct definition *field;
                                uint64_t i;
-                               uint8_t uuidval[UUID_LEN];
+                               uint8_t uuidval[BABELTRACE_UUID_LEN];
 
                                field = struct_definition_get_field_from_index(file_stream->parent.trace_packet_header, len_index);
                                assert(field->declaration->id == CTF_TYPE_ARRAY);
                                defarray = container_of(field, struct definition_array, p);
-                               assert(array_len(defarray) == UUID_LEN);
+                               assert(array_len(defarray) == BABELTRACE_UUID_LEN);
 
-                               for (i = 0; i < UUID_LEN; i++) {
+                               for (i = 0; i < BABELTRACE_UUID_LEN; i++) {
                                        struct definition *elem;
 
                                        elem = array_index(defarray, i);
                                        uuidval[i] = get_unsigned_int(elem);
                                }
-                               ret = uuid_compare(td->uuid, uuidval);
+                               ret = babeltrace_uuid_compare(td->uuid, uuidval);
                                if (ret) {
                                        fprintf(stderr, "[error] Unique Universal Identifiers do not match.\n");
                                        return -EINVAL;
This page took 0.024001 seconds and 4 git commands to generate.