Hi Tom, On Wed, 30 Sep 2020 13:40:52 -0500 Tom Zanussi <zanu...@kernel.org> wrote:
> Currently, sythetic events only support static string fields such as: > > # echo 'test_latency u64 lat; char somename[32]' > > /sys/kernel/debug/tracing/synthetic_events > > Which is fine, but wastes a lot of space in the event. > > It also prevents the most commonly-defined strings in the existing > trace events e.g. those defined using __string(), from being passed to > synthetic events via the trace() action. > > With this change, synthetic events with dynamic fields can be defined: > > # echo 'test_latency u64 lat; char somename[]' > > /sys/kernel/debug/tracing/synthetic_events Could you add a testcase (and update existing one) of ftracetest for this new feature too? > > And the trace() action can be used to generate events using either > dynamic or static strings: > > # echo > 'hist:keys=name:lat=common_timestamp.usecs-$ts0:onmatch(sys.event).test_latency($lat,name)' > > /sys/kernel/debug/tracing/events > > The synthetic event dynamic strings are implemented in the same way as > the existing __data_loc strings and appear as such in the format file. > > Signed-off-by: Tom Zanussi <zanu...@kernel.org> > --- > Documentation/trace/events.rst | 15 +- > Documentation/trace/histogram.rst | 18 +++ > kernel/trace/synth_event_gen_test.c | 18 ++- > kernel/trace/trace_events_hist.c | 9 ++ > kernel/trace/trace_events_synth.c | 239 ++++++++++++++++++++++++---- > kernel/trace/trace_synth.h | 4 + And you might also need to update tracefs/README so that user can check whether the kernel supports dynamic string or not. Thank you, -- Masami Hiramatsu <mhira...@kernel.org>