Mi & save/load: add option to indent or not on config writer creation
authorJonathan Rajotte Julien <jonathan.r.julien@gmail.com>
Wed, 6 Aug 2014 14:13:48 +0000 (10:13 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Sat, 16 Aug 2014 14:41:18 +0000 (10:41 -0400)
The presence of tabulation and newline in mi is irrelevant and can
impact client performance. The parsing & processing of a lot of data
from mi with many /t and /n impact performance. This aim to fix the
problem at the source. Style is useless for machine.

Signed-off-by: Jonathan Rajotte Julien <jonathan.r.julien@gmail.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-sessiond/save.c
src/common/config/config.c
src/common/config/config.h
src/common/mi-lttng.c

index 2aefae03e2cc66ceb4163bfee4d4948c7095ef76..e2c93b4bba1663d139e4257f8659c2ea070ff667 100644 (file)
@@ -1514,7 +1514,7 @@ int save_session(struct ltt_session *session,
        }
        file_opened = 1;
 
-       writer = config_writer_create(fd);
+       writer = config_writer_create(fd, 1);
        if (!writer) {
                ret = LTTNG_ERR_NOMEM;
                goto end;
index a1ad95e462d7d3ef1060beff9ac3347b6d9b7cc6..4a07e99479adb7b0c7ddd0a1db434587f24aea1b 100644 (file)
@@ -354,7 +354,7 @@ end:
 }
 
 LTTNG_HIDDEN
-struct config_writer *config_writer_create(int fd_output)
+struct config_writer *config_writer_create(int fd_output, int indent)
 {
        int ret;
        struct config_writer *writer;
@@ -380,12 +380,12 @@ struct config_writer *config_writer_create(int fd_output)
 
        ret = xmlTextWriterSetIndentString(writer->writer,
                BAD_CAST config_xml_indent_string);
-       if (ret)  {
+       if (ret) {
                goto error_destroy;
        }
 
-       ret = xmlTextWriterSetIndent(writer->writer, 1);
-       if (ret)  {
+       ret = xmlTextWriterSetIndent(writer->writer, indent);
+       if (ret) {
                goto error_destroy;
        }
 
index 9a5671ab0c138cb9d7d76d95225f1af524810696..2fed612a1cfbd5783891ec16e99808dc386e3645 100644 (file)
@@ -81,11 +81,14 @@ int config_parse_value(const char *value);
  * fd_output File to which the XML content must be written. The file will be
  * closed once the config_writer has been destroyed.
  *
+ * indent If other than 0 the XML will be pretty printed
+ * with indentation and newline.
+ *
  * Returns an instance of a configuration writer on success, NULL on
  * error.
  */
 LTTNG_HIDDEN
-struct config_writer *config_writer_create(int fd_output);
+struct config_writer *config_writer_create(int fd_output, int indent);
 
 /*
  * Destroy an instance of a configuration writer.
index fc7207cb4137a1f9317a2525b20e38cce2c34ef8..83df149f2bc5c2eb9583ed22854bea70350c1cff 100644 (file)
@@ -354,7 +354,7 @@ struct mi_writer *mi_lttng_writer_create(int fd_output, int mi_output_type)
                goto end;
        }
        if (mi_output_type == LTTNG_MI_XML) {
-               mi_writer->writer = config_writer_create(fd_output);
+               mi_writer->writer = config_writer_create(fd_output, 0);
                if (!mi_writer->writer) {
                        goto err_destroy;
                }
This page took 0.030767 seconds and 5 git commands to generate.