List:Commits« Previous MessageNext Message »
From:Marc Alff Date:April 2 2009 12:26am
Subject:bzr commit into mysql-6.0-perf branch (marc.alff:2848)
View as plain text  
#At file:///home/malff/BZR-TREE/mysql-6.0-perf/ based on revid:marc.alff@stripped

 2848 Marc Alff	2009-04-01
      Implemented review comments:
      - Changed doxygen flags
      - Revised the instrumentation for per thread aggregates, to unify the code.
      - Minor code reorder for clarity, to group aggregations together
      
      In particular, the per thread aggregation is now a chain, not a single aggregate.
modified:
  Doxyfile-wl2360
  storage/perfschema/pfs.cc
  storage/perfschema/pfs_events_waits.h
  storage/perfschema/pfs_instr.cc
  storage/perfschema/pfs_instr.h
  storage/perfschema/table_events_waits_summary.cc
  storage/perfschema/unittest/pfs_instr-t.cc

=== modified file 'Doxyfile-wl2360'
--- a/Doxyfile-wl2360	2009-03-12 01:54:45 +0000
+++ b/Doxyfile-wl2360	2009-04-02 00:26:34 +0000
@@ -286,17 +286,17 @@ SYMBOL_CACHE_SIZE      = 0
 # Private class members and static file members will be hidden unless 
 # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
 
-EXTRACT_ALL            = NO
+EXTRACT_ALL            = YES
 
 # If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
 # will be included in the documentation.
 
-EXTRACT_PRIVATE        = NO
+EXTRACT_PRIVATE        = YES
 
 # If the EXTRACT_STATIC tag is set to YES all static members of a file 
 # will be included in the documentation.
 
-EXTRACT_STATIC         = NO
+EXTRACT_STATIC         = YES
 
 # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
 # defined locally in source files will be included in the documentation. 
@@ -1318,7 +1318,7 @@ HIDE_UNDOC_RELATIONS   = YES
 # toolkit from AT&T and Lucent Bell Labs. The other options in this section 
 # have no effect if this option is set to NO (the default)
 
-HAVE_DOT               = NO
+HAVE_DOT               = YES
 
 # By default doxygen will write a font called FreeSans.ttf to the output 
 # directory and reference it in all dot files that doxygen generates. This 

=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc	2009-03-31 17:44:18 +0000
+++ b/storage/perfschema/pfs.cc	2009-04-02 00:26:34 +0000
@@ -1400,18 +1400,15 @@ static void end_mutex_wait_v1(PSI_mutex_
     if (rc == 0)
     {
       /* Thread safe: we are protected by the instrumented mutex */
+      PFS_single_stat_chain *stat;
       PFS_mutex *mutex= pfs_locker->m_target.m_mutex;
-      ulonglong wait_time= wait->m_timer_end- wait->m_timer_start;
-      aggregate_single_stat_chain(& mutex->m_wait_stat, wait_time);
       mutex->m_owner= wait->m_thread;
       mutex->m_last_locked= wait->m_timer_end;
 
-      if (flag_events_waits_summary_by_thread_by_event_name)
-      {
-        PFS_single_stat *stat;
-        stat= find_per_thread_mutex_info_wait_stat(wait->m_thread, mutex->m_info);
-        aggregate_single_stat(stat, wait_time);
-      }
+      ulonglong wait_time= wait->m_timer_end- wait->m_timer_start;
+      aggregate_single_stat_chain(& mutex->m_wait_stat, wait_time);
+      stat= find_per_thread_mutex_info_wait_stat(wait->m_thread, mutex->m_info);
+      aggregate_single_stat_chain(stat, wait_time);
     }
   }
   wait->m_thread->m_wait_locker_count--;
