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>
5 files changed