]>
sourceware.org Git - systemtap.git/blob - testsuite/systemtap.base/perf.sh
3 # The declaration order should be irrelevant. Run the script twice, each with
4 # a different counter declaration order, counting the insns and cycles. For
5 # each run get the difference between cycles and insns and find the the largest
6 # term, e.g. 53874->50000. Check that this term is equal for both runs.
7 # Caveat: possible false negative, if one run yields e.g. 59975->50000 and the
8 # other yields 600200>600000
13 for i
in "first" "second"; do
14 perfresult
[$i]=$
($STAP -g -c "/bin/cat $0 >/dev/null" -e '
18 probe perf.hw.instructions.process("/bin/cat").counter("find_insns") {}
19 probe perf.hw.cpu_cycles.process("/bin/cat").counter("find_cycles") {}
21 probe perf.hw.cpu_cycles.process("/bin/cat").counter("find_cycles") {}
22 probe perf.hw.instructions.process("/bin/cat").counter("find_insns") {}
25 function poly (val) %{ /* unprivileged */
31 for (root = 1; root < __LONG_MAX__; root *= 10)
34 STAP_RETURN ((root/10) * (j / (root/10)));
39 probe process("/bin/cat").function("main")
41 insn["find_insns"] = @perf("find_insns")
42 insn["find_cycles"] = @perf("find_cycles")
46 probe process("/bin/cat").function("main").return
48 insn["find_cycles"] = (@perf("find_cycles") - insn["find_cycles"])
49 insn["find_insns"] = (@perf("find_insns") - insn["find_insns"])
54 printf ("%d\n", poly(insn["find_cycles"]-insn["find_insns"]))
59 if [ "${perfresult['first']}" == "${perfresult['second']}" ] ; then
60 echo PASS
: ${perfresult["first"]}
62 echo UNRESOLVED
: ${perfresult["first"]} ${perfresult["second"]}
This page took 0.03919 seconds and 5 git commands to generate.