From: Christopher Powers Date: August 26 2010 3:46pm Subject: bzr push into mysql-5.5-bugfixing branch (chris.powers:3196 to 3197) Bug#53874 List-Archive: http://lists.mysql.com/commits/116936 X-Bug: 53874 Message-Id: <20100826154630.7BD701DB0318@xeno.mysql.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6763668428992027288==" --===============6763668428992027288== MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline 3197 Christopher Powers 2010-08-26 Bug# 53874 "SETUP_INSTRUMENTS.TIMED='NO' should not change TIMER_WAIT Handle combined instrument states of ENABLED and/or TIMED: ENABLED TIMED 1 1 Aggregate stats, increment counter 1 0 Increment counter 0 1 Do nothing 0 0 Do nothing @ storage/perfschema/pfs.cc Aggregate stats only if state is both ENABLED and TIMED. If ENABLED but not TIMED, only increment the value counter. @ storage/perfschema/pfs_stat.h Split aggregate and counter increment into separate methods for performance. modified: storage/perfschema/pfs.cc storage/perfschema/pfs_stat.h 3196 Marc Alff 2010-08-26 [merge] local merge added: mysql-test/r/mysql_not_windows.result mysql-test/t/mysql_not_windows.test modified: mysql-test/include/mysqlhotcopy.inc mysql-test/mysql-test-run.pl mysql-test/r/ctype_utf32.result mysql-test/r/delayed.result mysql-test/r/func_group.result mysql-test/r/locale.result mysql-test/r/mysql.result mysql-test/r/mysqlbinlog_row.result mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result mysql-test/suite/ndb/r/ndb_binlog_log_bin.result mysql-test/suite/ndb/r/ndb_binlog_multi.result mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result mysql-test/t/ctype_utf32.test mysql-test/t/delayed.test mysql-test/t/func_group.test mysql-test/t/mysql.test sql/item.cc sql/log_event.cc sql/sql_insert.cc sql/sql_table.cc storage/myisam/mi_key.c === modified file 'storage/perfschema/pfs.cc' --- a/storage/perfschema/pfs.cc 2010-08-19 22:24:07 +0000 +++ b/storage/perfschema/pfs.cc 2010-08-26 15:45:25 +0000 @@ -1625,18 +1625,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--; } @@ -1682,20 +1690,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--; } @@ -1735,21 +1749,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--; } @@ -1803,16 +1822,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--; } @@ -1855,12 +1879,18 @@ 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) { - PFS_table *table= pfs_locker->m_target.m_table; 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. @@ -1962,14 +1992,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-15 23:44:45 +0000 +++ b/storage/perfschema/pfs_stat.h 2010-08-26 15:45:25 +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 { --===============6763668428992027288== 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/base-55-\ # bugfixing/mysql/ # testament_sha1: 5288be59af6111da333313418626d17049ae16b3 # timestamp: 2010-08-26 10:46:30 -0500 # base_revision_id: marc.alff@stripped\ # atluv7026g02yri6 # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWWCUNTcABJh/gFAQAgBZ//// f2fegL////pgCN9i56wzjIAzfdugCgCVFNGOMmTRiGJpgIGBNMEYJiaaaADCCUEE0YjSak9TU8jE g0NNMgyGgABoZBoJlMSTRkaaaYmjRoAANMQAAZAJESCDVPKeQYpo8ptQHpqPRqADQA0ABlFDT1D1 AABoAAAAAAAaaAkSTQEDQJ6mBNMhNKeQn6SH6nqn6oeJqGR6nlKEg82At/3fDy3dXbnpqxYRKIiI bhymfrx+pbw48FxYq6HbVT23UgLwGzojgoM21O7w6WeVbRq+LFbB++34/0eW9UxzzxyJqEVOFN18 ajLJRlIrRRCFJ2ihzWEpPJZuqT4nPeVt+pBACKIIetUELzf87K6n2FrFL5lhzPmZRtoE2nZ+Ff0S NGSmmJacs5j0arMigON0ETYyeSBkdQDNmRzINqPJ2KBqZK0npiyUKxvBFnGKTnquVLbtSQVEpPLW sDSoDWfY87ZBQcr2ni0TnMNeetimxucW3GTVugwSBe5WVJSYEVXurTYHCFFWEQTBZq14KG2hEANQ 4OlCUNV+msTn71ABMGKYExUimgqPgYgvMyDfu59mvdvNvtK+eREroQYvIDf8XOb4gNsaGzWiC6db tn1I1QhjE32e1KwXseRin+e2wTbuZQEzUeHVwMFQuKExdMHbnuXNpETmTkS70jCmi3u3IOlN1Ofb T+uUNSKRLEKBGhLeuNvQy7FaZW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