List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:March 15 2007 9:24pm
Subject:bk commit into 5.0 tree (cmiller:1.2421)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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-03-15 16:24:36-04:00, cmiller@stripped +2 -0
  Many systems that implement getrusage() do not implement reading
  blocks out or in.  Linux, for instance, always returns zeroes.
  
  Test that the system returns sane results for opening+creating, 
  writing 10 bytes, fsync()ing and close()ing, and use that result
  to know whether to return NULLs for block IO in profiling.

  configure.in@stripped, 2007-03-15 16:24:35-04:00, cmiller@stripped +21 -0
    Test if getrusage() implements reading block IO.

  sql/sql_profile.cc@stripped, 2007-03-15 16:24:35-04:00, cmiller@stripped +7 -0
    If the compiling system doesn't support getrusage() block IO info, 
    then fill those columns with NULLs.

# 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-comeng--no-profile-blockio

--- 1.423/configure.in	2007-03-15 16:24:41 -04:00
+++ 1.424/configure.in	2007-03-15 16:24:41 -04:00
@@ -2264,6 +2264,27 @@ then
 fi
 AC_MSG_RESULT("$netinet_inc")
 
+AC_RUN_IFELSE([
+#include <stdio.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <fcntl.h>
+#define testfile "conftest.out"
+int main() {
+    struct rusage start, end;
+    int f;
+    getrusage(RUSAGE_SELF, &start);
+    f = open(testfile, O_WRONLY|O_CREAT);
+    if (f == -1) abort();
+    write(f, "0123456789", 10);
+    fsync(f); close(f); remove(testfile);
+    getrusage(RUSAGE_SELF, &end);
+    if (start.ru_oublock != 0) return(1); /* must start at zero */
+    if (end.ru_oublock == start.ru_oublock) return(2); /* should be at least 1 */
+    if ((end.ru_oublock - start.ru_oublock) > 6) return(3); /* too many to be right */
+    return(0); /* success */
+}],[AC_DEFINE([HAVE_GETRUSAGE_USEFUL_BLOCKIO], [1], [getrusage() yields useful block IO
results])])
+
 # Only build client code?
 AC_ARG_WITH(server,
     [  --without-server        Only build the client.],

--- 1.4/sql/sql_profile.cc	2007-03-15 16:24:41 -04:00
+++ 1.5/sql/sql_profile.cc	2007-03-15 16:24:41 -04:00
@@ -393,8 +393,13 @@ bool QUERY_PROFILE::show(uint options)
     if (options & PROFILE_BLOCK_IO)
     {
 #ifdef HAVE_GETRUSAGE
+#  ifdef HAVE_GETRUSAGE_USEFUL_BLOCKIO
       protocol->store((uint32)(rusage->ru_inblock - last_rusage->ru_inblock));
       protocol->store((uint32)(rusage->ru_oublock - last_rusage->ru_oublock));
+#  else
+      protocol->store_null();
+      protocol->store_null();
+#  endif
 #else
       protocol->store_null();
       protocol->store_null();
@@ -744,10 +749,12 @@ int PROFILING::fill_statistics_info(THD 
 #endif
 
 #ifdef HAVE_GETRUSAGE
+#  ifdef HAVE_GETRUSAGE_USEFUL_BLOCKIO
       table->field[8]->store((uint32)(entry->rusage.ru_inblock -
last_rusage->ru_inblock));
       table->field[8]->set_notnull();
       table->field[9]->store((uint32)(entry->rusage.ru_oublock -
last_rusage->ru_oublock));
       table->field[9]->set_notnull();
+#  endif
 #else
       /* TODO: Add block IO info for non-BSD systems */
 #endif
Thread
bk commit into 5.0 tree (cmiller:1.2421)Chad MILLER15 Mar