List:Commits« Previous MessageNext Message »
From:jani Date:January 9 2007 4:58pm
Subject:bk commit into 5.1 tree (jani:1.2348) BUG#24991
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of jani. When jani does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-01-09 18:58:34+02:00, jani@stripped +1 -0
  Fix for Bug#24991, "'status' in MySQL client outputs 'Queries per second avg: %'"
  
  my_snprintf() doesn't have %f, so we need to calculate integer
  and decimal parts separately.

  sql/sql_parse.cc@stripped, 2007-01-09 18:58:31+02:00, jani@stripped +9 -4
    Fix for Bug#24991, "'status' in MySQL client outputs 'Queries per second avg: %'"
    
    my_snprintf() doesn't have %f, so we need to calculate integer
    and decimal parts separately.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jani
# Host:	ua141d10.elisa.omakaista.fi
# Root:	/home/my/bk/mysql-5.1

--- 1.611/sql/sql_parse.cc	2007-01-09 18:58:41 +02:00
+++ 1.612/sql/sql_parse.cc	2007-01-09 18:58:41 +02:00
@@ -2107,6 +2107,7 @@
     STATUS_VAR current_global_status_var;
     ulong uptime;
     uint length;
+    ulonglong queries_per_second1000;
 #ifndef EMBEDDED_LIBRARY
     char buff[250];
     uint buff_len= sizeof(buff);
@@ -2119,19 +2120,23 @@
     statistic_increment(thd->status_var.com_stat[SQLCOM_SHOW_STATUS],
 			&LOCK_status);
     calc_sum_of_all_status(&current_global_status_var);
-    uptime= (ulong) (thd->start_time - start_time);
+    if (!(uptime= (ulong) (thd->start_time - start_time)))
+      queries_per_second1000= 0;
+    else
+      queries_per_second1000= thd->query_id * LL(1000) / uptime;
+      
     length= my_snprintf((char*) buff, buff_len - 1,
                         "Uptime: %lu  Threads: %d  Questions: %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,
                         (int) thread_count, (ulong) thd->query_id,
                         current_global_status_var.long_query_count,
                         current_global_status_var.opened_tables,
                         refresh_version,
                         cached_open_tables(),
-                        (uptime ? (ulonglong2double(thd->query_id) /
-                                   (double) uptime) : (double) 0));
+                        (uint) (queries_per_second1000 / 1000),
+                        (uint) (queries_per_second1000 % 1000));
 #ifdef SAFEMALLOC
     if (sf_malloc_cur_memory)				// Using SAFEMALLOC
     {
Thread
bk commit into 5.1 tree (jani:1.2348) BUG#24991jani9 Jan