List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:September 24 2010 8:47am
Subject:bzr push into mysql-5.1-telco-7.0-spj-scan-vs-scan branch (jonas:3294 to
3295)
View as plain text  
 3295 Jonas Oreland	2010-09-24
      ndb - add my favorite performance tracing #ifdef SPJ_TRACE_TIME

    modified:
      storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp
      storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp
 3294 Jonas Oreland	2010-09-24
      ndb - fix Dbspj handling of PRUNE_PATTERN

    modified:
      mysql-test/suite/ndb/r/ndb_join_pushdown.result
      mysql-test/suite/ndb/t/ndb_join_pushdown.test
      storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
      storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp
      storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp
      storage/ndb/src/kernel/vm/KeyDescriptor.hpp
=== modified file 'storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp'
--- a/storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp	2010-09-24 08:07:43 +0000
+++ b/storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp	2010-09-24 08:46:53 +0000
@@ -32,6 +32,20 @@ class SectionReader;
 struct QueryNode;
 struct QueryNodeParameters;
 
+//#define SPJ_TRACE_TIME
+
+#ifdef SPJ_TRACE_TIME
+static
+inline
+Uint64 spj_now()
+{
+  NDB_TICKS sec;
+  Uint32 micro;
+  NdbTick_CurrentMicrosecond(&sec, &micro);
+  return Uint64(sec * 1000000 + micro);
+}
+#endif
+
 class Dbspj: public SimulatedBlock {
 public:
   Dbspj(Block_context& ctx, Uint32 instanceNumber = 0);
@@ -772,6 +786,14 @@ public:
     ArenaHead m_arena;
     RowBuffer m_rowBuffer;
 
+#ifdef SPJ_TRACE_TIME
+    Uint32 m_cnt_batches;
+    Uint32 m_sum_rows;
+    Uint32 m_sum_running;
+    Uint32 m_sum_waiting;
+    Uint64 m_save_time;
+#endif
+
     bool isScan() const { return (m_bits & RT_SCAN) != 0;}
     bool isLookup() const { return (m_bits & RT_SCAN) == 0;}
 

=== modified file 'storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp	2010-09-24 08:07:43 +0000
+++ b/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp	2010-09-24 08:46:53 +0000
@@ -482,7 +482,13 @@ Dbspj::do_init(Request* requestP, const 
   requestP->m_transId[0] = req->transId1;
   requestP->m_transId[1] = req->transId2;
   bzero(requestP->m_lookup_node_data, sizeof(requestP->m_lookup_node_data));
-
+#ifdef SPJ_TRACE_TIME
+  requestP->m_cnt_batches = 0;
+  requestP->m_sum_rows = 0;
+  requestP->m_sum_running = 0;
+  requestP->m_sum_waiting = 0;
+  requestP->m_save_time = spj_now();
+#endif
   const Uint32 reqInfo = req->requestInfo;
   Uint32 tmp = req->clientConnectPtr;
   if (LqhKeyReq::getDirtyFlag(reqInfo) &&
@@ -771,6 +777,13 @@ Dbspj::do_init(Request* requestP, const 
   requestP->m_transId[1] = req->transId2;
   requestP->m_rootResultData = req->resultData;
   bzero(requestP->m_lookup_node_data, sizeof(requestP->m_lookup_node_data));
+#ifdef SPJ_TRACE_TIME
+  requestP->m_cnt_batches = 0;
+  requestP->m_sum_rows = 0;
+  requestP->m_sum_running = 0;
+  requestP->m_sum_waiting = 0;
+  requestP->m_save_time = spj_now();
+#endif
 }
 
 void
@@ -1175,6 +1188,26 @@ Dbspj::sendConf(Signal* signal, Ptr<Requ
       c_Counters.incr_counter(CI_SCAN_BATCHES_RETURNED, 1);
       c_Counters.incr_counter(CI_SCAN_ROWS_RETURNED, requestPtr.p->m_rows);
 
+#ifdef SPJ_TRACE_TIME
+      Uint64 now = spj_now();
+      Uint64 then = requestPtr.p->m_save_time;
+
+      requestPtr.p->m_sum_rows += requestPtr.p->m_rows;
+      requestPtr.p->m_sum_running += Uint32(now - then);
+      requestPtr.p->m_cnt_batches++;
+      requestPtr.p->m_save_time = now;
+
+      if (is_complete)
+      {
+        Uint32 cnt = requestPtr.p->m_cnt_batches;
+        ndbout_c("batches: %u avg_rows: %u avg_running: %u avg_wait: %u",
+                 cnt,
+                 (requestPtr.p->m_sum_rows / cnt),
+                 (requestPtr.p->m_sum_running / cnt),
+                 cnt == 1 ? 0 : requestPtr.p->m_sum_waiting / (cnt - 1));
+      }
+#endif
+
       /**
        * reset for next batch
        */
@@ -1877,6 +1910,13 @@ Dbspj::execSCAN_NEXTREQ(Signal* signal)
     return;
   }
 
+#ifdef SPJ_TRACE_TIME
+  Uint64 now = spj_now();
+  Uint64 then = requestPtr.p->m_save_time;
+  requestPtr.p->m_sum_waiting += Uint32(now - then);
+  requestPtr.p->m_save_time = now;
+#endif
+
   Uint32 state = requestPtr.p->m_state;
   requestPtr.p->m_state = state & ~Uint32(Request::RS_WAITING);
 


Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20100924084653-0rxa2syg08qp8w7l.bundle
Thread
bzr push into mysql-5.1-telco-7.0-spj-scan-vs-scan branch (jonas:3294 to3295) Jonas Oreland24 Sep