On rawhide (3.11.0-0.rc6.git4.1.fc21.x86_64), although the perf.exp testcase passes, the log file shows several errors, like 'ERROR: _stp_perf_read': ==== spawn /usr/local/bin/stap -c towers.x -e global towers global main probe perf.hw.instructions.process("towers.x").counter("a") { counter_a += 1 } probe perf.hw.instructions.process("towers.x").counter("b") { counter_b += 1 } probe process("towers.x").statement("towers@towers.c") { towers <<< @perf("a") } probe process("towers.x").statement("main@towers.c") { main <<< @perf("b") } probe end { printf("count main=%d\ncount towers=%d\ncounter %d/%d\n", @count(main), @count(towers), counter_a, counter_b) printf("min main=%d\nmin towers=%d\n", @min(main), @min(towers)) printf("max main=%d\nmax towers=%d\n", @max(main), @max(towers)) } WARNING: Statements in perf counter probe will never be reached.: operator '{' at /usr/local/share/systemtap/tapset/linux/perf.stp:12:60^M source: probe perf.hw.instructions = perf.type(0).config(1) { } ^ WARNING: never-assigned local variable 'counter_a' (alternatives: counter_b towers main): identifier 'counter_a' at <input>:28:36 source: @count(main), @count(towers), counter_a, counter_b) ^ WARNING: never-assigned local variable 'counter_b' (alternatives: counter_a towers main): identifier 'counter_b' at :28:47 source: @count(main), @count(towers), counter_a, counter_b) ^ WARNING: perf probe 'perf.type(0).config(1).sample(0).process("towers.x").counter("b")' is not supported by this kernel (-2). WARNING: perf probe 'perf.type(0).config(1).sample(0).process("towers.x").counter("a")' is not supported by this kernel (-2). ERROR: _stp_perf_read ERROR: _stp_perf_read ERROR: _stp_perf_read ERROR: _stp_perf_read ERROR: _stp_perf_read ERROR: _stp_perf_read ERROR: _stp_perf_read ERROR: _stp_perf_read ERROR: _stp_perf_read ERROR: _stp_perf_read ERROR: _stp_perf_read ERROR: _stp_perf_read count main=1 count towers=19 counter 0/0 min main=0 min towers=0 max main=0 max towers=0 ERROR: _stp_perf_read ERROR: _stp_perf_read ERROR: _stp_perf_read ERROR: _stp_perf_read ERROR: _stp_perf_read ERROR: _stp_perf_read ERROR: _stp_perf_read ERROR: _stp_perf_read WARNING: /usr/local/bin/staprun exited with status: 1 Pass 5: run failed. [man error::pass5] ====
Created attachment 7177 [details] full systemtap.log Here's the full systemtap.log from that test run.
From some further investigation, it looks like these errors are expected. Those error messages are output since those hw perf counter probes don't work on this virtual machine.
RHEL6 machines don't seem to make the performance counters available to guests. However, for newer versions of Fedora running as the host it is possible to use the performance counters in a guest. When the guest VM is shutdown in libvirt. View->Details for the guest VM. On the details Select Processor, then hit the "Copy host CPU configuration". Then you can start up the guest VM. So for a RHEL6 guest on a F19 host: $ perf stat ls Performance counter stats for 'ls': 0.680177 task-clock # 0.728 CPUs utilized 0 context-switches # 0.000 K/sec 0 cpu-migrations # 0.000 K/sec 242 page-faults # 0.356 M/sec 1,138,470 cycles # 1.674 GHz 1,334,983 stalled-cycles-frontend # 117.26% frontend cycles idle 1,162,180 stalled-cycles-backend # 102.08% backend cycles idle 932,252 instructions # 0.82 insns per cycle # 1.43 stalled cycles per insn 189,550 branches # 278.677 M/sec 10,156 branch-misses # 5.36% of all branches [37.47%] 0.000933886 seconds time elapsed However, the numbers do look a bit off for stalled-cycles-frontend and stalled-cycles-backend.