2749 Marc Alff 2008-12-05
Implemented SOURCE (file:line), cleaned up statistics
modified:
mysql-test/suite/perfschema/r/schema.result
mysql-test/suite/perfschema/r/start_server_off.result
mysql-test/suite/perfschema/r/start_server_on.result
storage/perfschema/pse.cc
storage/perfschema/pse_events_waits.h
storage/perfschema/pse_stat.h
storage/perfschema/pse_sync.cc
storage/perfschema/pse_sync.h
storage/perfschema/pse_sync_info.cc
storage/perfschema/pse_sync_info.h
storage/perfschema/pse_table.cc
storage/perfschema/table_events_waits.cc
storage/perfschema/table_events_waits.h
2748 Marc Alff 2008-12-04
Implementation of wait summaries
removed:
storage/perfschema/table_sync_waits_summary.cc
storage/perfschema/table_sync_waits_summary.h
added:
storage/perfschema/pse_stat.h
storage/perfschema/table_all_sync.cc
storage/perfschema/table_all_sync.h
storage/perfschema/table_events_waits_summary.cc
storage/perfschema/table_events_waits_summary.h
modified:
Doxyfile-wl2360
mysql-test/suite/perfschema/r/dml_setup_consumers.result
mysql-test/suite/perfschema/r/dml_setup_instruments.result
mysql-test/suite/perfschema/r/information_schema.result
mysql-test/suite/perfschema/r/schema.result
mysql-test/suite/perfschema/r/start_server_off.result
mysql-test/suite/perfschema/r/start_server_on.result
mysql-test/suite/perfschema/t/schema.test
sql/field.h
sql/spatial.h
storage/perfschema/Makefile.am
storage/perfschema/plug.in
storage/perfschema/pse.cc
storage/perfschema/pse_bootstrap.cc
storage/perfschema/pse_events_waits.cc
storage/perfschema/pse_events_waits.h
storage/perfschema/pse_server.cc
storage/perfschema/pse_sync.cc
storage/perfschema/pse_sync.h
storage/perfschema/pse_sync_info.cc
storage/perfschema/pse_sync_info.h
storage/perfschema/pse_table.cc
storage/perfschema/table_setup_consumers.cc
storage/perfschema/table_setup_instruments.cc
storage/perfschema/table_setup_instruments.h
storage/perfschema/table_sync_instances.cc
storage/perfschema/table_sync_instances.h
=== modified file 'mysql-test/suite/perfschema/r/schema.result'
--- a/mysql-test/suite/perfschema/r/schema.result 2008-12-04 16:56:02 +0000
+++ b/mysql-test/suite/perfschema/r/schema.result 2008-12-05 20:19:48 +0000
@@ -74,30 +74,14 @@ show create table performance_schema.con
Table Create Table
cond_instances CREATE TABLE `cond_instances` (
`NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
- `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
- `WAIT_COUNT` int(11) NOT NULL,
- `SIGNAL_COUNT` int(11) NOT NULL,
- `BROADCAST_COUNT` int(11) NOT NULL,
- `SUM_WAIT` bigint(20) NOT NULL,
- `MIN_WAIT` bigint(20) NOT NULL,
- `AVG_WAIT` bigint(20) NOT NULL,
- `MAX_WAIT` bigint(20) NOT NULL
+ `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
show create table performance_schema.mutex_instances;
Table Create Table
mutex_instances CREATE TABLE `mutex_instances` (
`NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
- `LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL,
- `LOCK_COUNT` int(11) NOT NULL,
- `SUM_WAIT` bigint(20) NOT NULL,
- `MIN_WAIT` bigint(20) NOT NULL,
- `AVG_WAIT` bigint(20) NOT NULL,
- `MAX_WAIT` bigint(20) NOT NULL,
- `SUM_LOCKED` bigint(20) NOT NULL,
- `MIN_LOCKED` bigint(20) NOT NULL,
- `AVG_LOCKED` bigint(20) NOT NULL,
- `MAX_LOCKED` bigint(20) NOT NULL
+ `LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
show create table performance_schema.rwlock_instances;
Table Create Table
@@ -105,36 +89,7 @@ rwlock_instances CREATE TABLE `rwlock_in
`NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
`WRITE_LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL,
- `READ_LOCKED_BY_COUNT` int(11) NOT NULL,
- `READ_WAIT_COUNT` int(11) NOT NULL,
- `READ_STATE_COUNT` int(11) NOT NULL,
- `WRITE_LOCK_COUNT` int(11) NOT NULL,
- `WAIT_COUNT` int(11) NOT NULL,
- `STATE_COUNT` int(11) NOT NULL,
- `SUM_READ_WAIT` bigint(20) NOT NULL,
- `SUM_WRITE_WAIT` bigint(20) NOT NULL,
- `SUM_WAIT` bigint(20) NOT NULL,
- `MIN_READ_WAIT` bigint(20) NOT NULL,
- `MIN_WRITE_WAIT` bigint(20) NOT NULL,
- `MIN_WAIT` bigint(20) NOT NULL,
- `AVG_READ_WAIT` bigint(20) NOT NULL,
- `AVG_WRITE_WAIT` bigint(20) NOT NULL,
- `AVG_WAIT` bigint(20) NOT NULL,
- `MAX_READ_WAIT` bigint(20) NOT NULL,
- `MAX_WRITE_WAIT` bigint(20) NOT NULL,
- `MAX_WAIT` bigint(20) NOT NULL,
- `SUM_READ_LOCKED` bigint(20) NOT NULL,
- `SUM_WRITE_LOCKED` bigint(20) NOT NULL,
- `SUM_LOCKED` bigint(20) NOT NULL,
- `MIN_READ_LOCKED` bigint(20) NOT NULL,
- `MIN_WRITE_LOCKED` bigint(20) NOT NULL,
- `MIN_LOCKED` bigint(20) NOT NULL,
- `AVG_READ_LOCKED` bigint(20) NOT NULL,
- `AVG_WRITE_LOCKED` bigint(20) NOT NULL,
- `AVG_LOCKED` bigint(20) NOT NULL,
- `MAX_READ_LOCKED` bigint(20) NOT NULL,
- `MAX_WRITE_LOCKED` bigint(20) NOT NULL,
- `MAX_LOCKED` bigint(20) NOT NULL
+ `READ_LOCKED_BY_COUNT` int(11) NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
show create table performance_schema.events_waits_summary_by_instance;
Table Create Table
=== modified file 'mysql-test/suite/perfschema/r/start_server_off.result'
--- a/mysql-test/suite/perfschema/r/start_server_off.result 2008-12-04 16:56:02 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_off.result 2008-12-05 20:19:48 +0000
@@ -9,14 +9,14 @@ if (version() like "%perfschema%", "Comp
Compiled In
show engine performance_schema status;
Type Name Status
-performance_schema EVENTS_WAITS_CURRENT.ROW_SIZE 80
+performance_schema EVENTS_WAITS_CURRENT.ROW_SIZE 96
performance_schema EVENTS_WAITS_CURRENT.ROW_COUNT 0
-performance_schema EVENTS_WAITS_HISTORY.ROW_SIZE 64
+performance_schema EVENTS_WAITS_HISTORY.ROW_SIZE 80
performance_schema EVENTS_WAITS_HISTORY.ROW_COUNT 0
performance_schema EVENTS_WAITS_HISTORY.MEMORY 0
-performance_schema EVENTS_WAITS_HISTORY_LONG.ROW_SIZE 64
+performance_schema EVENTS_WAITS_HISTORY_LONG.ROW_SIZE 80
performance_schema EVENTS_WAITS_HISTORY_LONG.ROW_COUNT 10000
-performance_schema EVENTS_WAITS_HISTORY_LONG.MEMORY 640000
+performance_schema EVENTS_WAITS_HISTORY_LONG.MEMORY 800000
performance_schema (PSE_MUTEX_INFO).ROW_SIZE 248
performance_schema (PSE_MUTEX_INFO).ROW_COUNT 0
performance_schema (PSE_MUTEX_INFO).ROW_LOST 0
@@ -25,7 +25,7 @@ performance_schema (PSE_RWLOCK_INFO).ROW
performance_schema (PSE_RWLOCK_INFO).ROW_COUNT 0
performance_schema (PSE_RWLOCK_INFO).ROW_LOST 0
performance_schema (PSE_RWLOCK_INFO).MEMORY 0
-performance_schema (PSE_COND_INFO).ROW_SIZE 208
+performance_schema (PSE_COND_INFO).ROW_SIZE 216
performance_schema (PSE_COND_INFO).ROW_COUNT 0
performance_schema (PSE_COND_INFO).ROW_LOST 0
performance_schema (PSE_COND_INFO).MEMORY 0
@@ -41,11 +41,14 @@ performance_schema (PSE_COND).ROW_SIZE 8
performance_schema (PSE_COND).ROW_COUNT 0
performance_schema (PSE_COND).ROW_LOST 0
performance_schema (PSE_COND).MEMORY 0
-performance_schema (PSE_THREAD).ROW_SIZE 304
+performance_schema (PSE_THREAD).ROW_SIZE 360
performance_schema (PSE_THREAD).ROW_COUNT 0
performance_schema (PSE_THREAD).ROW_LOST 0
performance_schema (PSE_THREAD).MEMORY 0
-performance_schema PERFORMANCE_SCHEMA.MEMORY 640000
+performance_schema EVENTS_WAITS_SUMMARY_BY_THREAD_BY_NAME.ROW_SIZE 32
+performance_schema EVENTS_WAITS_SUMMARY_BY_THREAD_BY_NAME.ROW_COUNT 0
+performance_schema EVENTS_WAITS_SUMMARY_BY_THREAD_BY_NAME.MEMORY 0
+performance_schema PERFORMANCE_SCHEMA.MEMORY 800000
select count(*) from performance_schema.performance_timers;
count(*)
5
=== modified file 'mysql-test/suite/perfschema/r/start_server_on.result'
--- a/mysql-test/suite/perfschema/r/start_server_on.result 2008-12-04 16:56:02 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_on.result 2008-12-05 20:19:48 +0000
@@ -9,14 +9,14 @@ if (version() like "%perfschema%", "Comp
Compiled In
show engine performance_schema status;
Type Name Status
-performance_schema EVENTS_WAITS_CURRENT.ROW_SIZE 80
+performance_schema EVENTS_WAITS_CURRENT.ROW_SIZE 96
performance_schema EVENTS_WAITS_CURRENT.ROW_COUNT 3000
-performance_schema EVENTS_WAITS_HISTORY.ROW_SIZE 64
+performance_schema EVENTS_WAITS_HISTORY.ROW_SIZE 80
performance_schema EVENTS_WAITS_HISTORY.ROW_COUNT 10000
-performance_schema EVENTS_WAITS_HISTORY.MEMORY 640000
-performance_schema EVENTS_WAITS_HISTORY_LONG.ROW_SIZE 64
+performance_schema EVENTS_WAITS_HISTORY.MEMORY 800000
+performance_schema EVENTS_WAITS_HISTORY_LONG.ROW_SIZE 80
performance_schema EVENTS_WAITS_HISTORY_LONG.ROW_COUNT 10000
-performance_schema EVENTS_WAITS_HISTORY_LONG.MEMORY 640000
+performance_schema EVENTS_WAITS_HISTORY_LONG.MEMORY 800000
performance_schema (PSE_MUTEX_INFO).ROW_SIZE 248
performance_schema (PSE_MUTEX_INFO).ROW_COUNT 200
performance_schema (PSE_MUTEX_INFO).ROW_LOST 0
@@ -25,10 +25,10 @@ performance_schema (PSE_RWLOCK_INFO).ROW
performance_schema (PSE_RWLOCK_INFO).ROW_COUNT 20
performance_schema (PSE_RWLOCK_INFO).ROW_LOST 0
performance_schema (PSE_RWLOCK_INFO).MEMORY 5920
-performance_schema (PSE_COND_INFO).ROW_SIZE 208
+performance_schema (PSE_COND_INFO).ROW_SIZE 216
performance_schema (PSE_COND_INFO).ROW_COUNT 80
performance_schema (PSE_COND_INFO).ROW_LOST 0
-performance_schema (PSE_COND_INFO).MEMORY 16640
+performance_schema (PSE_COND_INFO).MEMORY 17280
performance_schema (PSE_MUTEX).ROW_SIZE 136
performance_schema (PSE_MUTEX).ROW_COUNT 1000
performance_schema (PSE_MUTEX).ROW_LOST 0
@@ -41,11 +41,14 @@ performance_schema (PSE_COND).ROW_SIZE 8
performance_schema (PSE_COND).ROW_COUNT 1000
performance_schema (PSE_COND).ROW_LOST 0
performance_schema (PSE_COND).MEMORY 88000
-performance_schema (PSE_THREAD).ROW_SIZE 304
+performance_schema (PSE_THREAD).ROW_SIZE 360
performance_schema (PSE_THREAD).ROW_COUNT 1000
performance_schema (PSE_THREAD).ROW_LOST 0
-performance_schema (PSE_THREAD).MEMORY 304000
-performance_schema PERFORMANCE_SCHEMA.MEMORY 2088160
+performance_schema (PSE_THREAD).MEMORY 360000
+performance_schema EVENTS_WAITS_SUMMARY_BY_THREAD_BY_NAME.ROW_SIZE 32
+performance_schema EVENTS_WAITS_SUMMARY_BY_THREAD_BY_NAME.ROW_COUNT 3000000
+performance_schema EVENTS_WAITS_SUMMARY_BY_THREAD_BY_NAME.MEMORY 96000000
+performance_schema PERFORMANCE_SCHEMA.MEMORY 98464800
select count(*) from performance_schema.performance_timers;
count(*)
5
=== modified file 'storage/perfschema/pse.cc'
--- a/storage/perfschema/pse.cc 2008-12-04 16:56:02 +0000
+++ b/storage/perfschema/pse.cc 2008-12-05 20:19:48 +0000
@@ -474,7 +474,7 @@ static void unlock_mutex_v1(PSI_thread *
else
locked_time= 0;
- aggregate_single_stat(& pse_mutex->m_lock_stat, locked_time);
+ aggregate_single_stat_chain(& pse_mutex->m_lock_stat, locked_time);
pse_mutex->m_owner= NULL;
pse_mutex->m_last_locked= 0;
}
@@ -502,7 +502,7 @@ static void unlock_rwlock_v1(PSI_thread
if (pse_rwlock->m_info->m_sync.m_timed)
{
locked_time= get_timer_value(wait_timer) - pse_rwlock->m_last_written;
- aggregate_single_stat(& pse_rwlock->m_write_lock_stat, locked_time);
+ aggregate_single_stat_chain(& pse_rwlock->m_write_lock_stat, locked_time);
}
pse_rwlock->m_writer= NULL;
pse_rwlock->m_readers= 0;
@@ -514,7 +514,7 @@ static void unlock_rwlock_v1(PSI_thread
if (pse_rwlock->m_info->m_sync.m_timed)
{
locked_time= get_timer_value(wait_timer) - pse_rwlock->m_last_read;
- aggregate_single_stat(& pse_rwlock->m_read_lock_stat, locked_time);
+ aggregate_single_stat_chain(& pse_rwlock->m_read_lock_stat, locked_time);
}
pse_rwlock->m_writer= NULL;
pse_rwlock->m_readers= 0;
@@ -567,6 +567,8 @@ static void start_wait_v1(PSI_locker* lo
wait->m_timer_start= 0;
wait->m_event_id= get_next_event_id();
}
+ wait->m_file= file;
+ wait->m_line= line;
}
static void end_wait_v1(PSI_locker* locker, int rc)
@@ -591,7 +593,7 @@ static void end_wait_v1(PSI_locker* lock
/* Thread safe: we are protected by the instrumented mutex */
PSE_mutex *mutex= pse_locker->m_target.m_mutex;
uint wait_time= wait->m_timer_end- wait->m_timer_start;
- aggregate_single_stat(& mutex->m_wait_stat, wait_time);
+ aggregate_single_stat_chain(& mutex->m_wait_stat, wait_time);
mutex->m_owner= wait->m_thread;
mutex->m_last_locked= wait->m_timer_end;
@@ -624,6 +626,8 @@ static void start_rdwait_v1(PSI_locker*
wait->m_timer_start= 0;
wait->m_event_id= get_next_event_id();
}
+ wait->m_file= file;
+ wait->m_line= line;
}
static void end_rdwait_v1(PSI_locker* locker, int rc)
@@ -654,7 +658,7 @@ static void end_rdwait_v1(PSI_locker* lo
*/
PSE_rwlock *rwlock= pse_locker->m_target.m_rwlock;
uint wait_time= wait->m_timer_end- wait->m_timer_start;
- aggregate_single_stat(& rwlock->m_wait_stat, wait_time);
+ aggregate_single_stat_chain(& rwlock->m_wait_stat, wait_time);
if (rwlock->m_readers == 0)
{
rwlock->m_read_state_count++;
@@ -692,6 +696,8 @@ static void start_wrwait_v1(PSI_locker*
wait->m_timer_start= 0;
wait->m_event_id= get_next_event_id();
}
+ wait->m_file= file;
+ wait->m_line= line;
}
static void end_wrwait_v1(PSI_locker* locker, int rc)
@@ -716,7 +722,7 @@ static void end_wrwait_v1(PSI_locker* lo
/* Thread safe : we are protected by the instrumented rwlock */
PSE_rwlock *rwlock= pse_locker->m_target.m_rwlock;
uint wait_time= wait->m_timer_end- wait->m_timer_start;
- aggregate_single_stat(& rwlock->m_wait_stat, wait_time);
+ 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;
@@ -752,6 +758,8 @@ static void start_condwait_v1(PSI_locker
wait->m_timer_start= 0;
wait->m_event_id= get_next_event_id();
}
+ wait->m_file= file;
+ wait->m_line= line;
}
static void end_condwait_v1(PSI_locker* locker, int rc)
@@ -776,7 +784,7 @@ static void end_condwait_v1(PSI_locker*
/* Not thread safe, race conditions will occur */
PSE_cond *cond= pse_locker->m_target.m_cond;
uint wait_time= wait->m_timer_end- wait->m_timer_start;
- aggregate_single_stat(& cond->m_wait_stat, wait_time);
+ aggregate_single_stat_chain(& cond->m_wait_stat, wait_time);
if (flag_events_waits_summary_by_thread_by_name)
{
=== modified file 'storage/perfschema/pse_events_waits.h'
--- a/storage/perfschema/pse_events_waits.h 2008-12-04 16:56:02 +0000
+++ b/storage/perfschema/pse_events_waits.h 2008-12-05 20:19:48 +0000
@@ -60,6 +60,8 @@ struct PSE_events_waits
ulonglong m_timer_start;
ulonglong m_timer_end;
void *m_identity;
+ const char* m_file;
+ int m_line;
};
struct PSE_locker
=== modified file 'storage/perfschema/pse_stat.h'
--- a/storage/perfschema/pse_stat.h 2008-12-04 16:56:02 +0000
+++ b/storage/perfschema/pse_stat.h 2008-12-05 20:19:48 +0000
@@ -18,8 +18,6 @@
struct PSE_single_stat
{
- bool *m_control_flag;
- struct PSE_single_stat *m_parent;
ulong m_count;
ulonglong m_sum;
ulonglong m_min;
@@ -36,6 +34,34 @@ inline void reset_single_stat(PSE_single
inline void aggregate_single_stat(PSE_single_stat *stat, ulonglong time)
{
+ stat->m_count++;
+ stat->m_sum+= time;
+ if (stat->m_min > time)
+ stat->m_min= time;
+ if (stat->m_max < time)
+ stat->m_max= time;
+}
+
+struct PSE_single_stat_chain
+{
+ bool *m_control_flag;
+ struct PSE_single_stat_chain *m_parent;
+ ulong m_count;
+ ulonglong m_sum;
+ ulonglong m_min;
+ ulonglong m_max;
+};
+
+inline void reset_single_stat_chain(PSE_single_stat_chain *stat)
+{
+ stat->m_count= 0;
+ stat->m_sum= 0;
+ stat->m_min= (ulonglong) -1;
+ stat->m_max= 0;
+}
+
+inline void aggregate_single_stat_chain(PSE_single_stat_chain *stat, ulonglong time)
+{
while (stat)
{
if (*stat->m_control_flag)
=== modified file 'storage/perfschema/pse_sync.cc'
--- a/storage/perfschema/pse_sync.cc 2008-12-04 16:56:02 +0000
+++ b/storage/perfschema/pse_sync.cc 2008-12-05 20:19:48 +0000
@@ -177,12 +177,12 @@ PSE_mutex* create_mutex(PSE_mutex_info *
pse->m_allocated= true;
pse->m_identity= identity;
pse->m_info= info;
- reset_single_stat(& pse->m_wait_stat);
pse->m_wait_stat.m_control_flag= & flag_events_waits_summary_by_instance;
pse->m_wait_stat.m_parent= & info->m_wait_stat;
- reset_single_stat(& pse->m_lock_stat);
+ reset_single_stat_chain(& pse->m_wait_stat);
pse->m_lock_stat.m_control_flag= & flag_events_locks_summary_by_instance;
pse->m_lock_stat.m_parent= & info->m_lock_stat;
+ reset_single_stat_chain(& pse->m_lock_stat);
pse->m_owner= NULL;
pse->m_last_locked= 0;
return pse;
@@ -221,15 +221,15 @@ PSE_rwlock* create_rwlock(PSE_rwlock_inf
pse->m_allocated= true;
pse->m_identity= identity;
pse->m_info= info;
- reset_single_stat(& pse->m_wait_stat);
pse->m_wait_stat.m_control_flag= & flag_events_waits_summary_by_instance;
pse->m_wait_stat.m_parent= & info->m_wait_stat;
- reset_single_stat(& pse->m_read_lock_stat);
+ reset_single_stat_chain(& pse->m_wait_stat);
pse->m_read_lock_stat.m_control_flag= & flag_events_locks_summary_by_instance;
pse->m_read_lock_stat.m_parent= & info->m_read_lock_stat;
- reset_single_stat(& pse->m_write_lock_stat);
+ reset_single_stat_chain(& pse->m_read_lock_stat);
pse->m_write_lock_stat.m_control_flag= & flag_events_locks_summary_by_instance;
pse->m_write_lock_stat.m_parent= & info->m_write_lock_stat;
+ reset_single_stat_chain(& pse->m_write_lock_stat);
pse->m_writer= NULL;
pse->m_readers= 0;
pse->m_read_state_count= 0;
@@ -326,8 +326,6 @@ PSE_thread* create_thread(PSE_thread_inf
for (i= 0; i < sync_info_per_thread ; i++)
{
reset_single_stat(& pse->m_sync_info_wait_stats[i]);
- pse->m_sync_info_wait_stats[i].m_control_flag= & flag_events_waits_summary_by_thread_by_name;
- pse->m_sync_info_wait_stats[i].m_parent= NULL;
}
return pse;
}
=== modified file 'storage/perfschema/pse_sync.h'
--- a/storage/perfschema/pse_sync.h 2008-12-04 16:56:02 +0000
+++ b/storage/perfschema/pse_sync.h 2008-12-05 20:19:48 +0000
@@ -26,8 +26,8 @@ struct PSE_mutex
bool m_allocated;
void *m_identity;
PSE_mutex_info *m_info;
- PSE_single_stat m_wait_stat;
- PSE_single_stat m_lock_stat;
+ PSE_single_stat_chain m_wait_stat;
+ PSE_single_stat_chain m_lock_stat;
PSE_thread *m_owner;
ulonglong m_last_locked;
};
@@ -37,9 +37,9 @@ struct PSE_rwlock
bool m_allocated;
void *m_identity;
PSE_rwlock_info *m_info;
- PSE_single_stat m_wait_stat;
- PSE_single_stat m_read_lock_stat;
- PSE_single_stat m_write_lock_stat;
+ PSE_single_stat_chain m_wait_stat;
+ PSE_single_stat_chain m_read_lock_stat;
+ PSE_single_stat_chain m_write_lock_stat;
PSE_thread *m_writer;
uint m_readers;
ulong m_read_state_count;
@@ -52,7 +52,7 @@ struct PSE_cond
bool m_allocated;
void *m_identity;
PSE_cond_info *m_info;
- PSE_single_stat m_wait_stat;
+ PSE_single_stat_chain m_wait_stat;
PSE_cond_stat m_cond_stat;
};
@@ -109,6 +109,7 @@ extern uint cond_lost;
extern uint thread_max;
extern uint thread_lost;
extern uint history_per_thread;
+extern uint sync_info_per_thread;
/* Exposing the data directly, for iterators. */
extern PSE_mutex *mutex_array;
=== modified file 'storage/perfschema/pse_sync_info.cc'
--- a/storage/perfschema/pse_sync_info.cc 2008-12-04 16:56:02 +0000
+++ b/storage/perfschema/pse_sync_info.cc 2008-12-05 20:19:48 +0000
@@ -185,12 +185,12 @@ PSE_sync_key register_mutex_info(const c
{
entry= & mutex_info_array[mutex_info_count];
init_sync_info(& entry->m_sync, name, name_length, flags);
- reset_single_stat(& entry->m_wait_stat);
entry->m_wait_stat.m_control_flag= & flag_events_waits_summary_by_name;
entry->m_wait_stat.m_parent= NULL;
- reset_single_stat(& entry->m_lock_stat);
+ reset_single_stat_chain(& entry->m_wait_stat);
entry->m_lock_stat.m_control_flag= & flag_events_locks_summary_by_name;
entry->m_lock_stat.m_parent= NULL;
+ reset_single_stat_chain(& entry->m_lock_stat);
entry->m_instances= 0;
entry->m_index= mutex_info_count;
mutex_info_count++;
@@ -227,15 +227,15 @@ PSE_sync_key register_rwlock_info(const
{
entry= & rwlock_info_array[rwlock_info_count];
init_sync_info(& entry->m_sync, name, name_length, flags);
- reset_single_stat(& entry->m_wait_stat);
entry->m_wait_stat.m_control_flag= & flag_events_waits_summary_by_name;
entry->m_wait_stat.m_parent= NULL;
- reset_single_stat(& entry->m_read_lock_stat);
+ reset_single_stat_chain(& entry->m_wait_stat);
entry->m_read_lock_stat.m_control_flag= & flag_events_locks_summary_by_name;
entry->m_read_lock_stat.m_parent= NULL;
- reset_single_stat(& entry->m_write_lock_stat);
+ reset_single_stat_chain(& entry->m_read_lock_stat);
entry->m_write_lock_stat.m_control_flag= & flag_events_locks_summary_by_name;
entry->m_write_lock_stat.m_parent= NULL;
+ reset_single_stat_chain(& entry->m_write_lock_stat);
entry->m_instances= 0;
entry->m_index= rwlock_info_count;
rwlock_info_count++;
@@ -272,9 +272,9 @@ PSE_sync_key register_cond_info(const ch
{
entry= & cond_info_array[cond_info_count];
init_sync_info(& entry->m_sync, name, name_length, flags);
- reset_single_stat(& entry->m_wait_stat);
entry->m_wait_stat.m_control_flag= & flag_events_waits_summary_by_name;
entry->m_wait_stat.m_parent= NULL;
+ reset_single_stat_chain(& entry->m_wait_stat);
entry->m_instances= 0;
entry->m_index= cond_info_count;
cond_info_count++;
=== modified file 'storage/perfschema/pse_sync_info.h'
--- a/storage/perfschema/pse_sync_info.h 2008-12-04 16:56:02 +0000
+++ b/storage/perfschema/pse_sync_info.h 2008-12-05 20:19:48 +0000
@@ -37,8 +37,8 @@ struct PSE_sync_info
struct PSE_mutex_info
{
PSE_sync_info m_sync;
- PSE_single_stat m_wait_stat;
- PSE_single_stat m_lock_stat;
+ PSE_single_stat_chain m_wait_stat;
+ PSE_single_stat_chain m_lock_stat;
uint m_instances;
uint m_index;
};
@@ -46,9 +46,9 @@ struct PSE_mutex_info
struct PSE_rwlock_info
{
PSE_sync_info m_sync;
- PSE_single_stat m_wait_stat;
- PSE_single_stat m_read_lock_stat;
- PSE_single_stat m_write_lock_stat;
+ PSE_single_stat_chain m_wait_stat;
+ PSE_single_stat_chain m_read_lock_stat;
+ PSE_single_stat_chain m_write_lock_stat;
uint m_instances;
uint m_index;
};
@@ -56,7 +56,7 @@ struct PSE_rwlock_info
struct PSE_cond_info
{
PSE_sync_info m_sync;
- PSE_single_stat m_wait_stat;
+ PSE_single_stat_chain m_wait_stat;
PSE_cond_stat m_cond_stat;
uint m_instances;
uint m_index;
=== modified file 'storage/perfschema/pse_table.cc'
--- a/storage/perfschema/pse_table.cc 2008-12-04 16:56:02 +0000
+++ b/storage/perfschema/pse_table.cc 2008-12-05 20:19:48 +0000
@@ -287,6 +287,19 @@ bool pse_show_status(handlerton *hton, T
total_memory+= size;
break;
case 36:
+ name= "EVENTS_WAITS_SUMMARY_BY_THREAD_BY_NAME.ROW_SIZE";
+ size= sizeof(PSE_single_stat);
+ break;
+ case 37:
+ name= "EVENTS_WAITS_SUMMARY_BY_THREAD_BY_NAME.ROW_COUNT";
+ size= thread_max * sync_info_per_thread;
+ break;
+ case 38:
+ name= "EVENTS_WAITS_SUMMARY_BY_THREAD_BY_NAME.MEMORY";
+ size= thread_max * sync_info_per_thread * sizeof(PSE_single_stat);
+ total_memory+= size;
+ break;
+ case 39:
name= "PERFORMANCE_SCHEMA.MEMORY";
size= total_memory;
break;
=== modified file 'storage/perfschema/table_events_waits.cc'
--- a/storage/perfschema/table_events_waits.cc 2008-12-02 03:29:07 +0000
+++ b/storage/perfschema/table_events_waits.cc 2008-12-05 20:19:48 +0000
@@ -18,6 +18,27 @@
#include "pse_sync_info.h"
#include "pse_sync.h"
+static const char* my_basename(const char* file)
+{
+ const char* base;
+ const char* ptr;
+#ifdef __WIN__
+ const char separator= '\\';
+#else
+ const char separator= '/';
+#endif
+
+ base= file;
+ ptr= file;
+ while (*ptr)
+ {
+ if (*ptr++ == separator)
+ base= ptr;
+ }
+
+ return base;
+}
+
pse_table_info
table_events_waits_current::m_info=
{
@@ -63,6 +84,8 @@ table_events_waits_common::table_events_
void table_events_waits_common::make_row(PSE_thread *pse_thread,
PSE_events_waits *wait)
{
+ const char* base;
+
m_row.m_thread_internal_id= pse_thread->m_thread_internal_id;
m_row.m_event_id= wait->m_event_id;
m_row.m_name= wait->m_info->m_name;
@@ -71,6 +94,12 @@ void table_events_waits_common::make_row
m_row.m_timer_start= wait->m_timer_start;
m_row.m_timer_end= wait->m_timer_end;
m_row.m_object_instance= wait->m_identity;
+
+ base= my_basename(wait->m_file);
+ m_row.m_source_length= snprintf(m_row.m_source, sizeof(m_row.m_source),
+ "%s:%d", base, wait->m_line);
+ if (m_row.m_source_length > sizeof(m_row.m_source))
+ m_row.m_source_length= sizeof(m_row.m_source);
m_row_exists= true;
}
@@ -131,7 +160,7 @@ int table_events_waits_common::read_row_
case 4:
DBUG_ASSERT(f->real_type() == MYSQL_TYPE_VARCHAR);
col_source= (Field_varstring*) f;
- col_source->set_null();
+ col_source->store(m_row.m_source, m_row.m_source_length, cs);
break;
case 5:
DBUG_ASSERT(f->real_type() == MYSQL_TYPE_LONGLONG);
=== modified file 'storage/perfschema/table_events_waits.h'
--- a/storage/perfschema/table_events_waits.h 2008-12-02 03:29:07 +0000
+++ b/storage/perfschema/table_events_waits.h 2008-12-05 20:19:48 +0000
@@ -33,6 +33,8 @@ struct row_events_waits
longlong m_timer_end;
longlong m_timer_wait;
void * m_object_instance;
+ char m_source[64];
+ int m_source_length;
};
struct pos_events_waits_current
| Thread |
|---|
| • bzr push into mysql-6.0-perf branch (marc.alff:2748 to 2749) | Marc Alff | 5 Dec |