List:Commits« Previous MessageNext Message »
From:Marc Alff Date:June 12 2012 7:05am
Subject:bzr push into mysql-trunk branch (marc.alff:3990)
View as plain text  
 3990 Marc Alff	2012-06-12 [merge]
      Local merge

    modified:
      client/mysql.cc*
      libmysql/CMakeLists.txt
      mysys_ssl/my_default.cc
      storage/innobase/dict/dict0stats.cc
=== modified file 'mysql-test/suite/perfschema/r/sizing_default.result'
--- a/mysql-test/suite/perfschema/r/sizing_default.result	2012-06-08 14:11:10 +0000
+++ b/mysql-test/suite/perfschema/r/sizing_default.result	2012-06-11 14:36:24 +0000
@@ -78,21 +78,21 @@ performance_schema	events_waits_history_
 performance_schema	(pfs_mutex_class).row_size	256
 performance_schema	(pfs_mutex_class).row_count	200
 performance_schema	(pfs_mutex_class).memory	51200
-performance_schema	(pfs_rwlock_class).row_size	256
+performance_schema	(pfs_rwlock_class).row_size	320
 performance_schema	(pfs_rwlock_class).row_count	30
-performance_schema	(pfs_rwlock_class).memory	7680
-performance_schema	(pfs_cond_class).row_size	192
+performance_schema	(pfs_rwlock_class).memory	9600
+performance_schema	(pfs_cond_class).row_size	256
 performance_schema	(pfs_cond_class).row_count	80
-performance_schema	(pfs_cond_class).memory	15360
+performance_schema	(pfs_cond_class).memory	20480
 performance_schema	(pfs_thread_class).row_size	192
 performance_schema	(pfs_thread_class).row_count	50
 performance_schema	(pfs_thread_class).memory	9600
 performance_schema	(pfs_file_class).row_size	320
 performance_schema	(pfs_file_class).row_count	50
 performance_schema	(pfs_file_class).memory	16000
-performance_schema	mutex_instances.row_size	192
+performance_schema	mutex_instances.row_size	128
 performance_schema	mutex_instances.row_count	2837
-performance_schema	mutex_instances.memory	544704
+performance_schema	mutex_instances.memory	363136
 performance_schema	rwlock_instances.row_size	192
 performance_schema	rwlock_instances.row_count	1724
 performance_schema	rwlock_instances.memory	331008
@@ -102,9 +102,9 @@ performance_schema	cond_instances.memory
 performance_schema	threads.row_size	1856
 performance_schema	threads.row_count	224
 performance_schema	threads.memory	415744
-performance_schema	file_instances.row_size	768
+performance_schema	file_instances.row_size	704
 performance_schema	file_instances.row_count	1556
-performance_schema	file_instances.memory	1195008
+performance_schema	file_instances.memory	1095424
 performance_schema	(pfs_file_handle).row_size	8
 performance_schema	(pfs_file_handle).row_count	32768
 performance_schema	(pfs_file_handle).memory	262144
@@ -123,9 +123,6 @@ performance_schema	setup_actors.memory	2
 performance_schema	setup_objects.row_size	448
 performance_schema	setup_objects.row_count	100
 performance_schema	setup_objects.memory	44800
-performance_schema	events_waits_summary_global_by_event_name.row_size	32
-performance_schema	events_waits_summary_global_by_event_name.row_count	373
-performance_schema	events_waits_summary_global_by_event_name.memory	11936
 performance_schema	(pfs_account).row_size	256
 performance_schema	(pfs_account).row_count	10
 performance_schema	(pfs_account).memory	2560
@@ -198,9 +195,9 @@ performance_schema	events_statements_cur
 performance_schema	(pfs_socket_class).row_size	320
 performance_schema	(pfs_socket_class).row_count	10
 performance_schema	(pfs_socket_class).memory	3200
-performance_schema	socket_instances.row_size	384
+performance_schema	socket_instances.row_size	320
 performance_schema	socket_instances.row_count	179
-performance_schema	socket_instances.memory	68736
+performance_schema	socket_instances.memory	57280
 performance_schema	events_statements_summary_by_digest.row_size	1280
 performance_schema	events_statements_summary_by_digest.row_count	1000
 performance_schema	events_statements_summary_by_digest.memory	1280000
@@ -223,4 +220,4 @@ performance_schema	(table_share_hash).co
 performance_schema	(table_share_hash).size	445
 performance_schema	(user_hash).count	2
 performance_schema	(user_hash).size	5
-performance_schema	performance_schema.memory	35707744
+performance_schema	performance_schema.memory	35410240

=== modified file 'mysql-test/suite/perfschema/r/sizing_high.result'
--- a/mysql-test/suite/perfschema/r/sizing_high.result	2012-06-08 14:11:10 +0000
+++ b/mysql-test/suite/perfschema/r/sizing_high.result	2012-06-11 14:36:24 +0000
@@ -78,21 +78,21 @@ performance_schema	events_waits_history_
 performance_schema	(pfs_mutex_class).row_size	256
 performance_schema	(pfs_mutex_class).row_count	200
 performance_schema	(pfs_mutex_class).memory	51200
-performance_schema	(pfs_rwlock_class).row_size	256
+performance_schema	(pfs_rwlock_class).row_size	320
 performance_schema	(pfs_rwlock_class).row_count	30
-performance_schema	(pfs_rwlock_class).memory	7680
-performance_schema	(pfs_cond_class).row_size	192
+performance_schema	(pfs_rwlock_class).memory	9600
+performance_schema	(pfs_cond_class).row_size	256
 performance_schema	(pfs_cond_class).row_count	80
-performance_schema	(pfs_cond_class).memory	15360
+performance_schema	(pfs_cond_class).memory	20480
 performance_schema	(pfs_thread_class).row_size	192
 performance_schema	(pfs_thread_class).row_count	50
 performance_schema	(pfs_thread_class).memory	9600
 performance_schema	(pfs_file_class).row_size	320
 performance_schema	(pfs_file_class).row_count	50
 performance_schema	(pfs_file_class).memory	16000
-performance_schema	mutex_instances.row_size	192
+performance_schema	mutex_instances.row_size	128
 performance_schema	mutex_instances.row_count	42200
-performance_schema	mutex_instances.memory	8102400
+performance_schema	mutex_instances.memory	5401600
 performance_schema	rwlock_instances.row_size	192
 performance_schema	rwlock_instances.row_count	30800
 performance_schema	rwlock_instances.memory	5913600
@@ -102,9 +102,9 @@ performance_schema	cond_instances.memory
 performance_schema	threads.row_size	1856
 performance_schema	threads.row_count	500
 performance_schema	threads.memory	928000
-performance_schema	file_instances.row_size	768
+performance_schema	file_instances.row_size	704
 performance_schema	file_instances.row_count	23385
-performance_schema	file_instances.memory	17959680
+performance_schema	file_instances.memory	16463040
 performance_schema	(pfs_file_handle).row_size	8
 performance_schema	(pfs_file_handle).row_count	32768
 performance_schema	(pfs_file_handle).memory	262144
@@ -123,9 +123,6 @@ performance_schema	setup_actors.memory	2
 performance_schema	setup_objects.row_size	448
 performance_schema	setup_objects.row_count	100
 performance_schema	setup_objects.memory	44800
-performance_schema	events_waits_summary_global_by_event_name.row_size	32
-performance_schema	events_waits_summary_global_by_event_name.row_count	373
-performance_schema	events_waits_summary_global_by_event_name.memory	11936
 performance_schema	(pfs_account).row_size	256
 performance_schema	(pfs_account).row_count	100
 performance_schema	(pfs_account).memory	25600
@@ -198,9 +195,9 @@ performance_schema	events_statements_cur
 performance_schema	(pfs_socket_class).row_size	320
 performance_schema	(pfs_socket_class).row_count	10
 performance_schema	(pfs_socket_class).memory	3200
-performance_schema	socket_instances.row_size	384
+performance_schema	socket_instances.row_size	320
 performance_schema	socket_instances.row_count	420
-performance_schema	socket_instances.memory	161280
+performance_schema	socket_instances.memory	134400
 performance_schema	events_statements_summary_by_digest.row_size	1280
 performance_schema	events_statements_summary_by_digest.row_count	10000
 performance_schema	events_statements_summary_by_digest.memory	12800000
@@ -223,4 +220,4 @@ performance_schema	(table_share_hash).co
 performance_schema	(table_share_hash).size	12500
 performance_schema	(user_hash).count	2
 performance_schema	(user_hash).size	100
-performance_schema	performance_schema.memory	422360024
+performance_schema	performance_schema.memory	418130808

=== modified file 'mysql-test/suite/perfschema/r/sizing_low.result'
--- a/mysql-test/suite/perfschema/r/sizing_low.result	2012-06-08 14:11:10 +0000
+++ b/mysql-test/suite/perfschema/r/sizing_low.result	2012-06-11 14:36:24 +0000
@@ -78,21 +78,21 @@ performance_schema	events_waits_history_
 performance_schema	(pfs_mutex_class).row_size	256
 performance_schema	(pfs_mutex_class).row_count	200
 performance_schema	(pfs_mutex_class).memory	51200
