uw Fri, 16 Oct 2009 13:02:01 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=289696
Log: Extending mysqlnd statistics/monitoring. Now counting COM_* commands. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_get_client_stats.phpt U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c U php/php-src/trunk/ext/mysqli/tests/mysqli_get_client_stats.phpt U php/php-src/trunk/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h U php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c
Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_get_client_stats.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_get_client_stats.phpt 2009-10-16 10:51:29 UTC (rev 289695) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_get_client_stats.phpt 2009-10-16 13:02:01 UTC (rev 289696) @@ -887,7 +887,7 @@ mysqli_close($link); ?> --EXPECTF-- -array(121) { +array(150) { [%u|b%"bytes_sent"]=> %unicode|string%(1) "0" [%u|b%"bytes_received"]=> @@ -1130,6 +1130,64 @@ %unicode|string%(1) "0" [%u|b%"init_command_failed_count"]=> %unicode|string%(1) "0" + [%u|b%"com_quit"]=> + %unicode|string%(1) "0" + [%u|b%"com_init_db"]=> + %unicode|string%(1) "0" + [%u|b%"com_query"]=> + %unicode|string%(1) "0" + [%u|b%"com_field_list"]=> + %unicode|string%(1) "0" + [%u|b%"com_create_db"]=> + %unicode|string%(1) "0" + [%u|b%"com_drop_db"]=> + %unicode|string%(1) "0" + [%u|b%"com_refresh"]=> + %unicode|string%(1) "0" + [%u|b%"com_shutdown"]=> + %unicode|string%(1) "0" + [%u|b%"com_statistics"]=> + %unicode|string%(1) "0" + [%u|b%"com_process_info"]=> + %unicode|string%(1) "0" + [%u|b%"com_connect"]=> + %unicode|string%(1) "0" + [%u|b%"com_process_kill"]=> + %unicode|string%(1) "0" + [%u|b%"com_debug"]=> + %unicode|string%(1) "0" + [%u|b%"com_ping"]=> + %unicode|string%(1) "0" + [%u|b%"com_time"]=> + %unicode|string%(1) "0" + [%u|b%"com_delayed_insert"]=> + %unicode|string%(1) "0" + [%u|b%"com_change_user"]=> + %unicode|string%(1) "0" + [%u|b%"com_binlog_dump"]=> + %unicode|string%(1) "0" + [%u|b%"com_table_dump"]=> + %unicode|string%(1) "0" + [%u|b%"com_connect_out"]=> + %unicode|string%(1) "0" + [%u|b%"com_register_slave"]=> + %unicode|string%(1) "0" + [%u|b%"com_stmt_prepare"]=> + %unicode|string%(1) "0" + [%u|b%"com_stmt_execute"]=> + %unicode|string%(1) "0" + [%u|b%"com_stmt_send_long_data"]=> + %unicode|string%(1) "0" + [%u|b%"com_stmt_close"]=> + %unicode|string%(1) "0" + [%u|b%"com_stmt_reset"]=> + %unicode|string%(1) "0" + [%u|b%"com_stmt_set_option"]=> + %unicode|string%(1) "0" + [%u|b%"com_stmt_fetch"]=> + %unicode|string%(1) "0" + [%u|b%"com_deamon"]=> + %unicode|string%(1) "0" } Testing buffered normal... Testing buffered normal... - SELECT id, label FROM test Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-10-16 10:51:29 UTC (rev 289695) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-10-16 13:02:01 UTC (rev 289696) @@ -406,6 +406,8 @@ cmd_packet.arg_len = arg_len; } + MYSQLND_INC_CONN_STATISTIC(&conn->stats, STAT_COM_QUIT + command - 1 /* because of COM_SLEEP */ ); + if (! PACKET_WRITE_ALLOCA(cmd_packet, conn)) { if (!silent) { DBG_ERR_FMT("Error while sending %s packet", mysqlnd_command_to_text[command]); Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h 2009-10-16 10:51:29 UTC (rev 289695) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h 2009-10-16 13:02:01 UTC (rev 289696) @@ -432,6 +432,35 @@ STAT_BINARY_TYPE_FETCHED_OTHER, STAT_INIT_COMMAND_EXECUTED_COUNT, STAT_INIT_COMMAND_FAILED_COUNT, + STAT_COM_QUIT, + STAT_COM_INIT_DB, + STAT_COM_QUERY, + STAT_COM_FIELD_LIST, + STAT_COM_CREATE_DB, + STAT_COM_DROP_DB, + STAT_COM_REFRESH, + STAT_COM_SHUTDOWN, + STAT_COM_STATISTICS, + STAT_COM_PROCESS_INFO, + STAT_COM_CONNECT, + STAT_COM_PROCESS_KILL, + STAT_COM_DEBUG, + STAT_COM_PING, + STAT_COM_TIME, + STAT_COM_DELAYED_INSERT, + STAT_COM_CHANGE_USER, + STAT_COM_BINLOG_DUMP, + STAT_COM_TABLE_DUMP, + STAT_COM_CONNECT_OUT, + STAT_COM_REGISTER_SLAVE, + STAT_COM_STMT_PREPARE, + STAT_COM_STMT_EXECUTE, + STAT_COM_STMT_SEND_LONG_DATA, + STAT_COM_STMT_CLOSE, + STAT_COM_STMT_RESET, + STAT_COM_SET_OPTION, + STAT_COM_STMT_FETCH, + STAT_COM_DAEMON, STAT_LAST /* Should be always the last */ } enum_mysqlnd_collected_stats; Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c 2009-10-16 10:51:29 UTC (rev 289695) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c 2009-10-16 13:02:01 UTC (rev 289696) @@ -153,7 +153,36 @@ { STR_W_LEN("proto_binary_fetched_geometry") }, { STR_W_LEN("proto_binary_fetched_other") }, { STR_W_LEN("init_command_executed_count") }, - { STR_W_LEN("init_command_failed_count") } + { STR_W_LEN("init_command_failed_count") }, + { STR_W_LEN("com_quit") }, + { STR_W_LEN("com_init_db") }, + { STR_W_LEN("com_query") }, + { STR_W_LEN("com_field_list") }, + { STR_W_LEN("com_create_db") }, + { STR_W_LEN("com_drop_db") }, + { STR_W_LEN("com_refresh") }, + { STR_W_LEN("com_shutdown") }, + { STR_W_LEN("com_statistics") }, + { STR_W_LEN("com_process_info") }, + { STR_W_LEN("com_connect") }, + { STR_W_LEN("com_process_kill") }, + { STR_W_LEN("com_debug") }, + { STR_W_LEN("com_ping") }, + { STR_W_LEN("com_time") }, + { STR_W_LEN("com_delayed_insert") }, + { STR_W_LEN("com_change_user") }, + { STR_W_LEN("com_binlog_dump") }, + { STR_W_LEN("com_table_dump") }, + { STR_W_LEN("com_connect_out") }, + { STR_W_LEN("com_register_slave") }, + { STR_W_LEN("com_stmt_prepare") }, + { STR_W_LEN("com_stmt_execute") }, + { STR_W_LEN("com_stmt_send_long_data") }, + { STR_W_LEN("com_stmt_close") }, + { STR_W_LEN("com_stmt_reset") }, + { STR_W_LEN("com_stmt_set_option") }, + { STR_W_LEN("com_stmt_fetch") }, + { STR_W_LEN("com_deamon") } }; /* }}} */ Modified: php/php-src/trunk/ext/mysqli/tests/mysqli_get_client_stats.phpt =================================================================== --- php/php-src/trunk/ext/mysqli/tests/mysqli_get_client_stats.phpt 2009-10-16 10:51:29 UTC (rev 289695) +++ php/php-src/trunk/ext/mysqli/tests/mysqli_get_client_stats.phpt 2009-10-16 13:02:01 UTC (rev 289696) @@ -887,7 +887,7 @@ mysqli_close($link); ?> --EXPECTF-- -array(121) { +array(150) { [%u|b%"bytes_sent"]=> %unicode|string%(1) "0" [%u|b%"bytes_received"]=> @@ -1130,6 +1130,64 @@ %unicode|string%(1) "0" [%u|b%"init_command_failed_count"]=> %unicode|string%(1) "0" + [%u|b%"com_quit"]=> + %unicode|string%(1) "0" + [%u|b%"com_init_db"]=> + %unicode|string%(1) "0" + [%u|b%"com_query"]=> + %unicode|string%(1) "0" + [%u|b%"com_field_list"]=> + %unicode|string%(1) "0" + [%u|b%"com_create_db"]=> + %unicode|string%(1) "0" + [%u|b%"com_drop_db"]=> + %unicode|string%(1) "0" + [%u|b%"com_refresh"]=> + %unicode|string%(1) "0" + [%u|b%"com_shutdown"]=> + %unicode|string%(1) "0" + [%u|b%"com_statistics"]=> + %unicode|string%(1) "0" + [%u|b%"com_process_info"]=> + %unicode|string%(1) "0" + [%u|b%"com_connect"]=> + %unicode|string%(1) "0" + [%u|b%"com_process_kill"]=> + %unicode|string%(1) "0" + [%u|b%"com_debug"]=> + %unicode|string%(1) "0" + [%u|b%"com_ping"]=> + %unicode|string%(1) "0" + [%u|b%"com_time"]=> + %unicode|string%(1) "0" + [%u|b%"com_delayed_insert"]=> + %unicode|string%(1) "0" + [%u|b%"com_change_user"]=> + %unicode|string%(1) "0" + [%u|b%"com_binlog_dump"]=> + %unicode|string%(1) "0" + [%u|b%"com_table_dump"]=> + %unicode|string%(1) "0" + [%u|b%"com_connect_out"]=> + %unicode|string%(1) "0" + [%u|b%"com_register_slave"]=> + %unicode|string%(1) "0" + [%u|b%"com_stmt_prepare"]=> + %unicode|string%(1) "0" + [%u|b%"com_stmt_execute"]=> + %unicode|string%(1) "0" + [%u|b%"com_stmt_send_long_data"]=> + %unicode|string%(1) "0" + [%u|b%"com_stmt_close"]=> + %unicode|string%(1) "0" + [%u|b%"com_stmt_reset"]=> + %unicode|string%(1) "0" + [%u|b%"com_stmt_set_option"]=> + %unicode|string%(1) "0" + [%u|b%"com_stmt_fetch"]=> + %unicode|string%(1) "0" + [%u|b%"com_deamon"]=> + %unicode|string%(1) "0" } Testing buffered normal... Testing buffered normal... - SELECT id, label FROM test Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-10-16 10:51:29 UTC (rev 289695) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-10-16 13:02:01 UTC (rev 289696) @@ -406,6 +406,8 @@ cmd_packet.arg_len = arg_len; } + MYSQLND_INC_CONN_STATISTIC(&conn->stats, STAT_COM_QUIT + command - 1 /* because of COM_SLEEP */ ); + if (! PACKET_WRITE_ALLOCA(cmd_packet, conn)) { if (!silent) { DBG_ERR_FMT("Error while sending %s packet", mysqlnd_command_to_text[command]); Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h 2009-10-16 10:51:29 UTC (rev 289695) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h 2009-10-16 13:02:01 UTC (rev 289696) @@ -432,6 +432,35 @@ STAT_BINARY_TYPE_FETCHED_OTHER, STAT_INIT_COMMAND_EXECUTED_COUNT, STAT_INIT_COMMAND_FAILED_COUNT, + STAT_COM_QUIT, + STAT_COM_INIT_DB, + STAT_COM_QUERY, + STAT_COM_FIELD_LIST, + STAT_COM_CREATE_DB, + STAT_COM_DROP_DB, + STAT_COM_REFRESH, + STAT_COM_SHUTDOWN, + STAT_COM_STATISTICS, + STAT_COM_PROCESS_INFO, + STAT_COM_CONNECT, + STAT_COM_PROCESS_KILL, + STAT_COM_DEBUG, + STAT_COM_PING, + STAT_COM_TIME, + STAT_COM_DELAYED_INSERT, + STAT_COM_CHANGE_USER, + STAT_COM_BINLOG_DUMP, + STAT_COM_TABLE_DUMP, + STAT_COM_CONNECT_OUT, + STAT_COM_REGISTER_SLAVE, + STAT_COM_STMT_PREPARE, + STAT_COM_STMT_EXECUTE, + STAT_COM_STMT_SEND_LONG_DATA, + STAT_COM_STMT_CLOSE, + STAT_COM_STMT_RESET, + STAT_COM_SET_OPTION, + STAT_COM_STMT_FETCH, + STAT_COM_DAEMON, STAT_LAST /* Should be always the last */ } enum_mysqlnd_collected_stats; Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c 2009-10-16 10:51:29 UTC (rev 289695) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c 2009-10-16 13:02:01 UTC (rev 289696) @@ -153,7 +153,36 @@ { STR_W_LEN("proto_binary_fetched_geometry") }, { STR_W_LEN("proto_binary_fetched_other") }, { STR_W_LEN("init_command_executed_count") }, - { STR_W_LEN("init_command_failed_count") } + { STR_W_LEN("init_command_failed_count") }, + { STR_W_LEN("com_quit") }, + { STR_W_LEN("com_init_db") }, + { STR_W_LEN("com_query") }, + { STR_W_LEN("com_field_list") }, + { STR_W_LEN("com_create_db") }, + { STR_W_LEN("com_drop_db") }, + { STR_W_LEN("com_refresh") }, + { STR_W_LEN("com_shutdown") }, + { STR_W_LEN("com_statistics") }, + { STR_W_LEN("com_process_info") }, + { STR_W_LEN("com_connect") }, + { STR_W_LEN("com_process_kill") }, + { STR_W_LEN("com_debug") }, + { STR_W_LEN("com_ping") }, + { STR_W_LEN("com_time") }, + { STR_W_LEN("com_delayed_insert") }, + { STR_W_LEN("com_change_user") }, + { STR_W_LEN("com_binlog_dump") }, + { STR_W_LEN("com_table_dump") }, + { STR_W_LEN("com_connect_out") }, + { STR_W_LEN("com_register_slave") }, + { STR_W_LEN("com_stmt_prepare") }, + { STR_W_LEN("com_stmt_execute") }, + { STR_W_LEN("com_stmt_send_long_data") }, + { STR_W_LEN("com_stmt_close") }, + { STR_W_LEN("com_stmt_reset") }, + { STR_W_LEN("com_stmt_set_option") }, + { STR_W_LEN("com_stmt_fetch") }, + { STR_W_LEN("com_deamon") } }; /* }}} */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php