diff options
author | fche <fche> | 2006-03-30 15:15:28 +0000 |
---|---|---|
committer | fche <fche> | 2006-03-30 15:15:28 +0000 |
commit | 30a279be821027bc416119ad6060c102402ff502 (patch) | |
tree | 6583de92871e71699bcadaa6770a8972d6b6856e /gen-stapmark.h | |
parent | 56894e91234245e0d343101489bd36f25f58dcb9 (diff) | |
download | systemtap-steved-30a279be821027bc416119ad6060c102402ff502.tar.gz systemtap-steved-30a279be821027bc416119ad6060c102402ff502.tar.xz systemtap-steved-30a279be821027bc416119ad6060c102402ff502.zip |
2006-03-30 Frank Ch. Eigler <fche@elastic.org>
PR 953, part 1
* tapsets.cxx: (mark_derived_probe*): New classes.
(register_standard_tapsets): Register kernel/module.mark() family.
* stapmark.h: New header for static instrumentation markers.
* gen-stapmark.h: New perl script to generate it.
* elaborate.cxx (derived_probe ctor): Ignore null location*.
Diffstat (limited to 'gen-stapmark.h')
-rwxr-xr-x | gen-stapmark.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/gen-stapmark.h b/gen-stapmark.h new file mode 100755 index 00000000..f7fb84d7 --- /dev/null +++ b/gen-stapmark.h @@ -0,0 +1,48 @@ +#! /usr/bin/perl + +sub bitset { + my $num = shift; + my $bit = shift; + return ($num & (1 << $bit)); +} + +sub gensn { + my $permutation = shift; + my $arity = shift; + + my $SN = ""; + for (0..$arity-1) { $SN .= bitset($permutation,$_) ? "S" : "N"; } + + print "#define STAP_MARK_" . $SN . "(n,"; + for (0..$arity-1) { if ($_) { print ",";} + print "a" . (($_)+1); } + print ") do { \\\n"; + print " static void (*__systemtap_mark_##n##_" . $SN . ")("; + for (0..$arity-1) { if ($_) { print ",";} + print bitset($permutation,$_) + ? "const char *" + : "int64_t"; } + print "); \\\n"; + print " if (unlikely (__systemtap_mark_##n##_" . $SN . ")) \\\n"; + print " (void) (__systemtap_mark_##n##_" . $SN . "("; + for (0..$arity-1) { if ($_) { print ",";} + print "(a" . (($_)+1) . ")"; } + print ")); \\\n"; + print "} while (0)\n\n"; +} + +sub permute { + my $arity = shift; + for (0 .. (1<<$arity)-1) { + &gensn ($_, $arity); + } +} + + +die "give me one number" unless $#ARGV == 0; + +print "/* Generated by '$0 @ARGV' on " . gmtime() . " */\n\n"; + +for (1 .. $ARGV[0]) { + &permute($_); +} |