List:Commits« Previous MessageNext Message »
From:Marc Alff Date:March 23 2011 1:29pm
Subject:bzr push into mysql-trunk branch (marc.alff:3611 to 3612)
View as plain text  
 3612 Marc Alff	2011-03-23
      Follow up on code review.
      Fixed tables:
      - EVENTS_STAGES_SUMMARY_BY_THREAD_BY_EVENT_NAME
      - EVENTS_STATEMENTS_SuMMARY_BY_THREAD_BY_EVENT_NAME
      to follow the iteration pattern changed previously for table
      - EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME.
      
      Iteration per thread is in the outer most loop.

    modified:
      storage/perfschema/table_esgs_by_thread_by_event_name.cc
      storage/perfschema/table_esgs_by_thread_by_event_name.h
      storage/perfschema/table_esms_by_thread_by_event_name.cc
      storage/perfschema/table_esms_by_thread_by_event_name.h
 3611 Marc Alff	2011-03-23
      Reduced the server memory footprint when executing performance schema tests

    modified:
      mysql-test/include/default_mysqld.cnf
      mysql-test/suite/perfschema/r/ortho_iter.result
      mysql-test/suite/perfschema/r/privilege_table_io.result
      mysql-test/suite/perfschema/r/start_server_innodb.result
      mysql-test/suite/perfschema/r/start_server_no_cond_class.result
      mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
      mysql-test/suite/perfschema/r/start_server_no_file_class.result
      mysql-test/suite/perfschema/r/start_server_no_file_inst.result
      mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
      mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
      mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
      mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
      mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
      mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
      mysql-test/suite/perfschema/r/start_server_no_stage_class.result
      mysql-test/suite/perfschema/r/start_server_no_stages_history.result
      mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result
      mysql-test/suite/perfschema/r/start_server_no_statement_class.result
      mysql-test/suite/perfschema/r/start_server_no_statements_history.result
      mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result
      mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
      mysql-test/suite/perfschema/r/start_server_no_table_inst.result
      mysql-test/suite/perfschema/r/start_server_no_thread_class.result
      mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
      mysql-test/suite/perfschema/r/start_server_off.result
      mysql-test/suite/perfschema/r/start_server_on.result
      mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_off.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result
=== modified file 'storage/perfschema/table_esgs_by_thread_by_event_name.cc'
--- a/storage/perfschema/table_esgs_by_thread_by_event_name.cc	2011-02-14 14:23:55 +0000
+++ b/storage/perfschema/table_esgs_by_thread_by_event_name.cc	2011-03-23 13:28:47 +0000
@@ -117,26 +117,27 @@ int table_esgs_by_thread_by_event_name::
   PFS_thread *thread;
   PFS_stage_class *stage_class;
 
-  m_pos.set_at(&m_next_pos);
-
-  do
+  for (m_pos.set_at(&m_next_pos);
+       m_pos.has_more_thread();
+       m_pos.next_thread())
   {
-    stage_class= find_stage_class(m_pos.m_index_1);
-    if (stage_class)
+    thread= &thread_array[m_pos.m_index_1];
+
+    /*
+      Important note: the thread scan is the outer loop (index 1),
+      to minimize the number of calls to atomic operations.
+    */
+    if (thread->m_lock.is_populated())
     {
-      for ( ; m_pos.has_more_thread(); m_pos.next_thread())
+      stage_class= find_stage_class(m_pos.m_index_2);
+      if (stage_class)
       {
-        thread= &thread_array[m_pos.m_index_2];
-        if (thread->m_lock.is_populated())
-        {
-          make_row(thread, stage_class);
-          m_next_pos.set_after(&m_pos);
-          return 0;
-        }
+        make_row(thread, stage_class);
+        m_next_pos.set_after(&m_pos);
+        return 0;
       }
-      m_pos.next_stage();
     }
-  } while (stage_class != NULL);
+  }
 
   return HA_ERR_END_OF_FILE;
 }
@@ -148,13 +149,13 @@ table_esgs_by_thread_by_event_name::rnd_
   PFS_stage_class *stage_class;
 
   set_position(pos);
-  DBUG_ASSERT(m_pos.m_index_2 < thread_max);
+  DBUG_ASSERT(m_pos.m_index_1 < thread_max);
 
-  thread= &thread_array[m_pos.m_index_2];
+  thread= &thread_array[m_pos.m_index_1];
   if (! thread->m_lock.is_populated())
     return HA_ERR_RECORD_DELETED;
 
