Commit e2b35294 authored by Christopher Powers's avatar Christopher Powers

Bug#53874, "SETUP_INSTRUMENTS.TIMED='NO' should not change TIMER_WAIT in aggregations"

end_*_wait() functions now honor TIMER_STATE_UNTIMED
parent cdce6061
...@@ -1625,7 +1625,7 @@ static void end_mutex_wait_v1(PSI_mutex_locker* locker, int rc) ...@@ -1625,7 +1625,7 @@ static void end_mutex_wait_v1(PSI_mutex_locker* locker, int rc)
if (flag_events_waits_history_long) if (flag_events_waits_history_long)
insert_events_waits_history_long(wait); insert_events_waits_history_long(wait);
if (rc == 0) if (rc == 0 && wait->m_timer_state == TIMER_STATE_TIMED)
{ {
/* Thread safe: we are protected by the instrumented mutex */ /* Thread safe: we are protected by the instrumented mutex */
PFS_single_stat_chain *stat; PFS_single_stat_chain *stat;
...@@ -1635,8 +1635,7 @@ static void end_mutex_wait_v1(PSI_mutex_locker* locker, int rc) ...@@ -1635,8 +1635,7 @@ static void end_mutex_wait_v1(PSI_mutex_locker* locker, int rc)
ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
aggregate_single_stat_chain(&mutex->m_wait_stat, wait_time); aggregate_single_stat_chain(&mutex->m_wait_stat, wait_time);
stat= find_per_thread_mutex_class_wait_stat(wait->m_thread, stat= find_per_thread_mutex_class_wait_stat(wait->m_thread, mutex->m_class);
mutex->m_class);
aggregate_single_stat_chain(stat, wait_time); aggregate_single_stat_chain(stat, wait_time);
} }
wait->m_thread->m_wait_locker_count--; wait->m_thread->m_wait_locker_count--;
...@@ -1690,12 +1689,14 @@ static void end_rwlock_rdwait_v1(PSI_rwlock_locker* locker, int rc) ...@@ -1690,12 +1689,14 @@ static void end_rwlock_rdwait_v1(PSI_rwlock_locker* locker, int rc)
rwlock->m_writer= NULL; rwlock->m_writer= NULL;
rwlock->m_readers++; rwlock->m_readers++;
if (wait->m_timer_state == TIMER_STATE_TIMED)
{
ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
aggregate_single_stat_chain(&rwlock->m_wait_stat, wait_time); aggregate_single_stat_chain(&rwlock->m_wait_stat, wait_time);
stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread, stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread, rwlock->m_class);
rwlock->m_class);
aggregate_single_stat_chain(stat, wait_time); aggregate_single_stat_chain(stat, wait_time);
} }
}
wait->m_thread->m_wait_locker_count--; wait->m_thread->m_wait_locker_count--;
} }
...@@ -1742,12 +1743,14 @@ static void end_rwlock_wrwait_v1(PSI_rwlock_locker* locker, int rc) ...@@ -1742,12 +1743,14 @@ static void end_rwlock_wrwait_v1(PSI_rwlock_locker* locker, int rc)
rwlock->m_readers= 0; rwlock->m_readers= 0;
rwlock->m_last_read= 0; rwlock->m_last_read= 0;
if (wait->m_timer_state == TIMER_STATE_TIMED)
{
ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
aggregate_single_stat_chain(&rwlock->m_wait_stat, wait_time); aggregate_single_stat_chain(&rwlock->m_wait_stat, wait_time);
stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread, stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread, rwlock->m_class);
rwlock->m_class);
aggregate_single_stat_chain(stat, wait_time); aggregate_single_stat_chain(stat, wait_time);
} }
}
wait->m_thread->m_wait_locker_count--; wait->m_thread->m_wait_locker_count--;
} }
...@@ -1803,12 +1806,14 @@ static void end_cond_wait_v1(PSI_cond_locker* locker, int rc) ...@@ -1803,12 +1806,14 @@ static void end_cond_wait_v1(PSI_cond_locker* locker, int rc)
PFS_single_stat_chain *stat; PFS_single_stat_chain *stat;
PFS_cond *cond= pfs_locker->m_target.m_cond; PFS_cond *cond= pfs_locker->m_target.m_cond;
if (wait->m_timer_state == TIMER_STATE_TIMED)
{
ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
aggregate_single_stat_chain(&cond->m_wait_stat, wait_time); aggregate_single_stat_chain(&cond->m_wait_stat, wait_time);
stat= find_per_thread_cond_class_wait_stat(wait->m_thread, stat= find_per_thread_cond_class_wait_stat(wait->m_thread, cond->m_class);
cond->m_class);
aggregate_single_stat_chain(stat, wait_time); aggregate_single_stat_chain(stat, wait_time);
} }
}
wait->m_thread->m_wait_locker_count--; wait->m_thread->m_wait_locker_count--;
} }
...@@ -1850,9 +1855,12 @@ static void end_table_wait_v1(PSI_table_locker* locker) ...@@ -1850,9 +1855,12 @@ static void end_table_wait_v1(PSI_table_locker* locker)
if (flag_events_waits_history_long) if (flag_events_waits_history_long)
insert_events_waits_history_long(wait); insert_events_waits_history_long(wait);
if (wait->m_timer_state == TIMER_STATE_TIMED)
{
PFS_table *table= pfs_locker->m_target.m_table; PFS_table *table= pfs_locker->m_target.m_table;
ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
aggregate_single_stat_chain(&table->m_wait_stat, wait_time); aggregate_single_stat_chain(&table->m_wait_stat, wait_time);
}
/* /*
There is currently no per table and per thread aggregation. There is currently no per table and per thread aggregation.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment