Re: GDB using a lot of CPU time and writing a lot to disk on startup

Nick Savoiu
2009-04-21T16:26:53Z

----- Original Message ----

> From: Mark Kettenis <mark.kettenis@xs4all.nl>
> > From: Nick Savoiu
> >
> > PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
> > 2381 nsavoiu 15 0 594m 424m 34m S 0 10.9 0:49.13 kdevelop
> > 2381 nsavoiu 16 0 594m 424m 34m S 1 10.9 0:49.31 kdevelop
> >
> > 7810 nsavoiu 16 0 140m 130m 2472 S 22 3.4 0:03.92 gdb
> > 7810 nsavoiu 16 0 634m 622m 2536 S 73 16.0 1:51.12 gdb
>
> Heh, if memory consumption is to blame, kdevelop is about as guilty as
> gdb ;)
>
> > 7816 nsavoiu 25 0 153m 138m 61m T 0 3.6 0:08.23 kernel
> > 7816 nsavoiu 25 0 153m 138m 61m T 0 3.6 0:08.23 kernel
> >
> > so my best guess was GDB given where the CPU times went. No other processes
> were running actively and there was enough memory
> >
> > Mem: 3975148k total, 3372012k used, 603136k free, 86136k buffers
> > Swap: 8385848k total, 756112k used, 7629736k free, 1407932k cached
> >
> > so swapping should not be an issue.
>
> Well, your system *is* using swap. Are you running Linux? I wouldn't
> be surprised if it is swapping out kdevelop because gdb is the active
> application and is reading in a lot of debugging info.

Mark, I highly doubt that it's swapping. The system has plenty of memory (the snapshot above is at the end of the run) and swap usage had not changed throughout. More so the memory amounts involved should not account for 10 minutes of continuous disk writes on a machine that is otherwise very fast (both in CPU and disk).

What's puzzling is that an identical project on the same machine does not exhibit the same behavior. GDB gets to the 'main' breakpoint in 15-20 seconds with very mild disk activity. Is there a way to make gdb dump a trace/log of its activities?

Nick