@@ -1460,9 +1457,8 @@ static void end_rwlock_rdwait_v1(PSI_rwl
         The statistics generated are not safe, which is why they are
         just statistics, not facts.
       */
+      PFS_single_stat_chain *stat;
       PFS_rwlock *rwlock= pfs_locker->m_target.m_rwlock;
-      ulonglong wait_time= wait->m_timer_end- wait->m_timer_start;
-      aggregate_single_stat_chain(& rwlock->m_wait_stat, wait_time);
       if (rwlock->m_readers == 0)
       {
         rwlock->m_read_state_count++;
@@ -1471,12 +1467,10 @@ static void end_rwlock_rdwait_v1(PSI_rwl
       rwlock->m_writer= NULL;
       rwlock->m_readers++;
 
-      if (flag_events_waits_summary_by_thread_by_event_name)
-      {
-        PFS_single_stat *stat;
-        stat= find_per_thread_rwlock_info_wait_stat(wait->m_thread, rwlock->m_info);
-        aggregate_single_stat(stat, wait_time);
-      }
+      ulonglong wait_time= wait->m_timer_end- wait->m_timer_start;
+      aggregate_single_stat_chain(& rwlock->m_wait_stat, wait_time);
+      stat= find_per_thread_rwlock_info_wait_stat(wait->m_thread, rwlock->m_info);
+      aggregate_single_stat_chain(stat, wait_time);
     }
   }
   wait->m_thread->m_wait_locker_count--;
@@ -1519,20 +1513,17 @@ static void end_rwlock_wrwait_v1(PSI_rwl
     if (rc == 0)
     {
       /* Thread safe : we are protected by the instrumented rwlock */
+      PFS_single_stat_chain *stat;
       PFS_rwlock *rwlock= pfs_locker->m_target.m_rwlock;
-      ulonglong wait_time= wait->m_timer_end- wait->m_timer_start;
-      aggregate_single_stat_chain(& rwlock->m_wait_stat, wait_time);
       rwlock->m_writer= wait->m_thread;
       rwlock->m_last_written= wait->m_timer_end;
       rwlock->m_readers= 0;
       rwlock->m_last_read= 0;
 
-      if (flag_events_waits_summary_by_thread_by_event_name)
-      {
-        PFS_single_stat *stat;
-        stat= find_per_thread_rwlock_info_wait_stat(wait->m_thread, rwlock->m_info);
-        aggregate_single_stat(stat, wait_time);
-      }
+      ulonglong wait_time= wait->m_timer_end- wait->m_timer_start;
+      aggregate_single_stat_chain(& rwlock->m_wait_stat, wait_time);
+      stat= find_per_thread_rwlock_info_wait_stat(wait->m_thread, rwlock->m_info);
+      aggregate_single_stat_chain(stat, wait_time);
     }
   }
 
@@ -1576,16 +1567,13 @@ static void end_cond_wait_v1(PSI_cond_lo
     if (rc == 0)
     {
       /* Not thread safe, race conditions will occur */
+      PFS_single_stat_chain *stat;
       PFS_cond *cond= pfs_locker->m_target.m_cond;
+
       ulonglong wait_time= wait->m_timer_end- wait->m_timer_start;
       aggregate_single_stat_chain(& cond->m_wait_stat, wait_time);
-
-      if (flag_events_waits_summary_by_thread_by_event_name)
-      {
-        PFS_single_stat *stat;
-        stat= find_per_thread_cond_info_wait_stat(wait->m_thread, cond->m_info);
-        aggregate_single_stat(stat, wait_time);
-      }
+      stat= find_per_thread_cond_info_wait_stat(wait->m_thread, cond->m_info);
+      aggregate_single_stat_chain(stat, wait_time);
     }
   }
 
@@ -1637,14 +1625,16 @@ static void end_table_wait_v1(PSI_table_
     ulonglong wait_time= wait->m_timer_end- wait->m_timer_start;
     aggregate_single_stat_chain(& table->m_wait_stat, wait_time);
 
-#ifdef LATER
-    if (flag_events_waits_summary_by_thread_by_event_name)
-    {
-      PFS_single_stat *stat;
-      stat= find_per_thread_table_info_wait_stat(wait->m_thread, table->m_info);
-      aggregate_single_stat(stat, wait_time);
-    }
-#endif
+    /*
+      There is currently no per table and per thread aggregation.
+      The number of tables in the application is arbitrary, and may be high.
+      The number of slots per thread to hold aggregates is fixed,
+      and is constrained by memory.
+      Implementing a per thread and per table aggregate has not been decided yet.
+      If it's implemented, it's likely that the user will have to specify, per table name,
+      if the aggregate per thread is to be computed or not.
+      This will mean a SETUP_ table.
+    */
   }
   wait->m_thread->m_wait_locker_count--;
 }