-  stage_class= find_stage_class(m_pos.m_index_1);
+  stage_class= find_stage_class(m_pos.m_index_2);
   if (stage_class)
   {
     make_row(thread, stage_class);

=== modified file 'storage/perfschema/table_esgs_by_thread_by_event_name.h'
--- a/storage/perfschema/table_esgs_by_thread_by_event_name.h	2011-02-14 14:23:55 +0000
+++ b/storage/perfschema/table_esgs_by_thread_by_event_name.h	2011-03-23 13:28:47 +0000
@@ -49,32 +49,32 @@ struct row_esgs_by_thread_by_event_name
 /**
   Position of a cursor on
   PERFORMANCE_SCHEMA.EVENTS_STAGES_SUMMARY_BY_THREAD_BY_EVENT_NAME.
-  Index 1 on stage class (1 based).
-  Index 2 on thread (0 based).
+  Index 1 on thread (0 based).
+  Index 2 on stage class (1 based).
 */
 struct pos_esgs_by_thread_by_event_name
 : public PFS_double_index
 {
   pos_esgs_by_thread_by_event_name()
-    : PFS_double_index(1, 0)
+    : PFS_double_index(0, 1)
   {}
 
   inline void reset(void)
   {
-    m_index_1= 1;
-    m_index_2= 0;
+    m_index_1= 0;
+    m_index_2= 1;
   }
 
   inline bool has_more_thread(void)
-  { return (m_index_2 < thread_max); }
+  { return (m_index_1 < thread_max); }
 
-  inline void next_stage(void)
+  inline void next_thread(void)
   {
     m_index_1++;
-    m_index_2= 0;
+    m_index_2= 1;
   }
 
-  inline void next_thread(void)
+  inline void next_stage(void)
   {
     m_index_2++;
   }

=== modified file 'storage/perfschema/table_esms_by_thread_by_event_name.cc'
--- a/storage/perfschema/table_esms_by_thread_by_event_name.cc	2011-02-14 14:23:55 +0000
+++ b/storage/perfschema/table_esms_by_thread_by_event_name.cc	2011-03-23 13:28:47 +0000
@@ -212,26 +212,27 @@ int table_esms_by_thread_by_event_name::
   PFS_thread *thread;
   PFS_statement_class *statement_class;
 
-  m_pos.set_at(&m_next_pos);
-
-  do
+  for (m_pos.set_at(&m_next_pos);
+       m_pos.has_more_thread();
+       m_pos.next_thread())
   {
-    statement_class= find_statement_class(m_pos.m_index_1);
-    if (statement_class)
+    thread= &thread_array[m_pos.m_index_1];
+
+    /*
+      Important note: the thread scan is the outer loop (index 1),
+      to minimize the number of calls to atomic operations.
+    */
+    if (thread->m_lock.is_populated())
     {
-      for ( ; m_pos.has_more_thread(); m_pos.next_thread())
+      statement_class= find_statement_class(m_pos.m_index_2);
+      if (statement_class)
       {
-        thread= &thread_array[m_pos.m_index_2];
-        if (thread->m_lock.is_populated())
-        {
-          make_row(thread, statement_class);
-          m_next_pos.set_after(&m_pos);
-          return 0;
-        }
+        make_row(thread, statement_class);
+        m_next_pos.set_after(&m_pos);
+        return 0;
       }
-      m_pos.next_statement();
     }
-  } while (statement_class != NULL);
+  }
 
   return HA_ERR_END_OF_FILE;
 }
@@ -243,13 +244,13 @@ table_esms_by_thread_by_event_name::rnd_
   PFS_statement_class *statement_class;
 
   set_position(pos);
-  DBUG_ASSERT(m_pos.m_index_2 < thread_max);
+  DBUG_ASSERT(m_pos.m_index_1 < thread_max);
 
-  thread= &thread_array[m_pos.m_index_2];
+  thread= &thread_array[m_pos.m_index_1];
   if (! thread->m_lock.is_populated())
     return HA_ERR_RECORD_DELETED;
 
-  statement_class= find_statement_class(m_pos.m_index_1);
+  statement_class= find_statement_class(m_pos.m_index_2);
   if (statement_class)
   {
     make_row(thread, statement_class);

=== modified file 'storage/perfschema/table_esms_by_thread_by_event_name.h'
--- a/storage/perfschema/table_esms_by_thread_by_event_name.h	2011-02-14 14:23:55 +0000
+++ b/storage/perfschema/table_esms_by_thread_by_event_name.h	2011-03-23 13:28:47 +0000
@@ -49,32 +49,32 @@ struct row_esms_by_thread_by_event_name
 /**
   Position of a cursor on
   PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_SUMMARY_BY_THREAD_BY_EVENT_NAME.
-  Index 1 on statement class (1 based).
-  Index 2 on thread (0 based).
+  Index 1 on thread (0 based).
+  Index 2 on statement class (1 based).
 */
 struct pos_esms_by_thread_by_event_name
 : public PFS_double_index, public PFS_instrument_view_constants
 {
   pos_esms_by_thread_by_event_name()
-    : PFS_double_index(1, 0)
+    : PFS_double_index(0, 1)
   {}
 
   inline void reset(void)
   {
-    m_index_1= 1;
-    m_index_2= 0;
+    m_index_1= 0;
+    m_index_2= 1;
   }
 
   inline bool has_more_thread(void)
-  { return (m_index_2 < thread_max); }
+  { return (m_index_1 < thread_max); }
 
-  inline void next_statement(void)
+  inline void next_thread(void)
   {
     m_index_1++;
-    m_index_2= 0;
+    m_index_2= 1;
   }
 
-  inline void next_thread(void)
+  inline void next_statement(void)
   {
     m_index_2++;
   }

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (marc.alff:3611 to 3612) Marc Alff23 Mar