Skip to contentSkip to conversation

libtracefs: Have tracefs_sql() cast handle stacktrace

PATCH New Steven Rostedt 1 participant 1 message Apr 11, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libtracefs: Have tracefs_sql() cast handle stacktrace

From: "Steven Rostedt (Google)" <[email protected]>

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
---
 src/tracefs-sqlhist.c | 4 ++++
 1 file changed, 4 insertions(+)
src/tracefs-sqlhist.c +4 -0
index 67be678..30c8ccc 100644
@@ -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",
Signature · 1 line
2.47.2