summaryrefslogtreecommitdiffstats
path: root/dtrace
diff options
context:
space:
mode:
Diffstat (limited to 'dtrace')
-rwxr-xr-xdtrace61
1 files changed, 23 insertions, 38 deletions
diff --git a/dtrace b/dtrace
index 7966e1f2..a2b495b2 100755
--- a/dtrace
+++ b/dtrace
@@ -17,12 +17,11 @@ from subprocess import call
from tempfile import mkstemp
class provider:
- arglist = dict()
def open(self, provider, header):
have_provider = False
self.f = open(provider)
self.h = open(header,mode='w')
- self.h.write("// Generated by the Systemtap dtrace wrapper\n")
+ self.h.write("/* Generated by the Systemtap dtrace wrapper */\n")
self.h.write("\n#include <sys/sdt.h>\n\n")
in_comment = False
while (True):
@@ -49,7 +48,6 @@ class provider:
new_args = ""
i = 0
c = 0
- self.arglist[this_probe] = ""
while (i < len(args)):
if (args[i:i+1] == ","):
new_args = ('%s%s' % (new_args, args[i]))
@@ -57,45 +55,27 @@ class provider:
else:
new_args = new_args + args[i]
i += 1
- if (len(new_args) > 0):
- self.arglist[this_probe] = ('%s arg%d' % (new_args, c))
if (len(new_args) == 0):
- self.h.write ('#define %s() STAP_PROBE(provider,%s)\n' % (this_probe_canon, this_probe))
- elif (c == 0):
- self.h.write ('#define %s(arg1) STAP_PROBE%d(provider,%s,arg1)\n' % (this_probe_canon, c+1, this_probe))
- elif (c == 1):
- self.h.write ('#define %s(arg1,arg2) STAP_PROBE%d(provider,%s,arg1,arg2)\n' % (this_probe_canon, c+1, this_probe))
- elif (c == 2):
- self.h.write ('#define %s(arg1,arg2,arg3) STAP_PROBE%d(provider,%s,arg1,arg2,arg3)\n' % (this_probe_canon, c+1, this_probe))
- elif (c == 3):
- self.h.write ('#define %s(arg1,arg2,arg3,arg4) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4)\n' % (this_probe_canon, c+1, this_probe))
- elif (c == 4):
- self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5)\n' % (this_probe_canon, c+1, this_probe))
- elif (c == 5):
- self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5,arg6) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5,arg6)\n' % (this_probe_canon, c+1, this_probe))
- elif (c == 6):
- self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5,arg6,arg7) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5,arg6,arg7)\n' % (this_probe_canon, c+1, this_probe))
- elif (c == 7):
- self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)\n' % (this_probe_canon, c+1, this_probe))
- elif (c == 8):
- self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)\n' % (this_probe_canon, c+1, this_probe))
- elif (c == 9):
- self.h.write('// X %d %s\n' % (c+1,this_probe_canon))
- self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10)\n' % (this_probe_canon, c+1, this_probe))
+ c = 0
+ stap_str = "STAP_PROBE(provider,%s" % (this_probe)
+ else:
+ c += 1
+ stap_str = "STAP_PROBE%d(provider,%s" % (c,this_probe)
+ define_str = "#define %s(" % (this_probe_canon)
+ i = 1
+ while (i <= c):
+ if (i != 1):
+ define_str += ","
+ define_str = define_str + "arg%s" % (i);
+ stap_str = stap_str + ",arg%s" % (i);
+ i += 1
+ self.h.write ('/* %s (%s) */\n' % (this_probe_canon,new_args))
self.h.write ('#define %s_ENABLED() 1\n' % this_probe_canon)
-
- def get(self, arg):
- print arg
- if (arg in self.arglist):
- return self.arglist[arg]
- else:
- return ""
-########################################################################
-# main
-########################################################################
+ self.h.write (define_str + ") \\\n")
+ self.h.write (stap_str + ")\n\n")
def usage ():
- print "Usage " + sys.argv[0] + "[-h | -G] -s File.d -o File {Files}"
+ print "Usage " + sys.argv[0] + " [-h | -G] -s File.d -o File {Files}"
sys.exit(1)
def open_file (arg):
@@ -108,6 +88,11 @@ def open_file (arg):
sys.exit(1)
return file
+
+########################################################################
+# main
+########################################################################
+
if (len (sys.argv) < 2):
usage()