-performance_schema	(pfs_rwlock_class).row_size	256
+performance_schema	(pfs_rwlock_class).row_size	320
 performance_schema	(pfs_rwlock_class).row_count	30
-performance_schema	(pfs_rwlock_class).memory	7680
-performance_schema	(pfs_cond_class).row_size	192
+performance_schema	(pfs_rwlock_class).memory	9600
+performance_schema	(pfs_cond_class).row_size	256
 performance_schema	(pfs_cond_class).row_count	80
-performance_schema	(pfs_cond_class).memory	15360
+performance_schema	(pfs_cond_class).memory	20480
 performance_schema	(pfs_thread_class).row_size	192
 performance_schema	(pfs_thread_class).row_count	50
 performance_schema	(pfs_thread_class).memory	9600
 performance_schema	(pfs_file_class).row_size	320
 performance_schema	(pfs_file_class).row_count	50
 performance_schema	(pfs_file_class).memory	16000
-performance_schema	mutex_instances.row_size	192
+performance_schema	mutex_instances.row_size	128
 performance_schema	mutex_instances.row_count	2500
-performance_schema	mutex_instances.memory	480000
+performance_schema	mutex_instances.memory	320000
 performance_schema	rwlock_instances.row_size	192
 performance_schema	rwlock_instances.row_count	1612
 performance_schema	rwlock_instances.memory	309504
@@ -102,9 +102,9 @@ performance_schema	cond_instances.memory
 performance_schema	threads.row_size	1856
 performance_schema	threads.row_count	112
 performance_schema	threads.memory	207872
-performance_schema	file_instances.row_size	768
+performance_schema	file_instances.row_size	704
 performance_schema	file_instances.row_count	1556
-performance_schema	file_instances.memory	1195008
+performance_schema	file_instances.memory	1095424
 performance_schema	(pfs_file_handle).row_size	8
 performance_schema	(pfs_file_handle).row_count	32768
 performance_schema	(pfs_file_handle).memory	262144
@@ -123,9 +123,6 @@ performance_schema	setup_actors.memory	2
 performance_schema	setup_objects.row_size	448
 performance_schema	setup_objects.row_count	100
 performance_schema	setup_objects.memory	44800
-performance_schema	events_waits_summary_global_by_event_name.row_size	32
-performance_schema	events_waits_summary_global_by_event_name.row_count	373
-performance_schema	events_waits_summary_global_by_event_name.memory	11936
 performance_schema	(pfs_account).row_size	256
 performance_schema	(pfs_account).row_count	10
 performance_schema	(pfs_account).memory	2560
@@ -198,9 +195,9 @@ performance_schema	events_statements_cur
 performance_schema	(pfs_socket_class).row_size	320
 performance_schema	(pfs_socket_class).row_count	10
 performance_schema	(pfs_socket_class).memory	3200
-performance_schema	socket_instances.row_size	384
+performance_schema	socket_instances.row_size	320
 performance_schema	socket_instances.row_count	67
-performance_schema	socket_instances.memory	25728
+performance_schema	socket_instances.memory	21440
 performance_schema	events_statements_summary_by_digest.row_size	1280
 performance_schema	events_statements_summary_by_digest.row_count	1000
 performance_schema	events_statements_summary_by_digest.memory	1280000
@@ -223,4 +220,4 @@ performance_schema	(table_share_hash).co
 performance_schema	(table_share_hash).size	445
 performance_schema	(user_hash).count	2
 performance_schema	(user_hash).size	5
-performance_schema	performance_schema.memory	24652768
+performance_schema	performance_schema.memory	24384000

=== modified file 'mysql-test/suite/perfschema/r/sizing_med.result'
--- a/mysql-test/suite/perfschema/r/sizing_med.result	2012-06-08 14:11:10 +0000
+++ b/mysql-test/suite/perfschema/r/sizing_med.result	2012-06-11 14:36:24 +0000
@@ -78,21 +78,21 @@ performance_schema	events_waits_history_
 performance_schema	(pfs_mutex_class).row_size	256
 performance_schema	(pfs_mutex_class).row_count	200
 performance_schema	(pfs_mutex_class).memory	51200
-performance_schema	(pfs_rwlock_class).row_size	256
+performance_schema	(pfs_rwlock_class).row_size	320
 performance_schema	(pfs_rwlock_class).row_count	30
-performance_schema	(pfs_rwlock_class).memory	7680
-performance_schema	(pfs_cond_class).row_size	192
+performance_schema	(pfs_rwlock_class).memory	9600
+performance_schema	(pfs_cond_class).row_size	256
 performance_schema	(pfs_cond_class).row_count	80
-performance_schema	(pfs_cond_class).memory	15360
+performance_schema	(pfs_cond_class).memory	20480
 performance_schema	(pfs_thread_class).row_size	192
 performance_schema	(pfs_thread_class).row_count	50
 performance_schema	(pfs_thread_class).memory	9600
 performance_schema	(pfs_file_class).row_size	320
 performance_schema	(pfs_file_class).row_count	50
 performance_schema	(pfs_file_class).memory	16000
-performance_schema	mutex_instances.row_size	192
+performance_schema	mutex_instances.row_size	128
 performance_schema	mutex_instances.row_count	3658
-performance_schema	mutex_instances.memory	702336
+performance_schema	mutex_instances.memory	468224
 performance_schema	rwlock_instances.row_size	192
 performance_schema	rwlock_instances.row_count	2222
 performance_schema	rwlock_instances.memory	426624
@@ -102,9 +102,9 @@ performance_schema	cond_instances.memory
 performance_schema	threads.row_size	1856
 performance_schema	threads.row_count	289
 performance_schema	threads.memory	536384
-performance_schema	file_instances.row_size	768
+performance_schema	file_instances.row_size	704
 performance_schema	file_instances.row_count	1754
-performance_schema	file_instances.memory	1347072
+performance_schema	file_instances.memory	1234816
 performance_schema	(pfs_file_handle).row_size	8
 performance_schema	(pfs_file_handle).row_count	32768
 performance_schema	(pfs_file_handle).memory	262144
@@ -123,9 +123,6 @@ performance_schema	setup_actors.memory	2
 performance_schema	setup_objects.row_size	448
 performance_schema	setup_objects.row_count	100
 performance_schema	setup_objects.memory	44800
-performance_schema	events_waits_summary_global_by_event_name.row_size	32
-performance_schema	events_waits_summary_global_by_event_name.row_count	373
-performance_schema	events_waits_summary_global_by_event_name.memory	11936
 performance_schema	(pfs_account).row_size	256
 performance_schema	(pfs_account).row_count	100
 performance_schema	(pfs_account).memory	25600
@@ -198,9 +195,9 @@ performance_schema	events_statements_cur
 performance_schema	(pfs_socket_class).row_size	320
 performance_schema	(pfs_socket_class).row_count	10
 performance_schema	(pfs_socket_class).memory	3200
-performance_schema	socket_instances.row_size	384
+performance_schema	socket_instances.row_size	320
 performance_schema	socket_instances.row_count	232
-performance_schema	socket_instances.memory	89088
+performance_schema	socket_instances.memory	74240
 performance_schema	events_statements_summary_by_digest.row_size	1280
 performance_schema	events_statements_summary_by_digest.row_count	5000
 performance_schema	events_statements_summary_by_digest.memory	6400000
@@ -223,4 +220,4 @@ performance_schema	(table_share_hash).co
 performance_schema	(table_share_hash).size	556
 performance_schema	(user_hash).count	2
 performance_schema	(user_hash).size	100
-performance_schema	performance_schema.memory	69923360
+performance_schema	performance_schema.memory	69557248

=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc	2012-05-31 15:15:33 +0000
+++ b/storage/perfschema/pfs.cc	2012-06-11 14:36:24 +0000
@@ -858,24 +858,35 @@ static inline int mysql_mutex_lock(...)
   @subsection IMPL_WAIT_SOCKET Socket waits
 
 @verbatim
-  socket_locker(T, F)
+  socket_locker(T, S)
    |
    | [1]
    |
-   |-> pfs_socket(F)                            =====>> [A], [B], [C], [D], [E]
+   |-> pfs_socket(S)                            =====>> [A], [B], [C], [D], [E]
         |
         | [2]
         |
-        |-> pfs_socket_class(F.class)           =====>> [C], [D]
+        |-> pfs_socket_class(S.class)           =====>> [C], [D]
         |
-        |-> pfs_thread(T).event_name(F)         =====>> [A]
+        |-> pfs_thread(T).event_name(S)         =====>> [A]
         |
