libguestfs User-Space Markers

libguestfs includes support for SystemTap user-space markers and are enabled in current versions of Fedora and Red Hat Enterprise Linux 7. The markers allow SystemTap to probe various steps in libguestfs operation. Below is an listing of the libguestfs events available on RHEL7:

$ stap -L 'process("/usr/lib*/libguestfs.so.*").mark("*")'
process("/usr/lib64/libguestfs.so.0.471.0").mark("launch_build_appliance_end")
process("/usr/lib64/libguestfs.so.0.471.0").mark("launch_build_appliance_start")
process("/usr/lib64/libguestfs.so.0.471.0").mark("launch_build_libvirt_appliance_end")
process("/usr/lib64/libguestfs.so.0.471.0").mark("launch_build_libvirt_appliance_start")
process("/usr/lib64/libguestfs.so.0.471.0").mark("launch_build_libvirt_qcow2_overlay_end")
process("/usr/lib64/libguestfs.so.0.471.0").mark("launch_end")
process("/usr/lib64/libguestfs.so.0.471.0").mark("launch_libvirt_end")
process("/usr/lib64/libguestfs.so.0.471.0").mark("launch_libvirt_start")
process("/usr/lib64/libguestfs.so.0.471.0").mark("launch_run_qemu")
process("/usr/lib64/libguestfs.so.0.471.0").mark("launch_start")

Using libguestfs User-Space Markers

To use the libguestfs user-space markers on Fedora you will need:

Examples and Demonstrations of Markers

The following libguestfs_log.stp script will log each time one of the libguestfs user-space markers is encountered.

global start_time, prev;

function display_time () {
  now = gettimeofday_us ()
  delta = (prev > 0 ) ? now - prev : 0
  printf ("%18d (+%10d): ", now - start_time, delta)
  prev = now
}

probe begin {
  start_time = gettimeofday_us ()
  prev = 0
  printf ("%-18s (+%10s): %s\n", "# time_usec",
          "delta usec", "event")
}

probe process("/usr/lib*/libguestfs.so.0*").mark("*")
{
  display_time()
  printf ("%s\n", $$name)
}

In one terminal window start the script. Once the header is printed indicating the script is started in another window run guestfish -N fs :

$ stap libguestfs_log.stp
# time_usec        (+delta usec): event
           3275625 (+         0): launch_start
           3275683 (+        58): launch_libvirt_start
           3554578 (+    278895): launch_build_libvirt_appliance_start
           3563691 (+      9113): launch_build_libvirt_appliance_end
           3569845 (+      6154): launch_build_libvirt_qcow2_overlay_end
           4795301 (+   1225456): launch_libvirt_end
^C$

References

None: LibGuestFSMarkers (last edited 2018-09-25 15:23:23 by WilliamCohen)