Php extension to publish execution statistics to Btp statistics daemon.
Btp daemon code and docs can be found here - Btp statistics
Extension supports working with many btp servers. Counters are sent by UDP requests on script finish. Also counters can be sent during script execution to save memory (see {btp.autoflush_time} and {btp.autoflush_count} settings).
##Ini settings
btp.cli_enable
Enable extension in cli mode.
Default - 1
btp.fpm_enable
Enable extension in fpm mode.
Default - 1
btp.autoflush_time
", "60", PHP_INI_ALL, OnIniUpdate)
Send stopped timers and counters eash {btp.autoflush_time} seconds. 0 means disabled
Default - 60.
btp.autoflush_count
Send stopped timers and counters after {btp.autoflush_count} was added.
Default - 0 (disabled)
##Functions
bool btp_config_server_set( int $id, string $host, string $port )
Adds new server connect with $id.
bool btp_script_name_set( string $script )
Sets default counter scriptname.
resource btp_timer_start( string $service, string $server, string $operation, int $serverid = 0 )
Starts timer.
bool btp_timer_stop( $timer )
Stops timer.
bool btp_timer_count( string $service, string $server, string $operation, int $time = 0, int $serverid = 0)
Creates counter. $time is microseconds.
bool btp_timer_count_script( string $service, string $server, string $operation, string $script, int $time = 0, int $serverid = 0)
Creates counter with custom scriptname. $time is microseconds.
bool btp_timer_set_operation( resource $timer, string $operation)
Changes operation for non stopped timer. If timer stopped returns false and produces Warning.
array btp_dump()
Returns current timers and counters list. List contains just items which has not been sent yet.
bool btp_flush($stopped = true)
Sends counters and stopped timers. If $stopped == false stops all timers before sending.