-        ...
+        | [3]
+        |
+     3a |-> pfs_account(U, H).event_name(S)     =====>> [F], [G], [H]
+        .    |
+        .    | [4-RESET]
+        .    |
+     3b .....+-> pfs_user(U).event_name(S)      =====>> [G]
+        .    |
+     3c .....+-> pfs_host(H).event_name(S)      =====>> [H]
 @endverbatim
 
   Implemented as:
   - [1] @c start_socket_wait_v1(), @c end_socket_wait_v1().
   - [2] @c close_socket_v1()
+  - [3] @c aggregate_thread_waits()
+  - [4] @c PFS_account::aggregate_waits()
+  - [5] @c PFS_host::aggregate_waits()
   - [A] EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME,
         @c table_ews_by_thread_by_event_name::make_row()
   - [B] EVENTS_WAITS_SUMMARY_BY_INSTANCE,
@@ -886,6 +897,12 @@ static inline int mysql_mutex_lock(...)
         @c table_socket_summary_by_event_name::make_row()
   - [E] SOCKET_SUMMARY_BY_INSTANCE,
         @c table_socket_summary_by_instance::make_row()
+  - [F] EVENTS_WAITS_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME,
+        @c table_ews_by_account_by_event_name::make_row()
+  - [G] EVENTS_WAITS_SUMMARY_BY_USER_BY_EVENT_NAME,
+        @c table_ews_by_user_by_event_name::make_row()
+  - [H] EVENTS_WAITS_SUMMARY_BY_HOST_BY_EVENT_NAME,
+        @c table_ews_by_host_by_event_name::make_row()
 
   @subsection IMPL_WAIT_TABLE Table waits
 
@@ -2223,7 +2240,7 @@ start_mutex_wait_v1(PSI_mutex_locker_sta
         Complete shortcut.
       */
       /* Aggregate to EVENTS_WAITS_SUMMARY_BY_INSTANCE (counted) */
-      pfs_mutex->m_wait_stat.aggregate_counted();
+      pfs_mutex->m_mutex_stat.m_wait_stat.aggregate_counted();
       return NULL;
     }
   }
@@ -2321,7 +2338,7 @@ start_rwlock_wait_v1(PSI_rwlock_locker_s
         Complete shortcut.
       */
       /* Aggregate to EVENTS_WAITS_SUMMARY_BY_INSTANCE (counted) */
-      pfs_rwlock->m_wait_stat.aggregate_counted();
+      pfs_rwlock->m_rwlock_stat.m_wait_stat.aggregate_counted();
       return NULL;
     }
   }
@@ -2428,7 +2445,7 @@ start_cond_wait_v1(PSI_cond_locker_state
         Complete shortcut.
       */
       /* Aggregate to EVENTS_WAITS_SUMMARY_BY_INSTANCE (counted) */
-      pfs_cond->m_wait_stat.aggregate_counted();
+      pfs_cond->m_cond_stat.m_wait_stat.aggregate_counted();
       return NULL;
     }
   }
@@ -3126,22 +3143,15 @@ static void unlock_mutex_v1(PSI_mutex *m
     PFS_mutex::m_lock_stat is not exposed in user visible tables
     currently, so there is no point spending time computing it.
   */
-  PFS_thread *pfs_thread= reinterpret_cast<PFS_thread*> (thread);
-  DBUG_ASSERT(pfs_thread != NULL);
-
-  if (unlikely(! flag_events_waits_current))
-    return;
-  if (! pfs_mutex->m_class->m_enabled)
+  if (! pfs_mutex->m_enabled)
     return;
-  if (! pfs_thread->m_enabled)
+
+  if (! pfs_mutex->m_timed)
     return;
 
-  if (pfs_mutex->m_class->m_timed)
-  {
-    ulonglong locked_time;
-    locked_time= get_timer_pico_value(wait_timer) - pfs_mutex->m_last_locked;
-    aggregate_single_stat_chain(&pfs_mutex->m_lock_stat, locked_time);
-  }
+  ulonglong locked_time;
+  locked_time= get_timer_pico_value(wait_timer) - pfs_mutex->m_last_locked;
+  pfs_mutex->m_mutex_stat.m_lock_stat.aggregate_value(locked_time);
 #endif
 }
 
@@ -3199,32 +3209,23 @@ static void unlock_rwlock_v1(PSI_rwlock
 
 #ifdef LATER_WL2333
   /* See WL#2333: SHOW ENGINE ... LOCK STATUS. */
-  PFS_thread *pfs_thread= reinterpret_cast<PFS_thread*> (thread);
-  DBUG_ASSERT(pfs_thread != NULL);
 
-  if (unlikely(! flag_events_waits_current))
-    return;
-  if (! pfs_rwlock->m_class->m_enabled)
+  if (! pfs_rwlock->m_enabled)
     return;
-  if (! pfs_thread->m_enabled)
+
+  if (! pfs_rwlock->m_timed)
     return;
 
   ulonglong locked_time;
   if (last_writer)
   {
-    if (pfs_rwlock->m_class->m_timed)
-    {
-      locked_time= get_timer_pico_value(wait_timer) - pfs_rwlock->m_last_written;
-      aggregate_single_stat_chain(&pfs_rwlock->m_write_lock_stat, locked_time);
-    }
+    locked_time= get_timer_pico_value(wait_timer) - pfs_rwlock->m_last_written;
+    pfs_rwlock->m_rwlock_stat.m_write_lock_stat.aggregate_value(locked_time);
   }
   else if (last_reader)
   {
-    if (pfs_rwlock->m_class->m_timed)
-    {
-      locked_time= get_timer_pico_value(wait_timer) - pfs_rwlock->m_last_read;
-      aggregate_single_stat_chain(&pfs_rwlock->m_read_lock_stat, locked_time);
-    }
+    locked_time= get_timer_pico_value(wait_timer) - pfs_rwlock->m_last_read;
+    pfs_rwlock->m_rwlock_stat.m_read_lock_stat.aggregate_value(locked_time);
   }
 #else
   (void) last_reader;
@@ -3392,6 +3393,17 @@ static void end_idle_wait_v1(PSI_idle_lo
       thread->m_events_waits_current--;
     }
   }
+
+  if (flags & STATE_FLAG_TIMED)
+  {
+    /* Aggregate to EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME (timed) */
+    global_idle_stat.aggregate_value(wait_time);
+  }
+  else
+  {
+    /* Aggregate to EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME (counted) */
+    global_idle_stat.aggregate_counted();
+  }
 }
 
 /**
@@ -3417,12 +3429,12 @@ static void end_mutex_wait_v1(PSI_mutex_
     timer_end= state->m_timer();
     wait_time= timer_end - state->m_timer_start;
     /* Aggregate to EVENTS_WAITS_SUMMARY_BY_INSTANCE (timed) */
-    mutex->m_wait_stat.aggregate_value(wait_time);
+    mutex->m_mutex_stat.m_wait_stat.aggregate_value(wait_time);
   }
   else
   {
     /* Aggregate to EVENTS_WAITS_SUMMARY_BY_INSTANCE (counted) */
-    mutex->m_wait_stat.aggregate_counted();
+    mutex->m_mutex_stat.m_wait_stat.aggregate_counted();
   }
 
   if (likely(rc == 0))
@@ -3484,12 +3496,12 @@ static void end_rwlock_rdwait_v1(PSI_rwl
     timer_end= state->m_timer();
     wait_time= timer_end - state->m_timer_start;
     /* Aggregate to EVENTS_WAITS_SUMMARY_BY_INSTANCE (timed) */
-    rwlock->m_wait_stat.aggregate_value(wait_time);
+    rwlock->m_rwlock_stat.m_wait_stat.aggregate_value(wait_time);
   }
   else
   {
     /* Aggregate to EVENTS_WAITS_SUMMARY_BY_INSTANCE (counted) */
-    rwlock->m_wait_stat.aggregate_counted();
+    rwlock->m_rwlock_stat.m_wait_stat.aggregate_counted();
   }
 
   if (rc == 0)
@@ -3564,12 +3576,12 @@ static void end_rwlock_wrwait_v1(PSI_rwl
     timer_end= state->m_timer();
     wait_time= timer_end - state->m_timer_start;
     /* Aggregate to EVENTS_WAITS_SUMMARY_BY_INSTANCE (timed) */
-    rwlock->m_wait_stat.aggregate_value(wait_time);
+    rwlock->m_rwlock_stat.m_wait_stat.aggregate_value(wait_time);
   }
   else
   {
     /* Aggregate to EVENTS_WAITS_SUMMARY_BY_INSTANCE (counted) */
-    rwlock->m_wait_stat.aggregate_counted();
+    rwlock->m_rwlock_stat.m_wait_stat.aggregate_counted();
   }
 
   if (likely(rc == 0))
@@ -3635,12 +3647,12 @@ static void end_cond_wait_v1(PSI_cond_lo
     timer_end= state->m_timer();
     wait_time= timer_end - state->m_timer_start;
     /* Aggregate to EVENTS_WAITS_SUMMARY_BY_INSTANCE (timed) */
-    cond->m_wait_stat.aggregate_value(wait_time);
+    cond->m_cond_stat.m_wait_stat.aggregate_value(wait_time);
   }
   else
   {
     /* Aggregate to EVENTS_WAITS_SUMMARY_BY_INSTANCE (counted) */
-    cond->m_wait_stat.aggregate_counted();
+    cond->m_cond_stat.m_wait_stat.aggregate_counted();
   }
 
   if (state->m_flags & STATE_FLAG_THREAD)

=== modified file 'storage/perfschema/pfs_engine_table.cc'
--- a/storage/perfschema/pfs_engine_table.cc	2012-06-01 08:39:34 +0000
+++ b/storage/perfschema/pfs_engine_table.cc	2012-06-11 14:36:24 +0000
@@ -983,433 +983,420 @@ bool pfs_show_status(handlerton *hton, T
       total_memory+= size;
       break;
     case 56:
-      name= "events_waits_summary_global_by_event_name.row_size";
-      size= sizeof(PFS_single_stat);
-      break;
-    case 57:
-      name= "events_waits_summary_global_by_event_name.row_count";
-      size= wait_class_max;
-      break;
-    case 58:
-      name= "events_waits_summary_global_by_event_name.memory";
-      size= wait_class_max * sizeof(PFS_single_stat);
-      total_memory+= size;
-      break;
-    case 59:
       name= "(pfs_account).row_size";
       size= sizeof(PFS_account);
       break;
-    case 60:
+    case 57:
       name= "(pfs_account).row_count";
       size= account_max;
       break;
-    case 61:
+    case 58:
       name= "(pfs_account).memory";
       size= account_max * sizeof(PFS_account);
       total_memory+= size;
       break;
-    case 62:
+    case 59:
       name= "events_waits_summary_by_account_by_event_name.row_size";
       size= sizeof(PFS_single_stat);
       break;
-    case 63:
+    case 60:
       name= "events_waits_summary_by_account_by_event_name.row_count";
       size= account_max * wait_class_max;
       break;
-    case 64:
+    case 61:
       name= "events_waits_summary_by_account_by_event_name.memory";
       size= account_max * wait_class_max * sizeof(PFS_single_stat);
       total_memory+= size;
       break;
-    case 65:
+    case 62:
       name= "events_waits_summary_by_user_by_event_name.row_size";
       size= sizeof(PFS_single_stat);
       break;
-    case 66:
+    case 63:
       name= "events_waits_summary_by_user_by_event_name.row_count";
       size= user_max * wait_class_max;
       break;
-    case 67:
+    case 64:
       name= "events_waits_summary_by_user_by_event_name.memory";
       size= user_max * wait_class_max * sizeof(PFS_single_stat);
       total_memory+= size;
       break;
-    case 68:
+    case 65:
       name= "events_waits_summary_by_host_by_event_name.row_size";
       size= sizeof(PFS_single_stat);
       break;
-    case 69:
+    case 66:
       name= "events_waits_summary_by_host_by_event_name.row_count";
       size= host_max * wait_class_max;
       break;
-    case 70:
+    case 67:
       name= "events_waits_summary_by_host_by_event_name.memory";
       size= host_max * wait_class_max * sizeof(PFS_single_stat);
       total_memory+= size;
       break;
-    case 71:
+    case 68:
       name= "(pfs_user).row_size";
       size= sizeof(PFS_user);
       break;
-    case 72:
+    case 69:
       name= "(pfs_user).row_count";
       size= user_max;
       break;
-    case 73:
+    case 70:
       name= "(pfs_user).memory";
       size= user_max * sizeof(PFS_user);
       total_memory+= size;
       break;
-    case 74:
+    case 71:
       name= "(pfs_host).row_size";
       size= sizeof(PFS_host);
       break;
-    case 75:
+    case 72:
       name= "(pfs_host).row_count";
       size= host_max;
       break;
-    case 76:
+    case 73:
       name= "(pfs_host).memory";
       size= host_max * sizeof(PFS_host);
       total_memory+= size;
       break;
-    case 77:
+    case 74:
       name= "(pfs_stage_class).row_size";
       size= sizeof(PFS_stage_class);
       break;
-    case 78:
+    case 75:
       name= "(pfs_stage_class).row_count";
       size= stage_class_max;
       break;
-    case 79:
+    case 76:
       name= "(pfs_stage_class).memory";
       size= stage_class_max * sizeof(PFS_stage_class);
       total_memory+= size;
       break;
-    case 80:
+    case 77:
       name= "events_stages_history.row_size";
       size= sizeof(PFS_events_stages);
       break;
-    case 81:
+    case 78:
       name= "events_stages_history.row_count";
       size= events_stages_history_per_thread * thread_max;
       break;
-    case 82:
+    case 79:
       name= "events_stages_history.memory";
       size= events_stages_history_per_thread * thread_max
         * sizeof(PFS_events_stages);
       total_memory+= size;
       break;
-    case 83:
+    case 80:
       name= "events_stages_history_long.row_size";
       size= sizeof(PFS_events_stages);
       break;
-    case 84:
+    case 81:
       name= "events_stages_history_long.row_count";
       size= events_stages_history_long_size;
       break;
-    case 85:
+    case 82:
       name= "events_stages_history_long.memory";
       size= events_stages_history_long_size * sizeof(PFS_events_stages);
       total_memory+= size;
       break;
-    case 86:
+    case 83:
       name= "events_stages_summary_by_thread_by_event_name.row_size";
       size= sizeof(PFS_stage_stat);
       break;
-    case 87:
+    case 84:
       name= "events_stages_summary_by_thread_by_event_name.row_count";
       size= thread_max * stage_class_max;
       break;
-    case 88:
+    case 85:
       name= "events_stages_summary_by_thread_by_event_name.memory";
       size= thread_max * stage_class_max * sizeof(PFS_stage_stat);
       total_memory+= size;
       break;
-    case 89:
+    case 86:
       name= "events_stages_summary_global_by_event_name.row_size";
       size= sizeof(PFS_stage_stat);
       break;
-    case 90:
+    case 87:
       name= "events_stages_summary_global_by_event_name.row_count";
       size= stage_class_max;
       break;
-    case 91:
+    case 88:
       name= "events_stages_summary_global_by_event_name.memory";
       size= stage_class_max * sizeof(PFS_stage_stat);
       total_memory+= size;
       break;
-    case 92:
+    case 89:
       name= "events_stages_summary_by_account_by_event_name.row_size";
       size= sizeof(PFS_stage_stat);
       break;
-    case 93:
+    case 90:
       name= "events_stages_summary_by_account_by_event_name.row_count";
       size= account_max * stage_class_max;
       break;
-    case 94:
+    case 91:
       name= "events_stages_summary_by_account_by_event_name.memory";
       size= account_max * stage_class_max * sizeof(PFS_stage_stat);
       total_memory+= size;
       break;
-    case 95:
+    case 92:
       name= "events_stages_summary_by_user_by_event_name.row_size";
       size= sizeof(PFS_stage_stat);
       break;
-    case 96:
+    case 93:
       name= "events_stages_summary_by_user_by_event_name.row_count";
       size= user_max * stage_class_max;
       break;
-    case 97:
+    case 94:
       name= "events_stages_summary_by_user_by_event_name.memory";
       size= user_max * stage_class_max * sizeof(PFS_stage_stat);
       total_memory+= size;
       break;
-    case 98:
+    case 95:
       name= "events_stages_summary_by_host_by_event_name.row_size";
       size= sizeof(PFS_stage_stat);
       break;
-    case 99:
+    case 96:
       name= "events_stages_summary_by_host_by_event_name.row_count";
       size= host_max * stage_class_max;
       break;
-    case 100:
+    case 97:
       name= "events_stages_summary_by_host_by_event_name.memory";
       size= host_max * stage_class_max * sizeof(PFS_stage_stat);
       total_memory+= size;
       break;
-    case 101:
+    case 98:
       name= "(pfs_statement_class).row_size";
       size= sizeof(PFS_statement_class);
       break;
-    case 102:
+    case 99:
       name= "(pfs_statement_class).row_count";
       size= statement_class_max;
       break;
-    case 103:
+    case 100:
       name= "(pfs_statement_class).memory";
       size= statement_class_max * sizeof(PFS_statement_class);
       total_memory+= size;
       break;
-    case 104:
+    case 101:
       name= "events_statements_history.row_size";
       size= sizeof(PFS_events_statements);
       break;
-    case 105:
+    case 102:
       name= "events_statements_history.row_count";
       size= events_statements_history_per_thread * thread_max;
       break;
-    case 106:
+    case 103:
       name= "events_statements_history.memory";
       size= events_statements_history_per_thread * thread_max
         * sizeof(PFS_events_statements);
       total_memory+= size;
       break;
-    case 107:
+    case 104:
       name= "events_statements_history_long.row_size";
       size= sizeof(PFS_events_statements);
       break;
-    case 108:
+    case 105:
       name= "events_statements_history_long.row_count";
       size= events_statements_history_long_size;
       break;
-    case 109:
+    case 106:
       name= "events_statements_history_long.memory";
       size= events_statements_history_long_size * sizeof(PFS_events_statements);
       total_memory+= size;
       break;
-    case 110:
+    case 107:
       name= "events_statements_summary_by_thread_by_event_name.row_size";
       size= sizeof(PFS_statement_stat);
       break;
-    case 111:
+    case 108:
       name= "events_statements_summary_by_thread_by_event_name.row_count";
       size= thread_max * statement_class_max;
       break;
-    case 112:
+    case 109:
       name= "events_statements_summary_by_thread_by_event_name.memory";
       size= thread_max * statement_class_max * sizeof(PFS_statement_stat);
       total_memory+= size;
       break;
-    case 113:
+    case 110:
       name= "events_statements_summary_global_by_event_name.row_size";
       size= sizeof(PFS_statement_stat);
       break;
-    case 114:
+    case 111:
       name= "events_statements_summary_global_by_event_name.row_count";
       size= statement_class_max;
       break;
-    case 115:
+    case 112:
       name= "events_statements_summary_global_by_event_name.memory";
       size= statement_class_max * sizeof(PFS_statement_stat);
       total_memory+= size;
       break;
-    case 116:
+    case 113:
       name= "events_statements_summary_by_account_by_event_name.row_size";
       size= sizeof(PFS_statement_stat);
       break;
-    case 117:
+    case 114:
       name= "events_statements_summary_by_account_by_event_name.row_count";
       size= account_max * statement_class_max;
       break;
-    case 118:
+    case 115:
       name= "events_statements_summary_by_account_by_event_name.memory";
       size= account_max * statement_class_max * sizeof(PFS_statement_stat);
       total_memory+= size;
       break;
-    case 119:
+    case 116:
       name= "events_statements_summary_by_user_by_event_name.row_size";
       size= sizeof(PFS_statement_stat);
       break;
-    case 120:
+    case 117:
       name= "events_statements_summary_by_user_by_event_name.row_count";
       size= user_max * statement_class_max;
       break;
-    case 121:
+    case 118:
       name= "events_statements_summary_by_user_by_event_name.memory";
       size= user_max * statement_class_max * sizeof(PFS_statement_stat);
       total_memory+= size;
       break;
-    case 122:
+    case 119:
       name= "events_statements_summary_by_host_by_event_name.row_size";
       size= sizeof(PFS_statement_stat);
       break;
-    case 123:
+    case 120:
       name= "events_statements_summary_by_host_by_event_name.row_count";
       size= host_max * statement_class_max;
       break;
-    case 124:
+    case 121:
       name= "events_statements_summary_by_host_by_event_name.memory";
       size= host_max * statement_class_max * sizeof(PFS_statement_stat);
       total_memory+= size;
       break;
-    case 125:
+    case 122:
       name= "events_statements_current.row_size";
       size= sizeof(PFS_events_statements);
       break;
-    case 126:
+    case 123:
       name= "events_statements_current.row_count";
       size= thread_max * statement_stack_max;
       break;
-    case 127:
+    case 124:
       name= "events_statements_current.memory";
       size= thread_max * statement_stack_max * sizeof(PFS_events_statements);
       total_memory+= size;
       break;
-    case 128:
+    case 125:
       name= "(pfs_socket_class).row_size";
       size= sizeof(PFS_socket_class);
       break;
-    case 129:
+    case 126:
       name= "(pfs_socket_class).row_count";
       size= socket_class_max;
       break;
-    case 130:
+    case 127:
       name= "(pfs_socket_class).memory";
       size= socket_class_max * sizeof(PFS_socket_class);
       total_memory+= size;
       break;
-    case 131:
+    case 128:
       name= "socket_instances.row_size";
       size= sizeof(PFS_socket);
       break;
-    case 132:
+    case 129:
       name= "socket_instances.row_count";
       size= socket_max;
       break;
-    case 133:
+    case 130:
       name= "socket_instances.memory";
       size= socket_max * sizeof(PFS_socket);
       total_memory+= size;
       break;
-    case 134:
+    case 131:
       name= "events_statements_summary_by_digest.row_size";
       size= sizeof(PFS_statements_digest_stat);
       break;
-    case 135:
+    case 132:
       name= "events_statements_summary_by_digest.row_count";
       size= digest_max;
       break;
-    case 136:
+    case 133:
       name= "events_statements_summary_by_digest.memory";
       size= digest_max * sizeof(PFS_statements_digest_stat);
       total_memory+= size;
       break;
-    case 137:
+    case 134:
       name= "session_connect_attrs.row_size";
       size= thread_max;
       break;
-    case 138:
+    case 135:
       name= "session_connect_attrs.row_count";
       size= session_connect_attrs_size_per_thread;
       break;
-    case 139:
+    case 136:
       name= "session_connect_attrs.memory";
       size= thread_max * session_connect_attrs_size_per_thread;
       total_memory+= size;
       break;
 
-    case 140:
+    case 137:
       name= "(account_hash).count";
       size= account_hash.count;
       break;
-    case 141:
+    case 138:
       name= "(account_hash).size";
       size= account_hash.size;
       break;
-    case 142:
+    case 139:
       name= "(digest_hash).count";
       size= digest_hash.count;
       break;
-    case 143:
+    case 140:
       name= "(digest_hash).size";
       size= digest_hash.size;
       break;
-    case 144:
+    case 141:
       name= "(filename_hash).count";
       size= filename_hash.count;
       break;
-    case 145:
+    case 142:
       name= "(filename_hash).size";
       size= filename_hash.size;
       break;
-    case 146:
+    case 143:
       name= "(host_hash).count";
       size= host_hash.count;
       break;
-    case 147:
+    case 144:
       name= "(host_hash).size";
       size= host_hash.size;
       break;
-    case 148:
+    case 145:
       name= "(setup_actor_hash).count";
       size= setup_actor_hash.count;
       break;
-    case 149:
+    case 146:
       name= "(setup_actor_hash).size";
       size= setup_actor_hash.size;
       break;
-    case 150:
+    case 147:
       name= "(setup_object_hash).count";
       size= setup_object_hash.count;
       break;
-    case 151:
+    case 148:
       name= "(setup_object_hash).size";
       size= setup_object_hash.size;
       break;
-    case 152:
+    case 149:
       name= "(table_share_hash).count";
       size= table_share_hash.count;
       break;
-    case 153:
+    case 150:
       name= "(table_share_hash).size";
       size= table_share_hash.size;
       break;
-    case 154:
+    case 151:
       name= "(user_hash).count";
       size= user_hash.count;
       break;
-    case 155:
+    case 152:
       name= "(user_hash).size";
       size= user_hash.size;
       break;
@@ -1418,7 +1405,7 @@ bool pfs_show_status(handlerton *hton, T
       This case must be last,
       for aggregation in total_memory.
     */
-    case 156:
+    case 153:
       name= "performance_schema.memory";
       size= total_memory;
       /* This will fail if something is not advertised here */

=== modified file 'storage/perfschema/pfs_events_waits.cc'
--- a/storage/perfschema/pfs_events_waits.cc	2012-05-15 09:39:47 +0000
+++ b/storage/perfschema/pfs_events_waits.cc	2012-06-11 14:36:24 +0000
@@ -230,19 +230,6 @@ void reset_events_waits_by_host()
   }
 }
 
