copytrace: option to skip the copy of packet/content size
authorJulien Desfossez <jdesfossez@efficios.com>
Wed, 17 May 2017 20:58:55 +0000 (16:58 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 16:57:44 +0000 (12:57 -0400)
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
plugins/ctf/fs-sink/write.c
plugins/libctfcopytrace/ctfcopytrace.c
plugins/libctfcopytrace/ctfcopytrace.h
plugins/lttng-utils/copy.c
plugins/utils/trimmer/copy.c

index 91b9289929385c1420ac149608242ec823d73cbb..7536056568a59ca9d399a116433492b127bf8dcb 100644 (file)
@@ -308,7 +308,7 @@ enum bt_component_status writer_new_packet(
        BT_PUT(stream);
 
        writer_packet_context = ctf_copy_packet_context(writer_component->err,
-                       packet, writer_stream);
+                       packet, writer_stream, 1);
        if (!writer_packet_context) {
                fprintf(writer_component->err, "[error] %s in %s:%d\n",
                                __func__, __FILE__, __LINE__);
index 4455dfb87132ce4705732c167cba2c9ac869cce6..0689ee380c8651261c65fdffd17da10d64ff5594 100644 (file)
@@ -530,7 +530,8 @@ end:
 BT_HIDDEN
 struct bt_ctf_field *ctf_copy_packet_context(FILE *err,
                struct bt_ctf_packet *packet,
-               struct bt_ctf_stream *writer_stream)
+               struct bt_ctf_stream *writer_stream,
+               int skip_content_size)
 {
        enum bt_component_status ret;
        struct bt_ctf_field *packet_context = NULL, *writer_packet_context = NULL;
@@ -592,9 +593,9 @@ struct bt_ctf_field *ctf_copy_packet_context(FILE *err,
                                        __FILE__, __LINE__);
                        goto error;
                }
-               if (!strncmp(field_name, "content_size", strlen("content_size")) ||
-                               !strncmp(field_name, "packet_size",
-                                       strlen("packet_size"))) {
+               if (skip_content_size &&
+                               (!strncmp(field_name, "content_size", strlen("content_size")) ||
+                               !strncmp(field_name, "packet_size", strlen("packet_size")))) {
                        BT_PUT(field_type);
                        BT_PUT(field);
                        continue;
index 6820a8a2b6c288df1485c498c8f12e3d1d83a63d..417b2d5d956ec3b5e1e25030e1e2eec975b58679 100644 (file)
@@ -105,8 +105,8 @@ enum bt_component_status ctf_copy_packet_context_field(FILE *err,
 /*
  * Copy all the field values of the packet context from the packet passed in
  * parameter and set it to the current packet in the writer stream.
- * The content_size and packet_size fields are not copied since they are
- * already handled by the ctf_writer library.
+ * The content_size and packet_size fields are not copied if skip_content_size
+ * is not 0.
  *
  * Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
  * error.
@@ -114,7 +114,8 @@ enum bt_component_status ctf_copy_packet_context_field(FILE *err,
 BT_HIDDEN
 struct bt_ctf_field *ctf_copy_packet_context(FILE *err,
                struct bt_ctf_packet *packet,
-               struct bt_ctf_stream *writer_stream);
+               struct bt_ctf_stream *writer_stream,
+               int skip_content_size);
 
 /*
  * Create and return a copy of the event passed in parameter. The caller has to
index 14cc12742113df5b7b65fc9051120bfea3149147..c553d79b86a9b04a048d3e78d9810aba4c259d0c 100644 (file)
@@ -1058,7 +1058,7 @@ struct bt_ctf_packet *debug_info_new_packet(
        bt_get(writer_packet);
 
        writer_packet_context = ctf_copy_packet_context(debug_it->err, packet,
-                       writer_stream);
+                       writer_stream, 0);
        if (!writer_packet_context) {
                fprintf(debug_it->err, "[error] %s in %s:%d\n",
                                __func__, __FILE__, __LINE__);
index 9d0d814171e5b6054d0a31098a241e4c854a8cc9..a76f7c054e28d45fb55331e19e0fb57ebea8e8ce 100644 (file)
@@ -194,7 +194,7 @@ struct bt_ctf_packet *trimmer_new_packet(
        bt_get(writer_packet);
 
        writer_packet_context = ctf_copy_packet_context(trim_it->err, packet,
-                       stream);
+                       stream, 0);
        if (!writer_packet_context) {
                fprintf(trim_it->err, "[error] %s in %s:%d\n",
                                __func__, __FILE__, __LINE__);
This page took 0.027074 seconds and 4 git commands to generate.