diff options
author | Monty <monty@mariadb.org> | 2016-04-28 16:59:33 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2016-04-28 16:59:33 +0300 |
commit | 9c846373f02d6431d83add639e7560a69ba885a2 (patch) | |
tree | 101d110d3ec9a4796b4050779fb052120fd6d516 /sql/sql_show.cc | |
parent | fabeab781920dfcaf8e606708ba2c6812f6ae5d8 (diff) | |
parent | d5822a3ad0657040114cdc185c6387b9eb3a12b2 (diff) | |
download | mariadb-git-9c846373f02d6431d83add639e7560a69ba885a2.tar.gz |
Merge commit 'd5822a3ad0657040114cdc185c6387b9eb3a12b2' into 10.2
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r-- | sql/sql_show.cc | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 1102050e29c..f41fb394b47 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2960,8 +2960,7 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond) thread in this thread. However it's better that we notice it eventually than hide it. */ - table->field[12]->store((longlong) (tmp->status_var.local_memory_used + - sizeof(THD)), + table->field[12]->store((longlong) tmp->status_var.local_memory_used, FALSE); table->field[12]->set_notnull(); table->field[13]->store((longlong) tmp->get_examined_row_count(), TRUE); @@ -3257,7 +3256,8 @@ static bool show_status_array(THD *thd, const char *wild, */ for (var=variables; var->type == SHOW_FUNC || var->type == SHOW_SIMPLE_FUNC; var= &tmp) - ((mysql_show_var_func)(var->value))(thd, &tmp, buff, scope); + ((mysql_show_var_func)(var->value))(thd, &tmp, buff, + status_var, scope); SHOW_TYPE show_type=var->type; if (show_type == SHOW_ARRAY) @@ -3389,10 +3389,14 @@ end: DBUG_RETURN(res); } -/* collect status for all running threads */ +/* + collect status for all running threads + Return number of threads used +*/ -void calc_sum_of_all_status(STATUS_VAR *to) +uint calc_sum_of_all_status(STATUS_VAR *to) { + uint count= 0; DBUG_ENTER("calc_sum_of_all_status"); /* Ensure that thread id not killed during loop */ @@ -3403,16 +3407,21 @@ void calc_sum_of_all_status(STATUS_VAR *to) /* Get global values as base */ *to= global_status_var; + to->local_memory_used= 0; /* Add to this status from existing threads */ while ((tmp= it++)) { + count++; if (!tmp->status_in_global) + { add_to_status(to, &tmp->status_var); + to->local_memory_used+= tmp->status_var.local_memory_used; + } } mysql_mutex_unlock(&LOCK_thread_count); - DBUG_VOID_RETURN; + DBUG_RETURN(count); } |