|
From: Konstantin S. <kon...@gm...> - 2009-10-13 19:18:32
|
On Tue, Oct 13, 2009 at 5:54 PM, John Reiser <jr...@bi...> wrote: > > > I need to know how much memory is taken by a valgrind process from > > inside that process. And I need it to be fast. > > How fast? > > > One option is to read /proc/self/status and extract the VmSize field. > > Slow, bad. > > Doing a pread(,,,0) and parsing the result via strstr+atoi should take > about 1 microsecond. Hm. Perhaps. I did not think about opening this file for the duration of the run... :) I need to check the occupied memory very often so that the tool can react accordingly when the memory is close to its limit. pread+strstr+atoi might be fast enough. Need to check... > > Open /proc/self/status once at the beginning, > and keep it open for the zillions of calls you'll be making. > Or does pread fail for files in /proc? > > > Another option is to keep track of valgrind's VG(malloc) and users's > > malloc, etc. Easy to loose something, bad. > > If you do not trust valgrind internal code then why run it at all? Is there such functionality in valgrind core already? I need to get the number very close to the one in /proc/self/status:VmSize Thanks! --kcc > > -- > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Valgrind-developers mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-developers |