11.7.3.3 signal-send

The following example shows how you can use the signal-send probe to determine the sending and receiving of process associated with any signal. Type the following D source code and save it in a file named sig.d:

#pragma D option quiet

proc:::signal-send
{
  @[execname, stringof(args[1]->pr_fname), args[2]] = count();
}

END
{
  printf("%20s %20s %12s %s\n",
      "SENDER", "RECIPIENT", "SIG", "COUNT");
  printa("%20s %20s %12d %@d\n", @);
}

Running this script results in output similar to the following:

# dtrace -s sig.d
^C
              SENDER            RECIPIENT          SIG COUNT
         gnome-panel                 Xorg           29 1
         kworker/0:2               dtrace            2 1
                Xorg                 Xorg           29 3
                java                 Xorg           29 6
             firefox                 Xorg           29 14
         kworker/0:0                 Xorg           29 1135