diff mbox series

libtracefs: Have tracefs_sql() cast handle stacktrace

Message ID 20250410212112.45e673ad@gandalf.local.home (mailing list archive)
State Accepted
Commit 6680daed8a7111c6365aaa2844ff03b26bab0bcb
Headers show
Series libtracefs: Have tracefs_sql() cast handle stacktrace | expand

Commit Message

Steven Rostedt April 11, 2025, 1:21 a.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

A histogram can have a "stacktrace" type. Allow casts to make that:

  # sqlhist select cast '('start.stack as stacktrace')' from sleep_lat as start
  echo 'hist:keys=stack.stacktrace' > /sys/kernel/tracing/events/synthetic/sleep_lat/trigger

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 src/tracefs-sqlhist.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/src/tracefs-sqlhist.c b/src/tracefs-sqlhist.c
index 67be678..30c8ccc 100644
--- a/src/tracefs-sqlhist.c
+++ b/src/tracefs-sqlhist.c
@@ -1450,6 +1450,10 @@  static int verify_field_type(struct tep_handle *tep,
 		if (tfield->flags & (TEP_FIELD_IS_STRING | TEP_FIELD_IS_ARRAY))
 			goto fail_type;
 		ret = TRACEFS_HIST_KEY_BUCKETS;
+	} else if (!strcmp(type, "stacktrace")) {
+		if (!(tfield->flags & (TEP_FIELD_IS_ARRAY)))
+			goto fail_type;
+		ret = TRACEFS_HIST_KEY_STACKTRACE;
 	} else {
 		parse_error(sb, field->raw,
 			    "Cast of '%s' to unknown type '%s'\n",