diff options
author | hunt <hunt> | 2007-01-22 18:45:16 +0000 |
---|---|---|
committer | hunt <hunt> | 2007-01-22 18:45:16 +0000 |
commit | 9e0aa6367ff955f6e4d6ed044fd6ea0392888f6f (patch) | |
tree | a66cfa6189ba3a6c55a686240cbe9cdeb29fa78d /runtime/bench2/bench.rb | |
parent | 77d3caafb8ed8eb1de4624644475ff28998e8d3b (diff) | |
download | systemtap-steved-9e0aa6367ff955f6e4d6ed044fd6ea0392888f6f.tar.gz systemtap-steved-9e0aa6367ff955f6e4d6ed044fd6ea0392888f6f.tar.xz systemtap-steved-9e0aa6367ff955f6e4d6ed044fd6ea0392888f6f.zip |
Fix for kallsyms problem
Diffstat (limited to 'runtime/bench2/bench.rb')
-rw-r--r-- | runtime/bench2/bench.rb | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/runtime/bench2/bench.rb b/runtime/bench2/bench.rb index c7321a36..05c6ee3e 100644 --- a/runtime/bench2/bench.rb +++ b/runtime/bench2/bench.rb @@ -159,24 +159,19 @@ class Bench def emit_code if @code begin + getuid="0x"+`grep sys_getuid$ /proc/kallsyms`.split[0] f = File.new("#{@dir}/bench.c","w") f << "#include \"runtime.h\" -#include \"probes.c\"\n MODULE_DESCRIPTION(\"SystemTap probe: bench\"); MODULE_AUTHOR(\"automatically generated by bench2/run_bench\");\n\n" f << "static int inst_sys_getuid (struct kprobe *p, struct pt_regs *regs) {\n" f << @code f << "\n return 0;\n}\n" - f << " static struct kprobe kp[] = {\n {\n" - f << "#if defined __powerpc64__ \n" - f << " .addr = (void *)\".sys_getuid\",\n" - f << "#else \n" - f << " .addr = \"sys_getuid\", \n" - f << "#endif\n" - f << ".pre_handler = inst_sys_getuid\n }\n};\n -#define NUM_KPROBES 1\n -int probe_start(void)\n{\n return _stp_register_kprobes (kp, NUM_KPROBES);\n}\n -void probe_exit (void)\n{\n _stp_unregister_kprobes (kp, NUM_KPROBES); \n}\n" + f << " static struct kprobe kp = {\n" + f << " .addr = (kprobe_opcode_t *)#{getuid}, \n" + f << ".pre_handler = inst_sys_getuid\n };\n +int probe_start(void)\n{\n return register_kprobe(&kp);\n}\n +void probe_exit (void)\n{\n unregister_kprobe (&kp); \n}\n" rescue puts "Error writing source file" exit @@ -233,6 +228,7 @@ obj-m := bench.o puts "-"*64 check_cpuspeed @@ftime = `./itest 1`.to_i + @@ftime = `./itest 1`.to_i puts "For comparison, function call overhead is #@@ftime nsecs." puts "Times below are nanoseconds per probe and include kprobe overhead." puts "-"*64 |