eal: move OS common debug functions to single file
[dpdk.git] / lib / librte_eal / common / eal_common_trace.c
index d69b86f..875553d 100644 (file)
@@ -21,7 +21,7 @@ static RTE_DEFINE_PER_LCORE(char, ctf_field[TRACE_CTF_FIELD_SIZE]);
 static RTE_DEFINE_PER_LCORE(int, ctf_count);
 
 static struct trace_point_head tp_list = STAILQ_HEAD_INITIALIZER(tp_list);
-static struct trace trace;
+static struct trace trace = { .args = STAILQ_HEAD_INITIALIZER(trace.args), };
 
 struct trace *
 trace_obj_get(void)
@@ -38,6 +38,8 @@ trace_list_head_get(void)
 int
 eal_trace_init(void)
 {
+       struct trace_arg *arg;
+
        /* Trace memory should start with 8B aligned for natural alignment */
        RTE_BUILD_BUG_ON((offsetof(struct __rte_trace_header, mem) % 8) != 0);
 
@@ -47,6 +49,9 @@ eal_trace_init(void)
                goto fail;
        }
 
+       if (!STAILQ_EMPTY(&trace.args))
+               trace.status = true;
+
        if (!rte_trace_is_enabled())
                return 0;
 
@@ -61,6 +66,9 @@ eal_trace_init(void)
         */
        trace_uuid_generate();
 
+       /* Apply buffer size configuration for trace output */
+       trace_bufsz_args_apply();
+
        /* Generate CTF TDSL metadata */
        if (trace_metadata_create() < 0)
                goto fail;
@@ -73,6 +81,10 @@ eal_trace_init(void)
        if (trace_epoch_time_save() < 0)
                goto fail;
 
+       /* Apply global configurations */
+       STAILQ_FOREACH(arg, &trace.args, next)
+               trace_args_apply(arg->val);
+
        rte_trace_mode_set(trace.mode);
 
        return 0;
@@ -91,6 +103,7 @@ eal_trace_fini(void)
                return;
        trace_mem_per_thread_free();
        trace_metadata_destroy();
+       eal_trace_args_free();
 }
 
 bool