Hi Masami, On Fri, 2020-10-02 at 16:17 +0900, Masami Hiramatsu wrote: > 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? >
Yes, I'll add it in the next version. > > > > 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. > Yeah, good to add regardless, will do. Thanks, Tom