mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-25 00:52:45 -04:00
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>
This commit is contained in:
committed by
Steven Rostedt (VMware)
parent
63a1e5de30
commit
bd82631d7c
@@ -1776,6 +1776,24 @@ consisting of the name of the new event along with one or more
|
||||
variables and their types, which can be any valid field type,
|
||||
separated by semicolons, to the tracing/synthetic_events file.
|
||||
|
||||
See synth_field_size() for available types.
|
||||
|
||||
If field_name contains [n], the field is considered to be a static array.
|
||||
|
||||
If field_names contains[] (no subscript), the field is considered to
|
||||
be a dynamic array, which will only take as much space in the event as
|
||||
is required to hold the array.
|
||||
|
||||
A string field can be specified using either the static notation:
|
||||
|
||||
char name[32];
|
||||
|
||||
Or the dynamic:
|
||||
|
||||
char name[];
|
||||
|
||||
The size limit for either is 256.
|
||||
|
||||
For instance, the following creates a new event named 'wakeup_latency'
|
||||
with 3 fields: lat, pid, and prio. Each of those fields is simply a
|
||||
variable reference to a variable on another event::
|
||||
|
||||
Reference in New Issue
Block a user