Matthew Seaman wrote: > On Wed, Sep 03, 2003 at 06:53:09PM -0400, Jesse Guardiani wrote: >> Howdy list, >> >> I'm a Sys Admin running FreeBSD 4.8-RELEASE >> servers. >> >> During a recent programming/installation >> project, I found myself wanting to know >> the peak memory usage of a given command/process. >> >> Is there any way to gather this information >> without recompiling an application with a >> sleep or wait statement at the (assumed) >> point of peak memory usage and then looking >> at the process with 'ps'? > > That depends on exactly how much time you've got to record the peak > memory usage. If it's going to be changing faster than you could > catch just by running ps(1) -- like: > > % ps -p NNN -o rsz > > where NNN is the pid of your process, then you're probably going to > have to interrupt the process somehow. You can do that by attaching > to the process using gdb(1), eg: > > % gdb PROGNAME NNN > > this will stop the process and leave you in the debugger at the > current program counter. You'ld have to create a break point when the > program calls malloc(3) or friends, continue running until it hits the > break point, step over the malloc call, check the size using ps(1), > and then continue running again until the next malloc(3) call. Repeat > until the program ends. See the gdb info pages for the gory details. > Nb. this whole thing with gdb(1) is going to be a great deal easier if > you have the source code to your program available and you can run an > unstripped binary. Doing such a trick on a stripped binary is getting > into real guru territory. Programs run a lot slower when attached in > a debugger, plus if the program makes heavy use of malloc, it's going > to get really tedious very quickly.
Thanks for the reply, Matthew. Sorry for the misleading subject. I meant to post a different message under that subject. "process memory peak recording" should have been the subject for this message. I'm not sure if that was a bug in my human CPU or a bug in KNode... :) Anyway, I was really hoping that someone would write me back and tell me that there is already some voodoo kernel debugging switch that I could turn on to let me log/record peak memory usage for a particular process. I guess you're saying that isn't the case though, right? Sincerely, -- Jesse Guardiani, Systems Administrator WingNET Internet Services, P.O. Box 2605 // Cleveland, TN 37320-2605 423-559-LINK (v) 423-559-5145 (f) http://www.wingnet.net _______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"