Patch to add profiling support to PHP at the PHP level

From: Date: Sun, 28 Jul 2002 12:15:44 +0000
Subject: Patch to add profiling support to PHP at the PHP level
Groups: php.dev 
Request: Send a blank email to php-dev+get-86268@lists.php.net to get a copy of this message
Hello, I made a patch to add PHP profiling support to the PHP language. It adds 'set_profile_handler' and 'restore_profile_handler' that work similar to the 'set_error_handler' and 'restore_error_handler' functions and are the minimum needed to allow people to profile their PHP code directly from PHP. The rationale behind adding support to the PHP language for this rather than doing it behind the scenes with C modules is to give people a lot of flexibility over the profiling of their applications and the resulting data. It makes it really easy to do things like save the result to your application's database, profile only on certain conditions and/or for certain users, and lets you easily display the profiling report on the same page that was profiled for example, which saves developers from having to cross-reference profiling logs all the time. The patch, an example profiler that uses it written in PHP, and some example screenshots of that are at: http://www-cse.ucsd.edu/~sbrown/profiler/php-profiler.html The patch is against 4.2.1 and 4.1.2, but is clean on 4.2.2 and surely many other versions. I wasn't sure how PHP's symbol table is affected by function calls, so I strduped the function name and file name across the function call to make sure nothing bad would happen to them. While it works fine, that information is probably preserved somewhere already so the strdups could be removed.

« previous php.dev (#86268) next »