| 1 |
#!/usr/bin/env stap |
| 2 |
# |
| 3 |
# Copyright (C) 2011 Red Hat, Inc. |
| 4 |
# Written by William Cohen <[email protected]> |
| 5 |
# |
| 6 |
# The qemu_io.stp script tallies the number of times each of the IO |
| 7 |
# port on the guest virtual machines is touched by a input or output |
| 8 |
# operation. When the script exits, it prints a count of the number of |
| 9 |
# times each IO port read and written. |
| 10 |
|
| 11 |
global cpu_in, cpu_out |
| 12 |
probe qemu.*.*.cpu_in?, qemu.kvm.cpu_in? { cpu_in[addr]++ } |
| 13 |
probe qemu.*.*.cpu_out?, qemu.kvm.cpu_out? {cpu_out[addr]++ } |
| 14 |
probe end { |
| 15 |
# write out the data |
| 16 |
printf("\ncpu_in\n%6s %8s\n","port", "count") |
| 17 |
foreach (addr+ in cpu_in) |
| 18 |
printf("0x%04x %8d\n", addr, cpu_in[addr]) |
| 19 |
printf("\ncpu_out\n%6s %8s\n","port", "count") |
| 20 |
foreach (addr+ in cpu_out) |
| 21 |
printf("0x%04x %8d\n", addr, cpu_out[addr]) |
| 22 |
} |