linux/Documentation/trace
Tom Zanussi bd82631d7c tracing: Add support for dynamic strings to synthetic events
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

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.

[ <rostedt@goodmis.org>: added __set_synth_event_print_fmt() changes:

  I added the following to make it work with trace-cmd. Dynamic strings
  must have __get_str() for events in the print_fmt otherwise it can't be
  parsed correctly. ]

Link: https://lore.kernel.org/r/cover.1601588066.git.zanussi@kernel.org
Link: https://lkml.kernel.org/r/3ed35b6d0e390f5b94cb4a9ba1cc18f5982ab277.1601848695.git.zanussi@kernel.org

Tested-by: Axel Rasmussen <axelrasmussen@google.com>
Signed-off-by: Tom Zanussi <zanussi@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2020-10-05 19:32:18 -04:00
..
coresight docs: trace: coresight-ect.rst: Fix a build warning 2020-05-19 16:31:16 +02:00
postprocess mm: move recent_rotated pages calculation to shrink_inactive_list() 2019-05-14 09:47:45 -07:00
boottime-trace.rst Documentation: tracing: Add the startup timing of boot-time tracing 2020-09-21 21:06:04 -04:00
events-kmem.rst trace doc: convert trace/events-kmem.txt to rst format 2018-03-07 10:25:54 -07:00
events-msr.rst Replace HTTP links with HTTPS ones: documentation 2020-06-08 09:30:19 -06:00
events-nmi.rst trace doc: convert trace/events-nmi.txt to rst format 2018-03-07 10:26:02 -07:00
events-power.rst PM: QoS: Simplify definitions of CPU latency QoS trace events 2020-02-13 11:26:39 +01:00
events.rst tracing: Add support for dynamic strings to synthetic events 2020-10-05 19:32:18 -04:00
ftrace-design.rst sh/ftrace: Move arch_ftrace_nmi_{enter,exit} into nmi exception 2020-05-19 15:51:18 +02:00
ftrace-uses.rst tracing: Use CONFIG_PREEMPTION 2019-11-13 09:37:28 -05:00
ftrace.rst It's been a busy cycle for documentation - hopefully the busiest for a 2020-08-04 22:47:54 -07:00
function-graph-fold.vim
histogram-design.rst Documentation: trace/histogram-design: drop doubled words 2020-07-05 14:40:55 -06:00
histogram.rst tracing: Add support for dynamic strings to synthetic events 2020-10-05 19:32:18 -04:00
hwlat_detector.rst trace doc: convert trace/hwlat_detector.txt to rst fromat 2018-03-07 10:26:14 -07:00
index.rst docs: trace/index.rst: add histogram-design.rst 2020-07-23 14:15:59 -06:00
intel_th.rst docs: trace: fix a typo 2020-08-11 10:22:15 -06:00
kprobes.rst docs: Move kprobes.rst from staging/ to trace/ 2020-07-23 14:01:24 -06:00
kprobetrace.rst Documentation: tracing: Add %return suffix description 2020-09-21 21:06:03 -04:00
mmiotrace.rst Replace HTTP links with HTTPS ones: documentation 2020-06-08 09:30:19 -06:00
ring-buffer-design.rst docs: trace: ring-buffer-design.txt: convert to ReST format 2020-06-26 11:33:31 -06:00
stm.rst Documentation: trace/stm: drop doubled words 2020-07-05 14:40:55 -06:00
sys-t.rst stm class: Document the MIPI SyS-T protocol usage 2018-10-11 12:12:55 +02:00
tracepoint-analysis.rst docs: Fix some broken references 2018-06-15 18:10:01 -03:00
tracepoints.rst tracepoints: Add helper to test if tracepoint is enabled in a header 2020-09-25 18:01:35 -04:00
uprobetracer.rst Documentation: tracing: Add %return suffix description 2020-09-21 21:06:03 -04:00