@@ -1744,16 +1734,13 @@ static void end_file_wait_v1(PSI_file_lo
       insert_events_waits_history_long(wait);
 
     /* TODO: safety ? */
+    PFS_single_stat_chain *stat;
     PFS_file *file= pfs_locker->m_target.m_file;
+
     ulonglong wait_time= wait->m_timer_end- wait->m_timer_start;
     aggregate_single_stat_chain(& file->m_wait_stat, wait_time);
-
-    if (flag_events_waits_summary_by_thread_by_event_name)
-    {
-      PFS_single_stat *stat;
-      stat= find_per_thread_file_info_wait_stat(wait->m_thread, file->m_info);
-      aggregate_single_stat(stat, wait_time);
-    }
+    stat= find_per_thread_file_info_wait_stat(wait->m_thread, file->m_info);
+    aggregate_single_stat_chain(stat, wait_time);
 
     PFS_file_info *info= file->m_info;
 

=== modified file 'storage/perfschema/pfs_events_waits.h'
--- a/storage/perfschema/pfs_events_waits.h	2009-03-18 22:52:12 +0000
+++ b/storage/perfschema/pfs_events_waits.h	2009-04-02 00:26:34 +0000
@@ -175,7 +175,6 @@ void insert_events_waits_history(PFS_thr
 
 /**
   Insert a wait record in table EVENTS_WAITS_HISTORY_LONG.
-  @param thread Running thread
   @param wait record to insert
 */
 void insert_events_waits_history_long(PFS_events_waits *wait);

=== modified file 'storage/perfschema/pfs_instr.cc'
--- a/storage/perfschema/pfs_instr.cc	2009-03-18 22:52:12 +0000
+++ b/storage/perfschema/pfs_instr.cc	2009-04-02 00:26:34 +0000
@@ -53,7 +53,7 @@ static uint per_thread_rwlock_info_start
 static uint per_thread_cond_info_start;
 static uint per_thread_file_info_start;
 static uint thread_instr_info_waits_sizing;
-static PFS_single_stat *thread_instr_info_waits_array= NULL;
+static PFS_single_stat_chain *thread_instr_info_waits_array= NULL;
 
 static PFS_events_waits *thread_history_array= NULL;
 
@@ -157,11 +157,22 @@ int init_instruments(uint mutex_sizing,
   if (thread_instr_info_waits_sizing > 0)
   {
     thread_instr_info_waits_array= PFS_MALLOC_ARRAY(thread_instr_info_waits_sizing,
-                                           PFS_single_stat, MYF(MY_ZEROFILL));
+                                           PFS_single_stat_chain, MYF(MY_ZEROFILL));
     if (thread_instr_info_waits_array == NULL)
       return 1;
   }
 
+  for (index= 0; index < thread_instr_info_waits_sizing; index++)
+  {
+    /*
+      Currently, this chain is of length 1, but it's still implemented as a stat chain,
+      since more aggregations are planned to be implemented in m_parent.
+    */
+    thread_instr_info_waits_array[index].m_control_flag=
+      & flag_events_waits_summary_by_thread_by_event_name;
+    thread_instr_info_waits_array[index].m_parent= NULL;
+  }
+
   for (index= 0; index < thread_max; index++)
   {
     thread_array[index].m_waits_history=
@@ -173,10 +184,10 @@ int init_instruments(uint mutex_sizing,
   return 0;
 }
 
-PFS_single_stat *
+PFS_single_stat_chain *
 find_per_thread_mutex_info_wait_stat(PFS_thread *thread, PFS_mutex_info *info)
 {
-  PFS_single_stat *stat;
+  PFS_single_stat_chain *stat;
   uint index;
 
   DBUG_ASSERT(thread != NULL);
@@ -188,10 +199,10 @@ find_per_thread_mutex_info_wait_stat(PFS
   return stat;
 }
 
-PFS_single_stat *
+PFS_single_stat_chain *
 find_per_thread_rwlock_info_wait_stat(PFS_thread *thread, PFS_rwlock_info *info)
 {
-  PFS_single_stat *stat;
+  PFS_single_stat_chain *stat;
   uint index;
 
   DBUG_ASSERT(thread != NULL);
@@ -203,10 +214,10 @@ find_per_thread_rwlock_info_wait_stat(PF
   return stat;
 }
 
-PFS_single_stat *
+PFS_single_stat_chain *
 find_per_thread_cond_info_wait_stat(PFS_thread *thread, PFS_cond_info *info)
 {
-  PFS_single_stat *stat;
+  PFS_single_stat_chain *stat;
   uint index;
 
   DBUG_ASSERT(thread != NULL);
@@ -218,10 +229,10 @@ find_per_thread_cond_info_wait_stat(PFS_
   return stat;
 }
 
-PFS_single_stat *
+PFS_single_stat_chain *
 find_per_thread_file_info_wait_stat(PFS_thread *thread, PFS_file_info *info)
 {
-  PFS_single_stat *stat;
+  PFS_single_stat_chain *stat;
   uint index;
 
   DBUG_ASSERT(thread != NULL);
@@ -235,13 +246,13 @@ find_per_thread_file_info_wait_stat(PFS_
 
 void reset_per_thread_wait_stat()
 {
-  PFS_single_stat *stat;
+  PFS_single_stat_chain *stat;
   uint index;
 
   for (index= 0; index < thread_instr_info_waits_sizing; index++)
   {
     stat= & thread_instr_info_waits_array[index];
-    reset_single_stat(stat);
+    reset_single_stat_link(stat);
   }
 }
 
@@ -476,7 +487,7 @@ PFS_thread* create_thread(PFS_thread_inf
 
           for (i= 0; i < instr_info_per_thread ; i++)
           {
-            reset_single_stat(& pfs->m_instr_info_wait_stats[i]);
+            reset_single_stat_link(& pfs->m_instr_info_wait_stats[i]);
           }
           pfs->m_lock.dirty_to_allocated();
           return pfs;

=== modified file 'storage/perfschema/pfs_instr.h'
--- a/storage/perfschema/pfs_instr.h	2009-03-18 22:52:12 +0000
+++ b/storage/perfschema/pfs_instr.h	2009-04-02 00:26:34 +0000
@@ -191,7 +191,7 @@ struct PFS_thread
     This member holds the data for the table
     PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME.
   */
-  PFS_single_stat *m_instr_info_wait_stats;
+  PFS_single_stat_chain *m_instr_info_wait_stats;
 };
 
 /**
@@ -200,7 +200,7 @@ struct PFS_thread
   @param info mutex info
   @return the per thread per mutex info wait stat
 */
-PFS_single_stat*
+PFS_single_stat_chain*
 find_per_thread_mutex_info_wait_stat(PFS_thread *thread, PFS_mutex_info *info);
 
 /**
@@ -209,7 +209,7 @@ find_per_thread_mutex_info_wait_stat(PFS
   @param info rwlock info
   @return the per thread per rwlock info wait stat
 */
-PFS_single_stat*
+PFS_single_stat_chain*
 find_per_thread_rwlock_info_wait_stat(PFS_thread *thread, PFS_rwlock_info *info);
 
 /**
@@ -218,7 +218,7 @@ find_per_thread_rwlock_info_wait_stat(PF
   @param info condition info
   @return the per thread per condition info wait stat
 */
-PFS_single_stat*
+PFS_single_stat_chain*
 find_per_thread_cond_info_wait_stat(PFS_thread *thread, PFS_cond_info *info);
 
 /**
@@ -227,7 +227,7 @@ find_per_thread_cond_info_wait_stat(PFS_
   @param info file info
   @return the per thread per file info wait stat
 */
-PFS_single_stat*
+PFS_single_stat_chain*
 find_per_thread_file_info_wait_stat(PFS_thread *thread, PFS_file_info *info);
 
 /**

=== modified file 'storage/perfschema/table_events_waits_summary.cc'
--- a/storage/perfschema/table_events_waits_summary.cc	2009-03-29 21:38:18 +0000
+++ b/storage/perfschema/table_events_waits_summary.cc	2009-04-02 00:26:34 +0000
@@ -203,7 +203,7 @@ int table_events_waits_summary_by_thread
 void table_events_waits_summary_by_thread_by_event_name::make_mutex_row(PFS_thread *thread,
                                                                   PFS_mutex_info *info)
 {
-  PFS_single_stat *stat;
+  PFS_single_stat_chain *stat;
 
   stat= find_per_thread_mutex_info_wait_stat(thread, info);
 
@@ -230,7 +230,7 @@ void table_events_waits_summary_by_threa
 void table_events_waits_summary_by_thread_by_event_name::make_rwlock_row(PFS_thread *thread,
                                                                    PFS_rwlock_info *info)
 {
-  PFS_single_stat *stat;
+  PFS_single_stat_chain *stat;
 
   stat= find_per_thread_rwlock_info_wait_stat(thread, info);
 
@@ -257,7 +257,7 @@ void table_events_waits_summary_by_threa
 void table_events_waits_summary_by_thread_by_event_name::make_cond_row(PFS_thread *thread,
                                                                  PFS_cond_info *info)
 {
-  PFS_single_stat *stat;
+  PFS_single_stat_chain *stat;
 
   stat= find_per_thread_cond_info_wait_stat(thread, info);
 
@@ -284,7 +284,7 @@ void table_events_waits_summary_by_threa
 void table_events_waits_summary_by_thread_by_event_name::make_file_row(PFS_thread *thread,
                                                                  PFS_file_info *info)
 {
-  PFS_single_stat *stat;
+  PFS_single_stat_chain *stat;
 
   stat= find_per_thread_file_info_wait_stat(thread, info);
 

=== modified file 'storage/perfschema/unittest/pfs_instr-t.cc'
--- a/storage/perfschema/unittest/pfs_instr-t.cc	2009-03-13 02:30:13 +0000
+++ b/storage/perfschema/unittest/pfs_instr-t.cc	2009-04-02 00:26:34 +0000
@@ -263,8 +263,8 @@ void test_per_thread_wait()
   PFS_thread_info dummy_thread_info;
   PFS_file_info dummy_file_info;
   PFS_thread *thread;
-  PFS_single_stat *base;
-  PFS_single_stat *stat;
+  PFS_single_stat_chain *base;
+  PFS_single_stat_chain *stat;
 
   /* Per mutex info waits should be at [0..9] */
   mutex_info_max= 10;

Thread
bzr commit into mysql-6.0-perf branch (marc.alff:2848) Marc Alff2 Apr