X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;ds=sidebyside;f=libust%2Ftype-serializer.c;h=070542c65e2a938a158e00e88aad320f867a55b2;hb=HEAD;hp=2c278dfe0f2a9222503e2b20caf80c0119b9e273;hpb=0222e1213f196b66cbc08cd29093aca4a28e9ffb;p=ust.git diff --git a/libust/type-serializer.c b/libust/type-serializer.c index 2c278df..070542c 100644 --- a/libust/type-serializer.c +++ b/libust/type-serializer.c @@ -10,14 +10,17 @@ /* This file contains functions for tracepoint custom probes support. */ +#define _GNU_SOURCE +#define _LGPL_SOURCE #include -#include #include #include +#include #include "tracer.h" +#include "type-serializer.h" notrace -void _ltt_specialized_trace(const struct marker *mdata, void *probe_data, +void _ltt_specialized_trace(const struct ust_marker *mdata, void *probe_data, void *serialize_private, unsigned int data_size, unsigned int largest_align) { @@ -82,6 +85,14 @@ void _ltt_specialized_trace(const struct marker *mdata, void *probe_data, if (!chan->active) continue; + /* If a new cpu was plugged since the trace was started, we did + * not add it to the trace, and therefore we write the event to + * cpu 0. + */ + if(cpu >= chan->n_cpus) { + cpu = 0; + } + /* reserve space : header and data */ ret = ltt_reserve_slot(chan, trace, data_size, largest_align, cpu, &buf, &slot_size, &buf_offset, &tsc,