summaryrefslogtreecommitdiffstats
path: root/src/daemon/dtrace2systemtap.awk
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/dtrace2systemtap.awk')
-rw-r--r--src/daemon/dtrace2systemtap.awk25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/daemon/dtrace2systemtap.awk b/src/daemon/dtrace2systemtap.awk
new file mode 100644
index 0000000..3761008
--- /dev/null
+++ b/src/daemon/dtrace2systemtap.awk
@@ -0,0 +1,25 @@
+#!/usr/bin/awk -f
+
+# Convert a simple dtrace probe files into a tapset. Heavily inspired
+# by dtrace2systemtap.pl from libvirt
+
+($1 == "provider") {
+ provider = $2
+}
+
+($1 == "probe") {
+ name = substr($2, 0, index($2, "(") - 1)
+ split(substr($0, index($0, "(") + 1, index($0, ")") - index($0, "(") - 1),
+ args, /, /)
+ printf "probe %s.%s = process(\"%s/%s\").provider(\"%s\").mark(\"%s\") {\n", provider, name, sbindir, provider, provider, name
+ for (arg in args) {
+ match(args[arg], /^(.+[^a-z_])([a-z_]+)$/, aarg)
+ type = aarg[1]
+ argname = aarg[2]
+ if (type == "char *")
+ printf " %s = user_string($arg%d);\n", argname, arg
+ else
+ printf " %s = $arg%d;\n", argname, arg
+ }
+ printf "}\n\n"
+}