Tideways.php
public static function start($options = array(), $sampleRate = null)
    {
        self::ignoreTransaction(); // this discards any data that was collected up to now and restarts.

        if (!is_array($options)) {
            $options = array('api_key' => $options);
        }
        if ($sampleRate !== null) {
            $options['sample_rate'] = $sampleRate;
        }

        $defaults = array(
            'api_key' => isset($_SERVER['TIDEWAYS_APIKEY']) ? $_SERVER['TIDEWAYS_APIKEY'] : ini_get("tideways.api_key"),
            'sample_rate' => isset($_SERVER['TIDEWAYS_SAMPLERATE']) ? intval($_SERVER['TIDEWAYS_SAMPLERATE']) : (ini_get("tideways.sample_rate") ?: 0),
            'collect' => isset($_SERVER['TIDEWAYS_COLLECT']) ? $_SERVER['TIDEWAYS_COLLECT'] : (ini_get("tideways.collect") ?: self::MODE_PROFILING),
            'monitor' => isset($_SERVER['TIDEWAYS_MONITOR']) ? $_SERVER['TIDEWAYS_MONITOR'] : (ini_get("tideways.monitor") ?: self::MODE_BASIC),
            'triggered' => self::MODE_FULL,
            'log_level' => ini_get("tideways.log_level") ?: 0,
            'service' => isset($_SERVER['TIDEWAYS_SERVICE']) ? $_SERVER['TIDEWAYS_SERVICE'] : ini_get("tideways.service"),
            'framework' => isset($_SERVER['TIDEWAYS_FRAMEWORK']) ? $_SERVER['TIDEWAYS_FRAMEWORK'] : ini_get("tideways.framework"),
        );
        $options = array_merge($defaults, $options);

        if (strlen((string)$options['api_key']) === 0) {
            return;
        }

        self::$logLevel = $options['log_level'];
        self::init($options['api_key'], $options);
        self::decideProfiling($options['sample_rate'], $options);
    }
public static function start($options = array(), $sampleRate = null)
    {
        self::ignoreTransaction(); // this discards any data that was collected up to now and restarts.

        if (!is_array($options)) {
            $options = array('api_key' => $options);
        }
        if ($sampleRate !== null) {
            $options['sample_rate'] = $sampleRate;
        }

        $defaults = array(
            'api_key' => isset($_SERVER['TIDEWAYS_APIKEY']) ? $_SERVER['TIDEWAYS_APIKEY'] : ini_get("tideways.api_key"),
            'sample_rate' => isset($_SERVER['TIDEWAYS_SAMPLERATE']) ? intval($_SERVER['TIDEWAYS_SAMPLERATE']) : (ini_get("tideways.sample_rate") ?: 0),
            'collect' => isset($_SERVER['TIDEWAYS_COLLECT']) ? $_SERVER['TIDEWAYS_COLLECT'] : (ini_get("tideways.collect") ?: self::MODE_PROFILING),
            'monitor' => isset($_SERVER['TIDEWAYS_MONITOR']) ? $_SERVER['TIDEWAYS_MONITOR'] : (ini_get("tideways.monitor") ?: self::MODE_BASIC),
            'triggered' => self::MODE_FULL,
            'log_level' => ini_get("tideways.log_level") ?: 0,
            'service' => isset($_SERVER['TIDEWAYS_SERVICE']) ? $_SERVER['TIDEWAYS_SERVICE'] : ini_get("tideways.service"),
            'framework' => isset($_SERVER['TIDEWAYS_FRAMEWORK']) ? $_SERVER['TIDEWAYS_FRAMEWORK'] : ini_get("tideways.framework"),
        );
        $options = array_merge($defaults, $options);

        if (strlen((string)$options['api_key']) === 0) {
            return;
        }

        self::$logLevel = $options['log_level'];
        self::init($options['api_key'], $options);
        self::decideProfiling($options['sample_rate'], $options);
    }
public static function start ( $ options = array ( ) , $ sampleRate = null ) { self :: ignoreTransaction ( ) ; // this discards any data that was collected up to now and restarts. if ( ! is_array ( $ options ) ) { $ options = array ( 'api_key' => $ options ) ; } if ( $ sampleRate !== null ) { $ options [ 'sample_rate' ] = $ sampleRate ; } $ defaults = array ( 'api_key' => isset ( $ _SERVER [ 'TIDEWAYS_APIKEY' ] ) ? $ _SERVER [ 'TIDEWAYS_APIKEY' ] : ini_get ( "tideways.api_key" ) , 'sample_rate' => isset ( $ _SERVER [ 'TIDEWAYS_SAMPLERATE' ] ) ? intval ( $ _SERVER [ 'TIDEWAYS_SAMPLERATE' ] ) : ( ini_get ( "tideways.sample_rate" ) ? : 0 ) , 'collect' => isset ( $ _SERVER [ 'TIDEWAYS_COLLECT' ] ) ? $ _SERVER [ 'TIDEWAYS_COLLECT' ] : ( ini_get ( "tideways.collect" ) ? : self :: MODE_PROFILING ) , 'monitor' => isset ( $ _SERVER [ 'TIDEWAYS_MONITOR' ] ) ? $ _SERVER [ 'TIDEWAYS_MONITOR' ] : ( ini_get ( "tideways.monitor" ) ? : self :: MODE_BASIC ) , 'triggered' => self :: MODE_FULL , 'log_level' => ini_get ( "tideways.log_level" ) ? : 0 , 'service' => isset ( $ _SERVER [ 'TIDEWAYS_SERVICE' ] ) ? $ _SERVER [ 'TIDEWAYS_SERVICE' ] : ini_get ( "tideways.service" ) , 'framework' => isset ( $ _SERVER [ 'TIDEWAYS_FRAMEWORK' ] ) ? $ _SERVER [ 'TIDEWAYS_FRAMEWORK' ] : ini_get ( "tideways.framework" ) , ) ; $ options = array_merge ( $ defaults , $ options ) ; if ( strlen ( ( string ) $ options [ 'api_key' ] ) === 0 ) { return ; } self :: $ logLevel = $ options [ 'log_level' ] ; self :: init ( $ options [ 'api_key' ] , $ options ) ; self :: decideProfiling ( $ options [ 'sample_rate' ] , $ options ) ; }
Start production profiling for the application.

There are three modes for profiling:

1. Wall-time only profiling of the complete request (no overhead)
2. Full profile/trace using xhprof (depending of # function calls
significant overhead)
3. Whitelist-profiling mode only interesting functions.
(5-40% overhead, requires custom xhprof version >= 0.95)

Decisions to profile are made based on a sample-rate and random picks.
You can influence the sample rate and pick a value that suites your
application. Applications with lower request rates need a much higher
transaction rate (25-50%) than applications with high load (<= 1%).

Factors that influence sample rate:

1. Second parameter $sampleRate to start() method.
2. _tideways Query Parameter (string key is deprecated or array)
3. Cookie TIDEWAYS_SESSION
4. TIDEWAYS_SAMPLERATE environment variable.
5. X-TIDEWAYS-PROFILER HTTP header

start() automatically invokes a register shutdown handler that stops and
transmits the profiling data to the local daemon for further processing.

@param array|string      $options Either options array or api key (when string)
@param int               $sampleRate Deprecated, use "sample_rate" key in options instead.

@return void
Start production profiling for the application .