From: Christopher Powers Date: August 26 2010 4:58pm Subject: bzr commit into mysql-next-mr-bugfixing branch (chris.powers:3254) List-Archive: http://lists.mysql.com/commits/116933 Message-Id: <20100826165834.C92CD1DB036A@xeno.mysql.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1619367291525357498==" --===============1619367291525357498== MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline #At file:///home/cpowers/work/dev/mysql-next-mr-bugfixing/mysql/ based on revid:marc.alff@stripped 3254 Christopher Powers 2010-08-26 [merge] merge modified: storage/perfschema/pfs.cc storage/perfschema/pfs_stat.h === modified file 'storage/perfschema/pfs.cc' --- a/storage/perfschema/pfs.cc 2010-08-23 16:44:14 +0000 +++ b/storage/perfschema/pfs.cc 2010-08-26 16:44:02 +0000 @@ -1744,18 +1744,26 @@ static void end_mutex_wait_v1(PSI_mutex_ if (flag_events_waits_history_long) insert_events_waits_history_long(wait); - if (rc == 0 && wait->m_timer_state == TIMER_STATE_TIMED) + 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; + PFS_single_stat_chain *stat= find_per_thread_mutex_class_wait_stat(wait->m_thread, mutex->m_class); mutex->m_owner= wait->m_thread; mutex->m_last_locked= wait->m_timer_end; - 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_class_wait_stat(wait->m_thread, mutex->m_class); - aggregate_single_stat_chain(stat, wait_time); + /* If timed then aggregate stats, else increment the value counts only */ + if (wait->m_timer_state == TIMER_STATE_TIMED) + { + 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(stat, wait_time); + } + else + { + increment_single_stat_chain(&mutex->m_wait_stat); + increment_single_stat_chain(stat); + } } wait->m_thread->m_wait_locker_count--; } @@ -1801,20 +1809,26 @@ 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; + PFS_single_stat_chain *stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread, rwlock->m_class); + if (rwlock->m_readers == 0) rwlock->m_last_read= wait->m_timer_end; rwlock->m_writer= NULL; rwlock->m_readers++; + /* If timed then aggregate stats, else increment the value counts only */ if (wait->m_timer_state == TIMER_STATE_TIMED) { 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_class_wait_stat(wait->m_thread, rwlock->m_class); aggregate_single_stat_chain(stat, wait_time); } + else + { + increment_single_stat_chain(&rwlock->m_wait_stat); + increment_single_stat_chain(stat); + } } wait->m_thread->m_wait_locker_count--; } @@ -1854,21 +1868,26 @@ 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; + PFS_single_stat_chain *stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread, rwlock->m_class); rwlock->m_writer= wait->m_thread; rwlock->m_last_written= wait->m_timer_end; /* Reset the readers stats, they could be off */ rwlock->m_readers= 0; rwlock->m_last_read= 0; + /* If timed then aggregate stats, else increment the value counts only */ if (wait->m_timer_state == TIMER_STATE_TIMED) { 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_class_wait_stat(wait->m_thread, rwlock->m_class); aggregate_single_stat_chain(stat, wait_time); } + else + { + increment_single_stat_chain(&rwlock->m_wait_stat); + increment_single_stat_chain(stat); + } } wait->m_thread->m_wait_locker_count--; } @@ -1922,16 +1941,21 @@ static void end_cond_wait_v1(PSI_cond_lo in condition B. This is accepted, the data will be slightly inaccurate. */ - PFS_single_stat_chain *stat; PFS_cond *cond= pfs_locker->m_target.m_cond; + PFS_single_stat_chain *stat= find_per_thread_cond_class_wait_stat(wait->m_thread, cond->m_class); + /* If timed then aggregate stats, else increment the value counts only */ if (wait->m_timer_state == TIMER_STATE_TIMED) { ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; aggregate_single_stat_chain(&cond->m_wait_stat, wait_time); - stat= find_per_thread_cond_class_wait_stat(wait->m_thread, cond->m_class); aggregate_single_stat_chain(stat, wait_time); } + else + { + increment_single_stat_chain(&cond->m_wait_stat); + increment_single_stat_chain(stat); + } } wait->m_thread->m_wait_locker_count--; } @@ -1979,6 +2003,19 @@ static void end_table_wait_v1(PSI_table_ if (flag_events_waits_history_long) insert_events_waits_history_long(wait); + PFS_table *table= pfs_locker->m_target.m_table; + + /* If timed then aggregate stats, else increment the value counts only */ + if (wait->m_timer_state == TIMER_STATE_TIMED) + { + ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; + aggregate_single_stat_chain(&table->m_wait_stat, wait_time); + } + else + { + increment_single_stat_chain(&table->m_wait_stat); + } + /* There is currently no per table and per thread aggregation. The number of tables in the application is arbitrary, and may be high. @@ -2079,14 +2116,21 @@ static void end_file_wait_v1(PSI_file_lo if (flag_events_waits_history_long) insert_events_waits_history_long(wait); - PFS_single_stat_chain *stat; PFS_file *file= pfs_locker->m_target.m_file; + PFS_single_stat_chain *stat= find_per_thread_file_class_wait_stat(wait->m_thread, file->m_class); - ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; - aggregate_single_stat_chain(&file->m_wait_stat, wait_time); - stat= find_per_thread_file_class_wait_stat(wait->m_thread, - file->m_class); - aggregate_single_stat_chain(stat, wait_time); + /* If timed then aggregate stats, else increment the value counts only */ + if (wait->m_timer_state == TIMER_STATE_TIMED) + { + ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; + aggregate_single_stat_chain(&file->m_wait_stat, wait_time); + aggregate_single_stat_chain(stat, wait_time); + } + else + { + increment_single_stat_chain(&file->m_wait_stat); + increment_single_stat_chain(stat); + } PFS_file_class *klass= file->m_class; === modified file 'storage/perfschema/pfs_stat.h' --- a/storage/perfschema/pfs_stat.h 2010-07-16 01:28:30 +0000 +++ b/storage/perfschema/pfs_stat.h 2010-08-26 16:44:02 +0000 @@ -83,6 +83,22 @@ inline void aggregate_single_stat_chain( while (stat); } +/** + Increment the value counts in a statistic chain. + Used for instruments that are 'ENABLED' but not 'TIMED'. + @param stat the aggregated statistic chain +*/ +inline void increment_single_stat_chain(PFS_single_stat_chain *stat) +{ + do + { + if (*stat->m_control_flag) + stat->m_count++; + stat= stat->m_parent; + } + while (stat); +} + /** Statistics for COND usage. */ struct PFS_cond_stat { --===============1619367291525357498== MIME-Version: 1.0 Content-Type: text/bzr-bundle; charset="us-ascii"; name="bzr/chris.powers@stripped" Content-Transfer-Encoding: 7bit Content-Disposition: inline # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: chris.powers@stripped # target_branch: file:///home/cpowers/work/dev/mysql-next-mr-\ # bugfixing/mysql/ # testament_sha1: 53ae48e926e0282ac5bdaf34791c433a0f014048 # timestamp: 2010-08-26 11:58:33 -0500 # source_branch: file:///home/cpowers/work/dev/mysql-trunk-\ # bugfixing/mysql/ # base_revision_id: marc.alff@stripped\ # 4rzn009yl2bft35r # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWYsxoBcAB9v/gFAQAgBZ//// f2fegL////pgDF33b6fK9l2VXtO73a9soRbetLNGq7rjoqFyWIsSOMmTRiGJpgIGBNMEYJiaaaAD CCSQTEMgTQKntU9Q/U1DRoAAAAAAaTJimRTyg8oMmmgAAAAAAAAkRCBNBMKn5JppNpqYJpkepo8o BppoMmgEUiGUwgmp6nonkJN5JPRlPSA0yYgAGZQIpI1GQE09J6mE9TaTRTzSajTZTTTaEAGgPUoH BpLuYC7//Pp7Ojv8upbrr9PPExERDcO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