diff options
author | unknown <monty@mishka.local> | 2004-09-15 22:36:57 +0300 |
---|---|---|
committer | unknown <monty@mishka.local> | 2004-09-15 22:36:57 +0300 |
commit | 6c3e66510c29abb4a935483a711b55f3ff8607ab (patch) | |
tree | c54782bf59455786d3d6b7abf02e40aaac69b1ff /sql/sql_class.cc | |
parent | ffc0d185da3c80f713b541cb52934712c24ce8cb (diff) | |
parent | 4ef01ca25c71ac59e751ea478a13dff480ebb98e (diff) | |
download | mariadb-git-6c3e66510c29abb4a935483a711b55f3ff8607ab.tar.gz |
Merge
BitKeeper/etc/logging_ok:
auto-union
sql/ha_berkeley.cc:
Auto merged
sql/ha_heap.cc:
Auto merged
sql/ha_innodb.cc:
Auto merged
sql/ha_myisam.cc:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_help.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_class.h:
SCCS merged
sql/sql_parse.cc:
SCCS merged
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r-- | sql/sql_class.cc | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 0c42c45bf59..cc6b86f4bc2 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -298,6 +298,7 @@ void THD::init(void) bzero((char*) warn_count, sizeof(warn_count)); total_warn_count= 0; update_charset(); + bzero((char *) &status_var, sizeof(status_var)); } @@ -388,6 +389,7 @@ THD::~THD() /* Ensure that no one is using THD */ pthread_mutex_lock(&LOCK_delete); pthread_mutex_unlock(&LOCK_delete); + add_to_status(&global_status_var, &status_var); /* Close connection */ #ifndef EMBEDDED_LIBRARY @@ -430,6 +432,27 @@ THD::~THD() } +/* + Add to one status variable another status variable + + NOTES + This function assumes that all variables are long/ulong. + If this assumption will change, then we have to explictely add + the other variables after the while loop +*/ + +void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var) +{ + ulong *end= (ulong*) ((byte*) to_var + offsetof(STATUS_VAR, + last_system_status_var) + + sizeof(ulong)); + ulong *to= (ulong*) to_var, *from= (ulong*) from_var; + + while (to != end) + *(to++)+= *(from++); +} + + void THD::awake(THD::killed_state state_to_set) { THD_CHECK_SENTRY(this); @@ -1646,3 +1669,27 @@ void TMP_TABLE_PARAM::init() group_parts= group_length= group_null_parts= 0; quick_group= 1; } + + +void thd_increment_bytes_sent(ulong length) +{ + current_thd->status_var.bytes_sent+= length; +} + + +void thd_increment_bytes_received(ulong length) +{ + current_thd->status_var.bytes_received+= length; +} + + +void thd_increment_net_big_packet_count(ulong length) +{ + current_thd->status_var.net_big_packet_count+= length; +} + + +void THD::set_status_var_init() +{ + bzero((char*) &status_var, sizeof(status_var)); +} |