diff options
Diffstat (limited to 'plugin/userstat/client_stats.cc')
-rw-r--r-- | plugin/userstat/client_stats.cc | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/plugin/userstat/client_stats.cc b/plugin/userstat/client_stats.cc index a1835384ad1..2adeb23a385 100644 --- a/plugin/userstat/client_stats.cc +++ b/plugin/userstat/client_stats.cc @@ -1,33 +1,37 @@ +namespace Show { + static ST_FIELD_INFO client_stats_fields[]= { - {"CLIENT", LIST_PROCESS_HOST_LEN, MYSQL_TYPE_STRING, 0, 0, "Client", 0}, - {"TOTAL_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Total_connections", 0}, - {"CONCURRENT_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Concurrent_connections", 0}, - {"CONNECTED_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Connected_time", 0}, - {"BUSY_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_DOUBLE, 0, 0, "Busy_time", 0}, - {"CPU_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_DOUBLE, 0, 0, "Cpu_time", 0}, - {"BYTES_RECEIVED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Bytes_received", 0}, - {"BYTES_SENT", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Bytes_sent", 0}, - {"BINLOG_BYTES_WRITTEN", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Binlog_bytes_written", 0}, - {"ROWS_READ", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_read", 0}, - {"ROWS_SENT", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_sent", 0}, - {"ROWS_DELETED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_deleted", 0}, - {"ROWS_INSERTED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_inserted", 0}, - {"ROWS_UPDATED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_updated", 0}, - {"SELECT_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Select_commands", 0}, - {"UPDATE_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Update_commands", 0}, - {"OTHER_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Other_commands", 0}, - {"COMMIT_TRANSACTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Commit_transactions", 0}, - {"ROLLBACK_TRANSACTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rollback_transactions", 0}, - {"DENIED_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Denied_connections", 0}, - {"LOST_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Lost_connections", 0}, - {"ACCESS_DENIED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Access_denied", 0}, - {"EMPTY_QUERIES", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Empty_queries", 0}, - {"TOTAL_SSL_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, MY_I_S_UNSIGNED, "Total_ssl_connections", 0}, - {"MAX_STATEMENT_TIME_EXCEEDED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Max_statement_time_exceeded",SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0} + Column("CLIENT",Varchar(LIST_PROCESS_HOST_LEN), NOT_NULL, "Client"), + Column("TOTAL_CONNECTIONS", SLonglong(), NOT_NULL, "Total_connections"), + Column("CONCURRENT_CONNECTIONS", SLonglong(), NOT_NULL, "Concurrent_connections"), + Column("CONNECTED_TIME", SLonglong(), NOT_NULL, "Connected_time"), + Column("BUSY_TIME", Double(MY_INT64_NUM_DECIMAL_DIGITS), NOT_NULL, "Busy_time"), + Column("CPU_TIME", Double(MY_INT64_NUM_DECIMAL_DIGITS), NOT_NULL, "Cpu_time"), + Column("BYTES_RECEIVED", SLonglong(), NOT_NULL, "Bytes_received"), + Column("BYTES_SENT", SLonglong(), NOT_NULL, "Bytes_sent"), + Column("BINLOG_BYTES_WRITTEN", SLonglong(), NOT_NULL, "Binlog_bytes_written"), + Column("ROWS_READ", SLonglong(), NOT_NULL, "Rows_read"), + Column("ROWS_SENT", SLonglong(), NOT_NULL, "Rows_sent"), + Column("ROWS_DELETED", SLonglong(), NOT_NULL, "Rows_deleted"), + Column("ROWS_INSERTED", SLonglong(), NOT_NULL, "Rows_inserted"), + Column("ROWS_UPDATED", SLonglong(), NOT_NULL, "Rows_updated"), + Column("SELECT_COMMANDS", SLonglong(), NOT_NULL, "Select_commands"), + Column("UPDATE_COMMANDS", SLonglong(), NOT_NULL, "Update_commands"), + Column("OTHER_COMMANDS", SLonglong(), NOT_NULL, "Other_commands"), + Column("COMMIT_TRANSACTIONS", SLonglong(), NOT_NULL, "Commit_transactions"), + Column("ROLLBACK_TRANSACTIONS", SLonglong(), NOT_NULL, "Rollback_transactions"), + Column("DENIED_CONNECTIONS", SLonglong(), NOT_NULL, "Denied_connections"), + Column("LOST_CONNECTIONS", SLonglong(), NOT_NULL, "Lost_connections"), + Column("ACCESS_DENIED", SLonglong(), NOT_NULL, "Access_denied"), + Column("EMPTY_QUERIES", SLonglong(), NOT_NULL, "Empty_queries"), + Column("TOTAL_SSL_CONNECTIONS", ULonglong(), NOT_NULL, "Total_ssl_connections"), + Column("MAX_STATEMENT_TIME_EXCEEDED", SLonglong(), NOT_NULL, "Max_statement_time_exceeded"), + CEnd() }; +} // namespace Show + static int send_user_stats(THD* thd, HASH *all_user_stats, TABLE *table) { mysql_mutex_lock(&LOCK_global_user_client_stats); @@ -92,7 +96,7 @@ static int client_stats_reset() static int client_stats_init(void *p) { ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p; - schema->fields_info= client_stats_fields; + schema->fields_info= Show::client_stats_fields; schema->fill_table= client_stats_fill; schema->reset_table= client_stats_reset; return 0; |