-/** Reset table EVENTS_WAITS_GLOBAL_BY_EVENT_NAME data. */
-void reset_events_waits_global()
-{
-  PFS_single_stat *stat= global_instr_class_waits_array;
-  PFS_single_stat *stat_last= global_instr_class_waits_array + wait_class_max;
-
-  for ( ; stat < stat_last; stat++)
-    stat->reset();
-
-  global_table_io_stat.reset();
-  global_table_lock_stat.reset();
-}
-
 void reset_table_waits_by_table()
 {
   PFS_table_share *pfs= table_share_array;

=== modified file 'storage/perfschema/pfs_instr.cc'
--- a/storage/perfschema/pfs_instr.cc	2012-05-31 15:15:33 +0000
+++ b/storage/perfschema/pfs_instr.cc	2012-06-11 14:36:24 +0000
@@ -144,7 +144,6 @@ PFS_table *table_array= NULL;
 */
 PFS_socket *socket_array= NULL;
 
-PFS_single_stat *global_instr_class_waits_array= NULL;
 PFS_stage_stat *global_instr_class_stages_array= NULL;
 PFS_statement_stat *global_instr_class_statements_array= NULL;
 
@@ -404,18 +403,6 @@ int init_instruments(const PFS_global_pa
       &thread_session_connect_attrs_array[index * session_connect_attrs_size_per_thread];
   }
 
-  if (wait_class_max > 0)
-  {
-    global_instr_class_waits_array=
-      PFS_MALLOC_ARRAY(wait_class_max,
-                       PFS_single_stat, MYF(MY_ZEROFILL));
-    if (unlikely(global_instr_class_waits_array == NULL))
-      return 1;
-
-    for (index= 0; index < wait_class_max; index++)
-      global_instr_class_waits_array[index].reset();
-  }
-
   if (stage_class_max > 0)
   {
     global_instr_class_stages_array=
@@ -480,8 +467,6 @@ void cleanup_instruments(void)
   thread_statements_stack_array= NULL;
   pfs_free(thread_instr_class_waits_array);
   thread_instr_class_waits_array= NULL;
-  pfs_free(global_instr_class_waits_array);
-  global_instr_class_waits_array= NULL;
   pfs_free(global_instr_class_stages_array);
   global_instr_class_stages_array= NULL;
   pfs_free(global_instr_class_statements_array);
@@ -648,8 +633,7 @@ PFS_mutex* create_mutex(PFS_mutex_class
         pfs->m_class= klass;
         pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
         pfs->m_timed= klass->m_timed;
-        pfs->m_wait_stat.reset();
-        pfs->m_lock_stat.reset();
+        pfs->m_mutex_stat.reset();
         pfs->m_owner= NULL;
         pfs->m_last_locked= 0;
         pfs->m_lock.dirty_to_allocated();
@@ -672,10 +656,9 @@ void destroy_mutex(PFS_mutex *pfs)
 {
   DBUG_ASSERT(pfs != NULL);
   PFS_mutex_class *klass= pfs->m_class;
-  /* Aggregate to EVENTS_WAITS_SUMMARY_BY_EVENT_NAME */
-  uint index= klass->m_event_name_index;
-  global_instr_class_waits_array[index].aggregate(& pfs->m_wait_stat);
-  pfs->m_wait_stat.reset();
+  /* Aggregate to EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME */
+  klass->m_mutex_stat.aggregate(& pfs->m_mutex_stat);
+  pfs->m_mutex_stat.reset();
   if (klass->is_singleton())
     klass->m_singleton= NULL;
   pfs->m_lock.allocated_to_free();
@@ -708,10 +691,8 @@ PFS_rwlock* create_rwlock(PFS_rwlock_cla
         pfs->m_class= klass;
         pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
         pfs->m_timed= klass->m_timed;
-        pfs->m_wait_stat.reset();
+        pfs->m_rwlock_stat.reset();
         pfs->m_lock.dirty_to_allocated();
-        pfs->m_read_lock_stat.reset();
-        pfs->m_write_lock_stat.reset();
         pfs->m_writer= NULL;
         pfs->m_readers= 0;
         pfs->m_last_written= 0;
@@ -735,10 +716,9 @@ void destroy_rwlock(PFS_rwlock *pfs)
 {
   DBUG_ASSERT(pfs != NULL);
   PFS_rwlock_class *klass= pfs->m_class;
-  /* Aggregate to EVENTS_WAITS_SUMMARY_BY_EVENT_NAME */
-  uint index= klass->m_event_name_index;
-  global_instr_class_waits_array[index].aggregate(& pfs->m_wait_stat);
-  pfs->m_wait_stat.reset();
+  /* Aggregate to EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME */
+  klass->m_rwlock_stat.aggregate(& pfs->m_rwlock_stat);
+  pfs->m_rwlock_stat.reset();
   if (klass->is_singleton())
     klass->m_singleton= NULL;
   pfs->m_lock.allocated_to_free();
@@ -794,9 +774,8 @@ void destroy_cond(PFS_cond *pfs)
 {
   DBUG_ASSERT(pfs != NULL);
   PFS_cond_class *klass= pfs->m_class;
-  /* Aggregate to EVENTS_WAITS_SUMMARY_BY_EVENT_NAME */
-  uint index= klass->m_event_name_index;
-  global_instr_class_waits_array[index].aggregate(& pfs->m_wait_stat);
+  /* Aggregate to EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME */
+  klass->m_cond_stat.aggregate(& pfs->m_cond_stat);
   pfs->m_wait_stat.reset();
   if (klass->is_singleton())
     klass->m_singleton= NULL;
@@ -1213,7 +1192,6 @@ search:
         strncpy(pfs->m_filename, normalized_filename, normalized_length);
         pfs->m_filename[normalized_length]= '\0';
         pfs->m_filename_length= normalized_length;
-        pfs->m_wait_stat.reset();
         pfs->m_file_stat.m_open_count= 1;
         pfs->m_file_stat.m_io_stat.reset();
         pfs->m_identity= (const void *)pfs;
@@ -1275,14 +1253,9 @@ void destroy_file(PFS_thread *thread, PF
   DBUG_ASSERT(pfs != NULL);
   PFS_file_class *klass= pfs->m_class;
 
-  /* Aggregate to EVENTS_WAITS_SUMMARY_BY_EVENT_NAME */
-  uint index= klass->m_event_name_index;
-  global_instr_class_waits_array[index].aggregate(& pfs->m_wait_stat);
-  pfs->m_wait_stat.reset();
-
   /* Aggregate to FILE_SUMMARY_BY_EVENT_NAME */
-  klass->m_file_stat.m_io_stat.aggregate(& pfs->m_file_stat.m_io_stat);
-  pfs->m_file_stat.m_io_stat.reset();
+  klass->m_file_stat.aggregate(& pfs->m_file_stat);
+  pfs->m_file_stat.reset();
 
   if (klass->is_singleton())
     klass->m_singleton= NULL;
@@ -1537,7 +1510,7 @@ static void reset_mutex_waits_by_instanc
   PFS_mutex *pfs_last= mutex_array + mutex_max;
 
   for ( ; pfs < pfs_last; pfs++)
-    pfs->m_wait_stat.reset();
+    pfs->m_mutex_stat.reset();
 }
 
 static void reset_rwlock_waits_by_instance(void)
@@ -1546,7 +1519,7 @@ static void reset_rwlock_waits_by_instan
   PFS_rwlock *pfs_last= rwlock_array + rwlock_max;
 
   for ( ; pfs < pfs_last; pfs++)
-    pfs->m_wait_stat.reset();
+    pfs->m_rwlock_stat.reset();
 }
 
 static void reset_cond_waits_by_instance(void)
@@ -1555,7 +1528,7 @@ static void reset_cond_waits_by_instance
   PFS_cond *pfs_last= cond_array + cond_max;
 
   for ( ; pfs < pfs_last; pfs++)
-    pfs->m_wait_stat.reset();
+    pfs->m_cond_stat.reset();
 }
 
 static void reset_file_waits_by_instance(void)
@@ -1606,15 +1579,6 @@ void reset_socket_instance_io(void)
     pfs->m_socket_stat.m_io_stat.reset();
 }
 
-void reset_global_wait_stat()
-{
-  PFS_single_stat *stat= global_instr_class_waits_array;
-  PFS_single_stat *stat_last= global_instr_class_waits_array + wait_class_max;
-
-  for ( ; stat < stat_last; stat++)
-    stat->reset();
-}
-
 void aggregate_all_event_names(PFS_single_stat *from_array,
                                PFS_single_stat *to_array)
 {

=== modified file 'storage/perfschema/pfs_instr.h'
--- a/storage/perfschema/pfs_instr.h	2012-05-31 15:15:33 +0000
+++ b/storage/perfschema/pfs_instr.h	2012-06-11 14:36:24 +0000
@@ -65,8 +65,6 @@ struct PFS_instr
   bool m_enabled;
   /** Timed flag. */
   bool m_timed;
-  /** Instrument wait statistics. */
-  PFS_single_stat m_wait_stat;
 };
 
 /** Instrumented mutex implementation. @see PSI_mutex. */
@@ -76,13 +74,8 @@ struct PFS_ALIGNED PFS_mutex : public PF
   const void *m_identity;
   /** Mutex class. */
   PFS_mutex_class *m_class;
-  /** Instrument wait statistics. */
-  PFS_single_stat m_wait_stat;
-  /**
-    Mutex lock usage statistics.
-    This statistic is not exposed in user visible tables yet.
-  */
-  PFS_single_stat m_lock_stat;
+  /** Instrument statistics. */
+  PFS_mutex_stat m_mutex_stat;
   /** Current owner. */
   PFS_thread *m_owner;
   /**
@@ -99,18 +92,8 @@ struct PFS_ALIGNED PFS_rwlock : public P
   const void *m_identity;
   /** RWLock class. */
   PFS_rwlock_class *m_class;
-  /** Instrument wait statistics. */
-  PFS_single_stat m_wait_stat;
-  /**
-    RWLock read lock usage statistics.
-    This statistic is not exposed in user visible tables yet.
-  */
-  PFS_single_stat m_read_lock_stat;
-  /**
-    RWLock write lock usage statistics.
-    This statistic is not exposed in user visible tables yet.
-  */
-  PFS_single_stat m_write_lock_stat;
+  /** Instrument statistics. */
+  PFS_rwlock_stat m_rwlock_stat;
   /** Current writer thread. */
   PFS_thread *m_writer;
   /** Current count of readers. */
@@ -154,8 +137,6 @@ struct PFS_ALIGNED PFS_file : public PFS
   uint m_filename_length;
   /** File class. */
   PFS_file_class *m_class;
-  /** Instrument wait statistics. */
-  PFS_single_stat m_wait_stat;
   /** File usage statistics. */
   PFS_file_stat m_file_stat;
 };
@@ -522,7 +503,6 @@ struct PFS_ALIGNED PFS_thread : PFS_conn
   const CHARSET_INFO *m_session_connect_attrs_cs;
 };
 
-extern PFS_single_stat *global_instr_class_waits_array;
 extern PFS_stage_stat *global_instr_class_stages_array;
 extern PFS_statement_stat *global_instr_class_statements_array;
 

=== modified file 'storage/perfschema/pfs_instr_class.cc'
--- a/storage/perfschema/pfs_instr_class.cc	2012-05-15 09:39:47 +0000
+++ b/storage/perfschema/pfs_instr_class.cc	2012-06-11 14:36:24 +0000
@@ -135,6 +135,7 @@ static PFS_thread_class *thread_class_ar
 */
 PFS_table_share *table_share_array= NULL;
 
+PFS_ALIGNED PFS_single_stat global_idle_stat;
 PFS_ALIGNED PFS_table_io_stat global_table_io_stat;
 PFS_ALIGNED PFS_table_lock_stat global_table_lock_stat;
 PFS_ALIGNED PFS_instr_class global_table_io_class;
@@ -716,7 +717,7 @@ PFS_sync_key register_mutex_class(const
     */
     entry= &mutex_class_array[index];
     init_instr_class(entry, name, name_length, flags, PFS_CLASS_MUTEX);
-    entry->m_lock_stat.reset();
+    entry->m_mutex_stat.reset();
     entry->m_event_name_index= mutex_class_start + index;
     entry->m_singleton= NULL;
     entry->m_enabled= false; /* disabled by default */
@@ -782,8 +783,7 @@ PFS_sync_key register_rwlock_class(const
   {
     entry= &rwlock_class_array[index];
     init_instr_class(entry, name, name_length, flags, PFS_CLASS_RWLOCK);
-    entry->m_read_lock_stat.reset();
-    entry->m_write_lock_stat.reset();
+    entry->m_rwlock_stat.reset();
     entry->m_event_name_index= rwlock_class_start + index;
     entry->m_singleton= NULL;
     entry->m_enabled= false; /* disabled by default */
@@ -1429,6 +1429,16 @@ PFS_table_share *sanitize_table_share(PF
   SANITIZE_ARRAY_BODY(PFS_table_share, table_share_array, table_share_max, unsafe);
 }
 
+/** Reset the wait statistics per instrument class. */
+void reset_events_waits_by_class()
+{
+  reset_file_class_io();
+  reset_socket_class_io();
+  global_idle_stat.reset();
+  global_table_io_stat.reset();
+  global_table_lock_stat.reset();
+}
+
 /** Reset the io statistics per file class. */
 void reset_file_class_io(void)
 {

=== modified file 'storage/perfschema/pfs_instr_class.h'
--- a/storage/perfschema/pfs_instr_class.h	2012-05-15 09:39:47 +0000
+++ b/storage/perfschema/pfs_instr_class.h	2012-06-11 14:36:24 +0000
@@ -170,11 +170,8 @@ struct PFS_mutex;
 /** Instrumentation metadata for a MUTEX. */
 struct PFS_ALIGNED PFS_mutex_class : public PFS_instr_class
 {
-  /**
-    Lock statistics.
-    This statistic is not exposed in user visible tables yet.
-  */
-  PFS_single_stat m_lock_stat;
+  /** Mutex usage statistics. */
+  PFS_mutex_stat m_mutex_stat;
   /** Singleton instance. */
   PFS_mutex *m_singleton;
 };
@@ -184,16 +181,8 @@ struct PFS_rwlock;
 /** Instrumentation metadata for a RWLOCK. */
 struct PFS_ALIGNED PFS_rwlock_class : public PFS_instr_class
 {
-  /**
-    Read lock statistics.
-    This statistic is not exposed in user visible tables yet.
-  */
-  PFS_single_stat m_read_lock_stat;
-  /**
-    Write lock statistics.
-    This statistic is not exposed in user visible tables yet.
-  */
-  PFS_single_stat m_write_lock_stat;
+  /** Rwlock usage statistics. */
+  PFS_rwlock_stat m_rwlock_stat;
   /** Singleton instance. */
   PFS_rwlock *m_singleton;
 };
@@ -325,6 +314,8 @@ private:
   int m_refcount;
 };
 
+/** Statistics for the IDLE instrument. */
+extern PFS_single_stat global_idle_stat;
 /** Statistics for dropped table io. */
 extern PFS_table_io_stat global_table_io_stat;
 /** Statistics for dropped table lock. */
@@ -499,6 +490,7 @@ extern PFS_cond_class *cond_class_array;
 extern PFS_file_class *file_class_array;
 extern PFS_table_share *table_share_array;
 
+void reset_events_waits_by_class();
 void reset_file_class_io();
 void reset_socket_class_io();
 

=== modified file 'storage/perfschema/pfs_server.cc'
--- a/storage/perfschema/pfs_server.cc	2012-05-25 07:53:01 +0000
+++ b/storage/perfschema/pfs_server.cc	2012-06-11 14:36:24 +0000
@@ -55,6 +55,7 @@ initialize_performance_schema(PFS_global
   pfs_initialized= false;
 
   PFS_table_stat::g_reset_template.reset();
+  global_idle_stat.reset();
   global_table_io_stat.reset();
   global_table_lock_stat.reset();
 

=== modified file 'storage/perfschema/pfs_stat.h'
--- a/storage/perfschema/pfs_stat.h	2012-03-19 19:29:28 +0000
+++ b/storage/perfschema/pfs_stat.h	2012-06-11 14:36:24 +0000
@@ -140,13 +140,90 @@ struct PFS_byte_stat : public PFS_single
   }
 };
 
+/** Statistics for mutex usage. */
+struct PFS_mutex_stat
+{
+  /** Wait statistics. */
+  PFS_single_stat m_wait_stat;
+  /**
+    Lock statistics.
+    This statistic is not exposed in user visible tables yet.
+  */
+  PFS_single_stat m_lock_stat;
+
+  inline void aggregate(const PFS_mutex_stat *stat)
+  {
+    m_wait_stat.aggregate(&stat->m_wait_stat);
+    m_lock_stat.aggregate(&stat->m_lock_stat);
+  }
+
+  inline void reset(void)
+  {
+    m_wait_stat.reset();
+    m_lock_stat.reset();
+  }
+};
+
+/** Statistics for rwlock usage. */
+struct PFS_rwlock_stat
+{
+  /** Wait statistics. */
+  PFS_single_stat m_wait_stat;
+  /**
+    RWLock read lock usage statistics.
+    This statistic is not exposed in user visible tables yet.
+  */
+  PFS_single_stat m_read_lock_stat;
+  /**
+    RWLock write lock usage statistics.
+    This statistic is not exposed in user visible tables yet.
+  */
+  PFS_single_stat m_write_lock_stat;
+
+  inline void aggregate(const PFS_rwlock_stat *stat)
+  {
+    m_wait_stat.aggregate(&stat->m_wait_stat);
+    m_read_lock_stat.aggregate(&stat->m_read_lock_stat);
+    m_write_lock_stat.aggregate(&stat->m_write_lock_stat);
+  }
+
+  inline void reset(void)
+  {
+    m_wait_stat.reset();
+    m_read_lock_stat.reset();
+    m_write_lock_stat.reset();
+  }
+};
+
 /** Statistics for COND usage. */
 struct PFS_cond_stat
 {
-  /** Number of times a condition was signalled. */
+  /** Wait statistics. */
+  PFS_single_stat m_wait_stat;
+  /**
+    Number of times a condition was signalled.
+    This statistic is not exposed in user visible tables yet.
+  */
   ulonglong m_signal_count;
-  /** Number of times a condition was broadcasted. */
+  /**
+    Number of times a condition was broadcast.
+    This statistic is not exposed in user visible tables yet.
+  */
   ulonglong m_broadcast_count;
+
+  inline void aggregate(const PFS_cond_stat *stat)
+  {
+    m_wait_stat.aggregate(&stat->m_wait_stat);
+    m_signal_count+= stat->m_signal_count;
+    m_broadcast_count+= stat->m_broadcast_count;
+  }
+
+  inline void reset(void)
+  {
+    m_wait_stat.reset();
+    m_signal_count= 0;
+    m_broadcast_count= 0;
+  }
 };
 
 /** Statistics for FILE IO. Used for both waits and byte counts. */
@@ -198,6 +275,11 @@ struct PFS_file_stat
   /** File IO statistics. */
   PFS_file_io_stat m_io_stat;
 
+  inline void aggregate(const PFS_file_stat *stat)
+  {
+    m_io_stat.aggregate(&stat->m_io_stat);
+  }
+
   /** Reset file statistics. */
   inline void reset(void)
   {

=== modified file 'storage/perfschema/pfs_visitor.cc'
--- a/storage/perfschema/pfs_visitor.cc	2012-05-15 09:39:47 +0000
+++ b/storage/perfschema/pfs_visitor.cc	2012-06-11 14:36:24 +0000
@@ -666,7 +666,7 @@ void PFS_connection_wait_visitor::visit_
     it is more efficient.
   */
   DBUG_ASSERT(m_index == global_idle_class.m_event_name_index);
-  m_stat.aggregate(& global_instr_class_waits_array[m_index]);
+  m_stat.aggregate(& global_idle_stat);
 }
 
 void PFS_connection_wait_visitor::visit_host(PFS_host *pfs)
@@ -883,54 +883,44 @@ PFS_instance_wait_visitor::PFS_instance_
 PFS_instance_wait_visitor::~PFS_instance_wait_visitor()
 {}
 
-void PFS_instance_wait_visitor::visit_mutex_class(PFS_mutex_class *pfs) 
+void PFS_instance_wait_visitor::visit_mutex_class(PFS_mutex_class *pfs)
 {
-  uint index= pfs->m_event_name_index;
-  m_stat.aggregate(& global_instr_class_waits_array[index]);
+  m_stat.aggregate(&pfs->m_mutex_stat.m_wait_stat);
 }
 
-void PFS_instance_wait_visitor::visit_rwlock_class(PFS_rwlock_class *pfs) 
+void PFS_instance_wait_visitor::visit_rwlock_class(PFS_rwlock_class *pfs)
 {
-  uint index= pfs->m_event_name_index;
-  m_stat.aggregate(& global_instr_class_waits_array[index]);
+  m_stat.aggregate(&pfs->m_rwlock_stat.m_wait_stat);
 }
 
-void PFS_instance_wait_visitor::visit_cond_class(PFS_cond_class *pfs) 
+void PFS_instance_wait_visitor::visit_cond_class(PFS_cond_class *pfs)
 {
-  uint index= pfs->m_event_name_index;
-  m_stat.aggregate(& global_instr_class_waits_array[index]);
+  m_stat.aggregate(&pfs->m_cond_stat.m_wait_stat);
 }
 
-void PFS_instance_wait_visitor::visit_file_class(PFS_file_class *pfs) 
+void PFS_instance_wait_visitor::visit_file_class(PFS_file_class *pfs)
 {
-  uint index= pfs->m_event_name_index;
-  m_stat.aggregate(& global_instr_class_waits_array[index]);
+  pfs->m_file_stat.m_io_stat.sum_waits(&m_stat);
 }
 
-void PFS_instance_wait_visitor::visit_socket_class(PFS_socket_class *pfs) 
+void PFS_instance_wait_visitor::visit_socket_class(PFS_socket_class *pfs)
 {
-  /* Collect global wait stats */
-  uint index= pfs->m_event_name_index;
-  m_stat.aggregate(&global_instr_class_waits_array[index]);
-
-  /* If deferred, then pull wait stats directly from the socket class. */
-  if (pfs->is_deferred())
-    pfs->m_socket_stat.m_io_stat.sum_waits(&m_stat);
+  pfs->m_socket_stat.m_io_stat.sum_waits(&m_stat);
 }
 
-void PFS_instance_wait_visitor::visit_mutex(PFS_mutex *pfs) 
+void PFS_instance_wait_visitor::visit_mutex(PFS_mutex *pfs)
 {
-  m_stat.aggregate(& pfs->m_wait_stat);
+  m_stat.aggregate(& pfs->m_mutex_stat.m_wait_stat);
 }
 
-void PFS_instance_wait_visitor::visit_rwlock(PFS_rwlock *pfs) 
+void PFS_instance_wait_visitor::visit_rwlock(PFS_rwlock *pfs)
 {
-  m_stat.aggregate(& pfs->m_wait_stat);
+  m_stat.aggregate(& pfs->m_rwlock_stat.m_wait_stat);
 }
 
-void PFS_instance_wait_visitor::visit_cond(PFS_cond *pfs) 
+void PFS_instance_wait_visitor::visit_cond(PFS_cond *pfs)
 {
-  m_stat.aggregate(& pfs->m_wait_stat);
+  m_stat.aggregate(& pfs->m_cond_stat.m_wait_stat);
 }
 
 void PFS_instance_wait_visitor::visit_file(PFS_file *pfs) 

=== modified file 'storage/perfschema/table_events_waits_summary.cc'
--- a/storage/perfschema/table_events_waits_summary.cc	2012-01-24 23:42:36 +0000
+++ b/storage/perfschema/table_events_waits_summary.cc	2012-06-11 14:36:24 +0000
@@ -139,7 +139,7 @@ void table_events_waits_summary_by_insta
   if (unlikely(safe_class == NULL))
     return;
 
-  make_instr_row(pfs, safe_class, pfs->m_identity, &pfs->m_wait_stat);
+  make_instr_row(pfs, safe_class, pfs->m_identity, &pfs->m_mutex_stat.m_wait_stat);
 }
 
 /**
@@ -153,7 +153,7 @@ void table_events_waits_summary_by_insta
   if (unlikely(safe_class == NULL))
     return;
 
-  make_instr_row(pfs, safe_class, pfs->m_identity, &pfs->m_wait_stat);
+  make_instr_row(pfs, safe_class, pfs->m_identity, &pfs->m_rwlock_stat.m_wait_stat);
 }
 
 /**
@@ -167,7 +167,7 @@ void table_events_waits_summary_by_insta
   if (unlikely(safe_class == NULL))
     return;
 
-  make_instr_row(pfs, safe_class, pfs->m_identity, &pfs->m_wait_stat);
+  make_instr_row(pfs, safe_class, pfs->m_identity, &pfs->m_cond_stat.m_wait_stat);
 }
 
 /**
@@ -181,11 +181,13 @@ void table_events_waits_summary_by_insta
   if (unlikely(safe_class == NULL))
     return;
 
+  PFS_single_stat sum;
+  pfs->m_file_stat.m_io_stat.sum_waits(& sum);
   /*
     Files don't have a in memory structure associated to it,
     so we use the address of the PFS_file buffer as object_instance_begin
   */
-  make_instr_row(pfs, safe_class, pfs, &pfs->m_wait_stat);
+  make_instr_row(pfs, safe_class, pfs, & sum);
 }
 
 /**

=== modified file 'storage/perfschema/table_ews_global_by_event_name.cc'
--- a/storage/perfschema/table_ews_global_by_event_name.cc	2012-02-16 09:51:14 +0000
+++ b/storage/perfschema/table_ews_global_by_event_name.cc	2012-06-11 14:36:24 +0000
@@ -97,7 +97,7 @@ table_ews_global_by_event_name::delete_a
   reset_events_waits_by_instance();
   reset_table_waits_by_table_handle();
   reset_table_waits_by_table();
-  reset_events_waits_global();
+  reset_events_waits_by_class();
   return 0;
 }
 
@@ -121,9 +121,6 @@ int table_ews_global_by_event_name::rnd_
   PFS_socket_class *socket_class;
   PFS_instr_class *instr_class;
 
-  if (global_instr_class_waits_array == NULL)
-    return HA_ERR_END_OF_FILE;
-
   for (m_pos.set_at(&m_next_pos);
        m_pos.has_more_view();
        m_pos.next_view())
@@ -218,9 +215,6 @@ table_ews_global_by_event_name::rnd_pos(
 
   set_position(pos);
 
-  if (global_instr_class_waits_array == NULL)
-    return HA_ERR_END_OF_FILE;
-
   switch (m_pos.m_index_1)
   {
   case pos_ews_global_by_event_name::VIEW_MUTEX:

=== modified file 'storage/perfschema/unittest/pfs_instr_class-t.cc'
--- a/storage/perfschema/unittest/pfs_instr_class-t.cc	2011-07-08 21:31:33 +0000
+++ b/storage/perfschema/unittest/pfs_instr_class-t.cc	2012-06-11 14:36:24 +0000
@@ -475,6 +475,7 @@ void test_table_registration()
 #endif
 }
 
+#ifdef LATER
 void set_wait_stat(PFS_instr_class *klass)
 {
   PFS_single_stat *stat;
@@ -501,6 +502,7 @@ bool is_empty_stat(PFS_instr_class *klas
     return false;
   return true;
 }
+#endif
 
 void test_instruments_reset()
 {

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (marc.alff:3990) Marc Alff12 Jun