This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: BZ#2421 - removing duplicate probe handlers
On Wed, 2006-08-02 at 16:03 +0800, Li Guanglei wrote:
> David Smith åé:
> > On Fri, 2006-07-21 at 14:13 -0500, David Smith wrote:
> > [...]
> > I've been working on this and here's an update.
> >
> > I made a stab at removing duplicate functions. I cheated and just
> > hashed the args/body of functions to do comparisons. All duplicate
> > functions are redirected to the first copy found. A patch is attached.
> >
> > I'd appreciate any code comments.
> >
>
> Hi David,
>
> I tried this stap script:
>
> probe kernel.function("sys_read"), kernel.function("sys_write")
> {
> log("here")
> }
>
> but stap will still generate duplicated handlers after applying your
> patch.
>
> sys_read-->enter_probe_896-->probe_896
> sys_write-->enter_probe_897-->probe_897
>
> enter_probe_896 and probe_896 are exactly a copy of enter_probe_897
> and probe_897. It seems to me that this patch will determine if a
> function is duplicated with another function by hashing its function
> names and arguments. So semantic_pass_opt5 will think that
> enter_probe_896 and enter_probe_897 are different and didn't optimize
> for it. If so, maybe we have to do this optimization a little earlier,
> say, in semantic_pass_symbols() before calling
> semantic_pass_optimize(). Am I right?
>
> - Guanglei
You are correct, the patch currently doesn't try to do probe merging at
all, because of the conceptual problems I listed. What it does do is
remove duplicate functions. So this script:
probe kernel.function("sys_read").return,
kernel.function("sys_write").return
{
printf("return is %d", $return)
}
will only end up with 1 function to get the value of $return instead of
2.
--
David Smith
dsmith@redhat.com
Red Hat, Inc.
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)