* nptl threads, gdb, Nsquared
@ 2004-10-04 20:44 David Anderson
2004-10-05 13:29 ` Andrew Cagney
0 siblings, 1 reply; 2+ messages in thread
From: David Anderson @ 2004-10-04 20:44 UTC (permalink / raw)
To: gdb
I'd be pleased to be wrong here. but it seems that with nptl
pthreads apps under gdb on GNU/Linux that (oversimplifing
significantly) register saving is N-squared:
Say there are N registers (around 300 for Intel Itanium)
regcache_save(), for each register call do_cooked_read()
For each register,i.e, N times, do_cooked_read calls
thread_db_fetch_registers calls on libthread_db.so requesting
all registers (libthread_db.so calls back to ps_lgetregs() in gdb
which requests _all_ registers and calls to thread_db_fetch_registers).
For each register fetch_register () in inf_ptrace.c
is called (Loading is now N**2) .
So each register fetch of 300 regs results in fetching 300*300 registers.
This is painfully slow.
Have I got this all wrong?
I presume this is well known though.
Comments? References to gdb threads/bug-reports?
Thanks.
David Anderson davea at sgi dot com.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: nptl threads, gdb, Nsquared
2004-10-04 20:44 nptl threads, gdb, Nsquared David Anderson
@ 2004-10-05 13:29 ` Andrew Cagney
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cagney @ 2004-10-05 13:29 UTC (permalink / raw)
To: David Anderson; +Cc: gdb
> I'd be pleased to be wrong here. but it seems that with nptl
> pthreads apps under gdb on GNU/Linux that (oversimplifing
> significantly) register saving is N-squared:
>
> Say there are N registers (around 300 for Intel Itanium)
>
> regcache_save(), for each register call do_cooked_read()
> For each register,i.e, N times, do_cooked_read calls
> thread_db_fetch_registers calls on libthread_db.so requesting
> all registers (libthread_db.so calls back to ps_lgetregs() in gdb
> which requests _all_ registers and calls to thread_db_fetch_registers).
> For each register fetch_register () in inf_ptrace.c
> is called (Loading is now N**2) .
>
> So each register fetch of 300 regs results in fetching 300*300 registers.
>
> This is painfully slow.
>
> Have I got this all wrong?
> I presume this is well known though.
> Comments? References to gdb threads/bug-reports?
The code fetching all registers should have marked each register as
valid as it was extracted from the inferior - see regcache_raw_supply.
Consequently later reads are [should] be pulled from the regcache
avoiding the expensive ptrace call.
(btw, infptrace.c, not inf-ptrace.c) (which reminds me ...)
> Thanks.
> David Anderson davea at sgi dot com.
Andrew
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-10-05 13:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-04 20:44 nptl threads, gdb, Nsquared David Anderson
2004-10-05 13:29 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).