Tideways.php
public static function watchCallback($function, $callback)
    {
        if (self::$extension === self::EXTENSION_TIDEWAYS) {
            self::$defaultOptions['callbacks'][$function] = $callback;

            if ((self::$mode & self::MODE_TRACING) > 0) {
                tideways_span_callback($function, $callback);
            }
        }
    }
public static function watchCallback($function, $callback)
    {
        if (self::$extension === self::EXTENSION_TIDEWAYS) {
            self::$defaultOptions['callbacks'][$function] = $callback;

            if ((self::$mode & self::MODE_TRACING) > 0) {
                tideways_span_callback($function, $callback);
            }
        }
    }
public static function watchCallback ( $ function , $ callback ) { if ( self :: $ extension === self :: EXTENSION_TIDEWAYS ) { self :: $ defaultOptions [ 'callbacks' ] [ $ function ] = $ callback ; if ( ( self :: $ mode & self :: MODE_TRACING ) > 0 ) { tideways_span_callback ( $ function , $ callback ) ; } } }
Watch a function and invoke a callback when its called.

To start a span, call {@link \Tideways\Profiler::createSpan($category)}
inside the callback and return {$span->getId()}:

@example

\Tideways\Profiler::watchCallback('mysql_query', function ($context) {
$span = \Tideways\Profiler::createSpan('sql');
$span->annotate(array('title' => $context['args'][0]));
return $span->getId();
});
Watch a function and invoke a callback when its called .