From Troubleshooting systemd with SystemTap.
systemd-bus.stp
##############################################################################
#
# Monitor bus->rqueue_size and bus->wqueue_size in systemd
#
# Author: Mark R. Bannister, Jane Street Group LLC.
#
##############################################################################
function header()
{
printf("--- %s ---\n", tz_ctime(gettimeofday_s()))
printf("\n%6s %-25s %6s %6s %s\n", "PID", "FUNCTION", "RQUEUE", "WQUEUE", "RETURN")
}
function get_errstr(retval)
{
if (retval<0) return errno_str(-retval)
return sprintf("%d", retval)
}
probe begin { header() }
probe timer.ms($1) { header() }
probe process("/usr/lib/systemd/systemd").function("dispatch_rqueue").inline
{
printf("%6d %-25s %6u %6u %s\n", pid(), ppfunc(),
$bus->rqueue_size,
$bus->wqueue_size, "-")
}
probe process("/usr/lib/systemd/systemd").function("bus_rqueue_make_room").return,
process("/usr/lib/systemd/systemd").function("bus_send_internal").return,
process("/usr/lib/systemd/systemd").function("bus_kernel_make_message").return,
process("/usr/lib/systemd/systemd").function("bus_kernel_write_message").return,
process("/usr/lib/systemd/systemd").function("translate_reply").return,
process("/usr/lib/systemd/systemd").function("push_name_owner_changed").return,
process("/usr/lib/systemd/systemd").function("bus_socket_make_message").return,
process("/usr/lib/systemd/systemd").function("sd_bus_call").return
{
printf("%6d %-25s %6u %6u %s\n", pid(), ppfunc(),
@entry($bus->rqueue_size),
@entry($bus->wqueue_size),
get_errstr($return))
}