Hey Brian,

As Rod suggested, you could probably use DTrace to help solve the problem.

I might start my investigation with a script like this:

---8<--- dlopen.d ---8<---

#!/usr/sbin/dtrace -s

pid$1::dlopen:entry
/copyinstr(arg0) == "mylib.so"/
{
        self->ts = timestamp;
}

syscall:::
/self->ts/
{
        trace(timestamp - self->ts);
}

pid$1::dlopen:return
/self->ts/
{
        self->ts = 0;
}

---8<--- dlopen.d ---8<---

Obviously, you'll want to change "mylib.so" to the name of the shared
library firefox is opening (you can just remove that predicate if you want
to see the results for all calls to dlopen()). Then you can run the
script like this:

# ./dlopen.d `pgrep -n firefox`

... or something similar. It may be that one system call is really taking
a bunch of time. If that's not the case, you can replace 'syscall:::' (all
system call entries and returns) with 'pid$1:::entry,pid$1:::return' to see
the results for all function calls in the linker as a result of the dlopen().

If you get stuck with DTrace you may want to head over to the DTrace
discussion forum (dtrace-discuss at opensolaris.org).

Adam

On Thu, Nov 24, 2005 at 09:46:36PM +0800, brian.lu wrote:
> Hi, experts,
> 
> I have a question. When studying firefox startup performance, I found 
> that ld.so.1 spent more than 1 second  to load some shared library. This 
> libraries is loaded by dlopen().
> How can I know what's the most time consuming operation in this loading?
> 
> Thanks
> 
> Brian
> 
> 
> _______________________________________________
> tools-linking mailing list
> tools-linking at opensolaris.org

-- 
Adam Leventhal, Solaris Kernel Development       http://blogs.sun.com/ahl

Reply via email to