Hi,
today when I tried to shrink the size of the generate .c file from
stap, I met some problems. One of them is the lack of removing
duplicated probe bodies across different probes. Here is an example:
probe kernel.function("netif_receive_skb"),
kernel.function("dev_queue_xmit")
{
log("here")
}
stap -p2 -v shows the output is:
# functions
log:unknown (msg:string)
%{
_stp_printf ("%s\n", THIS->msg);
%}
# probes
kernel.function("netif_receive_skb@net/core/dev.c:1673")
{
log("here")
}
kernel.function("dev_queue_xmit@net/core/dev.c:1318")
{
log("here")
}
But I think stap should further optimize it as:
# functions
log:unknown (msg:string)
%{
_stp_printf ("%s\n", THIS->msg);
%}
# probes
kernel.function("netif_receive_skb@net/core/dev.c:1673"),
kernel.function("dev_queue_xmit@net/core/dev.c:1318")
{
log("here")
}
How about having a new class duplicate_body_remover, and a new function
get_bodysig() to determine the duplication of probe body? Much of the
logic could resemble the current duplicated function removing codes
called inside semantic_pass_opt5().