mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
Patch for displaying questions per second average correctly.
This commit is contained in:
parent
d66e47213d
commit
6c15d02a37
1 changed files with 9 additions and 4 deletions
|
@ -1140,6 +1140,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||||
STATUS_VAR current_global_status_var;
|
STATUS_VAR current_global_status_var;
|
||||||
ulong uptime;
|
ulong uptime;
|
||||||
uint length;
|
uint length;
|
||||||
|
ulonglong queries_per_second1000;
|
||||||
#ifndef EMBEDDED_LIBRARY
|
#ifndef EMBEDDED_LIBRARY
|
||||||
char buff[250];
|
char buff[250];
|
||||||
uint buff_len= sizeof(buff);
|
uint buff_len= sizeof(buff);
|
||||||
|
@ -1152,19 +1153,23 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||||
statistic_increment(thd->status_var.com_stat[SQLCOM_SHOW_STATUS],
|
statistic_increment(thd->status_var.com_stat[SQLCOM_SHOW_STATUS],
|
||||||
&LOCK_status);
|
&LOCK_status);
|
||||||
calc_sum_of_all_status(¤t_global_status_var);
|
calc_sum_of_all_status(¤t_global_status_var);
|
||||||
uptime= (ulong) (thd->start_time - server_start_time);
|
if (!(uptime= (ulong) (thd->start_time - server_start_time)))
|
||||||
|
queries_per_second1000= 0;
|
||||||
|
else
|
||||||
|
queries_per_second1000= thd->query_id * LL(1000) / uptime;
|
||||||
|
|
||||||
length= my_snprintf((char*) buff, buff_len - 1,
|
length= my_snprintf((char*) buff, buff_len - 1,
|
||||||
"Uptime: %lu Threads: %d Questions: %lu "
|
"Uptime: %lu Threads: %d Questions: %lu "
|
||||||
"Slow queries: %lu Opens: %lu Flush tables: %lu "
|
"Slow queries: %lu Opens: %lu Flush tables: %lu "
|
||||||
"Open tables: %u Queries per second avg: %.3f",
|
"Open tables: %u Queries per second avg: %u.%u",
|
||||||
uptime,
|
uptime,
|
||||||
(int) thread_count, (ulong) thd->query_id,
|
(int) thread_count, (ulong) thd->query_id,
|
||||||
current_global_status_var.long_query_count,
|
current_global_status_var.long_query_count,
|
||||||
current_global_status_var.opened_tables,
|
current_global_status_var.opened_tables,
|
||||||
refresh_version,
|
refresh_version,
|
||||||
cached_open_tables(),
|
cached_open_tables(),
|
||||||
(uptime ? (ulonglong2double(thd->query_id) /
|
(uint) (queries_per_second1000 / 1000),
|
||||||
(double) uptime) : (double) 0));
|
(uint) (queries_per_second1000 % 1000));
|
||||||
#ifdef SAFEMALLOC
|
#ifdef SAFEMALLOC
|
||||||
if (sf_malloc_cur_memory) // Using SAFEMALLOC
|
if (sf_malloc_cur_memory) // Using SAFEMALLOC
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue