This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: duplicate body remover


Li Guanglei wrote:
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().

This actually already exists, it just happens at a later stage. If you look at the generated C code, you'll see something like this:


=================
static void probe_1480 (struct context * __restrict__ c) {
... normal systemtap initialization plus code to do 'log("here")' ...
}

...

static void probe_1481 (struct context * __restrict__ c) {
  probe_1480 (c);
}
=================

--
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]