[dpdk-dev] [PATCH v5 13/33] eal/trace: implement registration payload
David Marchand
david.marchand at redhat.com
Thu Apr 16 15:40:24 CEST 2020
On Mon, Apr 13, 2020 at 5:02 PM <jerinj at marvell.com> wrote:
> diff --git a/lib/librte_eal/common/eal_common_trace.c b/lib/librte_eal/common/eal_common_trace.c
> index 8181c0f02..906e2d706 100644
> --- a/lib/librte_eal/common/eal_common_trace.c
> +++ b/lib/librte_eal/common/eal_common_trace.c
> @@ -403,6 +403,25 @@ trace_mem_per_thread_free(void)
> rte_spinlock_unlock(&trace->lock);
> }
>
> +void
> +__rte_trace_emit_ctf_field(size_t sz, const char *in, const char *datatype)
> +{
> + char *field = RTE_PER_LCORE(ctf_field);
> + int count = RTE_PER_LCORE(ctf_count);
> + int rc;
> +
> + RTE_PER_LCORE(trace_point_sz) += sz;
> + rc = snprintf(RTE_PTR_ADD(field, count),
> + RTE_MAX(0, TRACE_CTF_FIELD_SIZE - 1 - count),
> + "%s %s;", datatype, in);
rc <= 0 does not check if a truncation happened.
> + if (rc <= 0) {
> + RTE_PER_LCORE(trace_point_sz) = 0;
> + trace_crit("CTF field is too long");
> + return;
> + }
> + RTE_PER_LCORE(ctf_count) += rc;
> +}
> +
> int
> __rte_trace_point_register(rte_trace_t *handle, const char *name,
> void (*register_fn)(void))
--
David Marchand
More information about the dev
mailing list