diff options
author | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2021-08-03 13:06:06 -0400 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2021-08-10 20:19:44 -0400 |
commit | 8abd23c0b75dd4d2e162e47fed3fe2589177a42f (patch) | |
tree | 032101b3321001f5537fa2cf7c439190f6e91733 /include | |
parent | d6c9efc52d2295d9332e58312567ea5ef8081d60 (diff) | |
download | libtracefs-8abd23c0b75dd4d2e162e47fed3fe2589177a42f.tar.gz |
libtracefs: Add CAST(x AS _COUNTER_) syntax to create values in histograms
Use the CAST() command of SQL to define which items in the select should
be cast as values and not keys. By casting the field as the special value
_COUNTER_, it will turn the selection item into a value.
For example:
SELECT common_pid, CAST(bytes_req AS _COUNTER_) FROM kmalloc
Will create:
echo 'hist:keys=common_pid:vals=bytes_req' > events/kmem/kmalloc/trigger
Link: https://lkml.kernel.org/r/20210803170606.694085-23-rostedt@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/tracefs-local.h | 2 | ||||
-rw-r--r-- | include/tracefs.h | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/include/tracefs-local.h b/include/tracefs-local.h index 07d40b2..684eccf 100644 --- a/include/tracefs-local.h +++ b/include/tracefs-local.h @@ -88,6 +88,8 @@ int trace_append_filter(char **filter, unsigned int *state, struct tracefs_synth *synth_init_from(struct tep_handle *tep, const char *start_system, const char *start_event); + +#define HIST_COUNTER_TYPE (TRACEFS_HIST_KEY_MAX + 100) int synth_add_start_field(struct tracefs_synth *synth, const char *start_field, const char *name, diff --git a/include/tracefs.h b/include/tracefs.h index 0e243d5..90994de 100644 --- a/include/tracefs.h +++ b/include/tracefs.h @@ -263,6 +263,7 @@ enum tracefs_hist_key_type { TRACEFS_HIST_KEY_EXECNAME, TRACEFS_HIST_KEY_LOG, TRACEFS_HIST_KEY_USECS, + TRACEFS_HIST_KEY_MAX }; enum tracefs_hist_sort_direction { @@ -274,6 +275,8 @@ enum tracefs_hist_sort_direction { #define TRACEFS_HIST_TIMESTAMP_USECS "common_timestamp.usecs" #define TRACEFS_HIST_CPU "cpu" +#define TRACEFS_HIST_COUNTER "__COUNTER__" + #define TRACEFS_HIST_HITCOUNT "hitcount" struct tracefs_hist; |