[xdebug-general] Re: [Slightly OT] Production Application Metrics

From: Derick Rethans <derick[@]xdebug.org>
Date: Wed, 29 Jul 2009 11:34:50 +0100 (BST)

On Tue, 28 Jul 2009, Morgan Tocker wrote:

>  If you have any data on this, I'd be interested to hear it ;)  In a
> perfect world, what I would like to do is to be able to register hooks
> on functions so that I can just start and stop timers:
>
> <?php
>
> function my_callback_function($function_name, [args]) {
>  // Can start and stop timers here.
> }
>
> function my_callback_function_exit($function_name, [args]) {
>  // Can start and stop timers here.
> }
>
> register_callback_function_start('mysql_query', 'my_callback_function');
> register_callback_function_exit('mysql_query', 'my_callback_function_exit');
>
> register_callback_function_start('file', 'my_callback_function');
> register_callback_function_exit('file', 'my_callback_function_exit');
>
> ?>
>
> Reading the Xdebug source, this should be fairly easy to do?

Yes, it's quite easy... however using callbacks makes things slow. It
might better to let the C-extension handle the timer counting as well.
It would probably be better to provide one method to enable a timer for
each function passed in an array or so, and another one to retrieve
statistics.

regards,
Derick

-- 
Like Xdebug? Send a postcard: http://derickrethans.nl/xdebug_2_released.php
Xdebug | http://xdebug.org | xdebug-general@lists.xdebug.org
twitter: @derickr and @xdebug
Received on Wed Jul 29 2009 - 12:34:55 BST

This archive was generated by hypermail 2.2.0 : Mon Jun 25 2018 - 06:00:04 BST