File: qemu_io.stp

package info (click to toggle)
systemtap 3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 32,860 kB
  • ctags: 12,513
  • sloc: cpp: 58,610; ansic: 58,189; exp: 37,322; sh: 10,633; xml: 7,771; perl: 2,252; python: 2,066; tcl: 1,305; makefile: 969; lisp: 105; java: 100; awk: 94; asm: 91; sed: 16
file content (22 lines) | stat: -rwxr-xr-x 785 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env stap
#
# Copyright (C) 2011 Red Hat, Inc.
# Written by William Cohen <wcohen@redhat.com>
#
# The qemu_io.stp script tallies the number of times each of the IO
# port on the guest virtual machines is touched by a input or output
# operation. When the script exits, it prints a count of the number of
# times each IO port read and written.

global cpu_in, cpu_out
probe qemu.*.*.cpu_in?, qemu.kvm.cpu_in? { cpu_in[addr]++ }
probe qemu.*.*.cpu_out?, qemu.kvm.cpu_out? {cpu_out[addr]++ }
probe end {
  # write out the data
  printf("\ncpu_in\n%6s %8s\n","port", "count")
  foreach (addr+ in cpu_in)
    printf("0x%04x %8d\n", addr, cpu_in[addr])
  printf("\ncpu_out\n%6s %8s\n","port", "count")
  foreach (addr+ in cpu_out)
    printf("0x%04x %8d\n", addr, cpu_out[addr])
}