Re: [benchmarks] Memory handling and cachegrind parsing

From: Date: Wed, 17 Jun 2009 13:01:18 +0000
Subject: Re: [benchmarks] Memory handling and cachegrind parsing
References: 1 2  Groups: php.qa 
Request: Send a blank email to php-qa+get-65102@lists.php.net to get a copy of this message
On Wed, Jun 10, 2009 at 11:40 PM, Nuno Lopes <nlopess@php.net> wrote: > Hi, > > I've added the diffs to bench.php here as well as the cachegrindparser.php >> and smapsparser.php. None of these are completely implemented, but I'm on >> my >> way and think it's good to hear some feedback here. The cachegrind usage >> has >> no output at all currently. >> > > cool progress so far :) > BTW, you don't need to use OOP everywhere :) Just because they teach that > Java is the only solution to world's problems, it doesn't mean you should > use classes everywhere (I'm pointing particularly to your cachegrind > parser). > Hehe, I thought that might be the case :D I'll try to be less object oriented when it's not needed, it's just the way I was taught :> > > > I chose to implement the smaps memory handling because I couldn't find >> anything that was suiting better. If there would have been a fast tool >> that >> worked on windows as well as linux, it would have been better, but since >> google used this in their "unladen shadow" project, I thought it was a >> good >> idea to do it here as well. It works by sampling the memory data during >> the >> runs and place the info in an array, which then takes the maximum memory >> usage and prints it along with the files that consumed the most memory >> during that time. >> > > sounds good. please add a note somewhere that it requires linux 2.6.14 or > newer. > I've added that now > > > > There is one "problem" about the pid for the test processes. I have to use >> "pid + 1" to get the actual pid, since the "pid" is just the shell >> execution >> and "pid + 1" is the real php execution. Could this be a problem? >> > > You cannot rely on that. First, some kernels do PID randomization. Second, > PIDs often overflow, and then they wrap-around. > In summary, you have no way (that I'm aware) to know the PID of the php > process. What you can do is to skip the shell and spawn the php process > directly (I guess I never implemented this in PHP in linux - although it's > implemented for windows - but I think I can take a look now). > I solved it now (for linux.. but the memory statistics will only work for linux anyway) by using "ps" to get the child process PID of the shell command. Right now it's hardcoded to only support one child, but in the future it is possible to check memory usage of further spawned processes as well I believe. > > Nuno I'm sorry for the late response here, I got totally stuck with the, for me, horrible v8-crypto port :)

« previous php.qa (#65102) next »