summaryrefslogtreecommitdiffstats
path: root/runtime/bench2/bench.rb
diff options
context:
space:
mode:
authorhunt <hunt>2006-03-24 18:43:52 +0000
committerhunt <hunt>2006-03-24 18:43:52 +0000
commit91a86037758d6a1275c78d96021664fc0ab72da2 (patch)
tree408e6b19e82fb9a6877a20286003d0c55d1fb5ff /runtime/bench2/bench.rb
parentaec2a55145df788d9d71bd8009ae97c64a1d2104 (diff)
downloadsystemtap-steved-91a86037758d6a1275c78d96021664fc0ab72da2.tar.gz
systemtap-steved-91a86037758d6a1275c78d96021664fc0ab72da2.tar.xz
systemtap-steved-91a86037758d6a1275c78d96021664fc0ab72da2.zip
2006-03-24 Martin Hunt <hunt@redhat.com>
Patch from Gui,Jian <guij@cn.ibm.com> * bench2/bench.rb: PPC64 fixes.
Diffstat (limited to 'runtime/bench2/bench.rb')
-rw-r--r--runtime/bench2/bench.rb30
1 files changed, 20 insertions, 10 deletions
diff --git a/runtime/bench2/bench.rb b/runtime/bench2/bench.rb
index cf1fb90d..dbda5e13 100644
--- a/runtime/bench2/bench.rb
+++ b/runtime/bench2/bench.rb
@@ -149,9 +149,14 @@ 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}
-static struct kprobe kp[] = {\n {\n .addr = \"sys_getuid\",
- .pre_handler = inst_sys_getuid\n }\n};\n
+ 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"
@@ -185,8 +190,17 @@ obj-m := bench.o
else
@@num_threads = [1]
end
- physical_cpus=`grep "physical id" /proc/cpuinfo`.split("\n").uniq.length
- model=`grep "model name" /proc/cpuinfo`.match(/(model name\t: )([^\n]*)/)[2]
+ arch=`uname -m`.strip
+ if (arch.match(/ppc64/))
+ cpu=`grep "cpu" /proc/cpuinfo`.match(/(cpu\t\t: )([^\n]*)/)[2]
+ clock=`grep "clock" /proc/cpuinfo`.match(/(clock\t\t: )([^\n]*)/)[2]
+ revision=`grep "revision" /proc/cpuinfo`.match(/(revision\t: )([^\n]*)/)[2]
+ cpuinfo=cpu + " " + clock + " revision: " + revision
+ else
+ physical_cpus=`grep "physical id" /proc/cpuinfo`.split("\n").uniq.length
+ model=`grep "model name" /proc/cpuinfo`.match(/(model name\t: )([^\n]*)/)[2]
+ cpuinfo="(#{physical_cpus} physical) #{model}"
+ end
puts "SystemTap BENCH2 \t" + `date`
puts "kernel: " + `uname -r`.strip + " " + `uname -m`.strip
begin
@@ -195,11 +209,7 @@ obj-m := bench.o
end
puts `uname -n`.strip + ": " + `uptime`
- if nproc > 1
- puts "processors: #{nproc} (#{physical_cpus} physical) #{model}"
- else
- puts "processors: #{nproc} #{model}"
- end
+ puts "processors: #{nproc} #{cpuinfo}"
begin
mem=IO.read("/proc/meminfo").split("\n")