List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:July 3 2007 4:20pm
Subject:bk commit into 5.0-community tree (cmiller:1.2492)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0-community repository of cmiller. When cmiller 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-07-03 12:20:19-04:00, cmiller@stripped +2 -0
  In 5.0, Field_double::val_str uses "%g" to render floating point
  numbers, which uses "X.YeZ" notation when the exponent Z would be
  less than -4. That behavior at -4 is not exactly what we want, and
  our Decimal type offers smarter number representation.  By changing
  profiling to use Decimal types, we get more readable output.

  sql/sql_profile.cc@stripped, 2007-07-03 12:20:17-04:00, cmiller@stripped +25 -10
    Change the DOUBLE I_S types to DECIMAL, so we get a smarter
    floating-point number renderer.

  sql/sql_show.cc@stripped, 2007-07-03 12:20:17-04:00, cmiller@stripped +9 -2
    Add MYSQL_TYPE_DECIMAL as a string-ish type that INFORMATION_SCHEMA
    tables may use.

# 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:	cmiller
# Host:	zippy.cornsilk.net
# Root:	/home/cmiller/work/mysql/mysql-5.0-community

--- 1.351/sql/sql_show.cc	2007-07-02 10:29:50 -04:00
+++ 1.352/sql/sql_show.cc	2007-07-03 12:20:17 -04:00
@@ -3657,11 +3657,18 @@ TABLE *create_schema_table(THD *thd, TAB
                            fields_info->field_length)) == NULL)
         DBUG_RETURN(NULL);
       break;
+    case MYSQL_TYPE_DECIMAL:
+    case MYSQL_TYPE_STRING:
     default:
       /* Don't let unimplemented types pass through. Could be a grave error. */
-      DBUG_ASSERT(fields_info->field_type == MYSQL_TYPE_STRING);
+      DBUG_ASSERT(fields_info->field_type == MYSQL_TYPE_STRING ||
+                  fields_info->field_type == MYSQL_TYPE_DECIMAL);
 
-      /* this should be changed when Item_empty_string is fixed(in 4.1) */
+      /** 
+        @todo  Change when Item_empty_string is fixed (in 4.1).  [Presumably, 
+        this means removing the first of two steps:  setting a useless, bogus
+        value; and then setting the attributes.]
+      */
       if (!(item= new Item_empty_string("", 0, cs)))
       {
         DBUG_RETURN(0);

--- 1.10/sql/sql_profile.cc	2007-07-02 07:27:23 -04:00
+++ 1.11/sql/sql_profile.cc	2007-07-03 12:20:17 -04:00
@@ -44,9 +44,9 @@ ST_FIELD_INFO query_profile_statistics_i
   {"QUERY_ID", 20, MYSQL_TYPE_LONG, 0, false, "Query_id"},
   {"SEQ", 20, MYSQL_TYPE_LONG, 0, false, "Seq"},
   {"STATE", 30, MYSQL_TYPE_STRING, 0, false, "Status"},
-  {"DURATION", TIME_FLOAT_DIGITS, MYSQL_TYPE_DOUBLE, 0, false, "Duration"},
-  {"CPU_USER", TIME_FLOAT_DIGITS, MYSQL_TYPE_DOUBLE, 0, true, "CPU_user"},
-  {"CPU_SYSTEM", TIME_FLOAT_DIGITS, MYSQL_TYPE_DOUBLE, 0, true, "CPU_system"},
+  {"DURATION", TIME_FLOAT_DIGITS, MYSQL_TYPE_DECIMAL, 0, false, "Duration"},
+  {"CPU_USER", TIME_FLOAT_DIGITS, MYSQL_TYPE_DECIMAL, 0, true, "CPU_user"},
+  {"CPU_SYSTEM", TIME_FLOAT_DIGITS, MYSQL_TYPE_DECIMAL, 0, true, "CPU_system"},
   {"CONTEXT_VOLUNTARY", 20, MYSQL_TYPE_LONG, 0, true, "Context_voluntary"},
   {"CONTEXT_INVOLUNTARY", 20, MYSQL_TYPE_LONG, 0, true, "Context_involuntary"},
   {"BLOCK_OPS_IN", 20, MYSQL_TYPE_LONG, 0, true, "Block_ops_in"},
@@ -557,16 +557,31 @@ int PROFILING::fill_statistics_info(THD 
       */
       table->field[2]->store(previous->status, strlen(previous->status), 
                              system_charset_info);
-      table->field[3]->store((double)(entry->time_usecs - 
-                             previous->time_usecs)/(1000*1000));
+
+      my_decimal duration;
+      double2my_decimal(E_DEC_FATAL_ERROR, 
+                        (entry->time_usecs-previous->time_usecs)/(1000.0*1000),
+                        &duration);
+      table->field[3]->store_decimal(&duration);
 
 #ifdef HAVE_GETRUSAGE
-      table->field[4]->store((double)RUSAGE_DIFF_USEC(entry->rusage.ru_utime,
-                             previous->rusage.ru_utime)/(1000.0*1000));
-      table->field[4]->set_notnull();
-      table->field[5]->store((double)RUSAGE_DIFF_USEC(entry->rusage.ru_stime,
-                             previous->rusage.ru_stime)/(1000.0*1000));
 
+      my_decimal cpu_utime, cpu_stime;
+      double2my_decimal(E_DEC_FATAL_ERROR, 
+                        RUSAGE_DIFF_USEC(entry->rusage.ru_utime, 
+                                         previous->rusage.ru_utime) /
+                                                        (1000.0*1000),
+                        &cpu_utime);
+
+      double2my_decimal(E_DEC_FATAL_ERROR, 
+                        RUSAGE_DIFF_USEC(entry->rusage.ru_stime,
+                                         previous->rusage.ru_stime) / 
+                                                        (1000.0*1000),
+                        &cpu_stime);
+
+      table->field[4]->store_decimal(&cpu_utime);
+      table->field[5]->store_decimal(&cpu_stime);
+      table->field[4]->set_notnull();
       table->field[5]->set_notnull();
 #else
       /* TODO: Add CPU-usage info for non-BSD systems */
Thread
bk commit into 5.0-community tree (cmiller:1.2492)Chad MILLER3 Jul