root@localhost : performance_schema 05:23:28> SELECT * FROM performance_timers; +————-+—————–+——————+—————-+ | TIMER_NAME | TIMER_FREQUENCY | TIMER_RESOLUTION | TIMER_OVERHEAD | +————-+—————–+——————+—————-+ | CYCLE | 2603393034 | 1 | 66 | | NANOSECOND | 1000000000 | 1000 | 682 | | MICROSECOND | 1000000 | 1 | 227 | | MILLISECOND | 1039 | 1 | 247 | | TICK | 100 | 1 | 634 | +————-+—————–+——————+—————-+
root@localhost : performance_schema 05:20:33> select * from setup_timers; +——+————+ | NAME | TIMER_NAME | +——+————+ | wait | CYCLE | +——+————+ UPDATE setup_timers SET TIMER_NAME= ‘NANOSECOND’ WHERE NAME=’wait’;
root@localhost : performance_schema 05:23:45> SELECT * FROM setup_consumers; +———————————————-+———+ | NAME | ENABLED | +———————————————-+———+ | events_waits_current | YES | | events_waits_history | YES | | events_waits_history_long | YES | | events_waits_summary_by_thread_by_event_name | YES | | events_waits_summary_by_event_name | YES | | events_waits_summary_by_instance | YES | | file_summary_by_event_name | YES | | file_summary_by_instance | YES | +———————————————-+———+ UPDATE setup_consumers SET ENABLED = ‘YES’ WHERE NAME=’ events_waits_history’;(表示能够被收集) UPDATE setup_instruments SET ENABLED=’YES’ WHERE NAME=’ wait/synch/mutex/sql/PAGE::locK’;
root@localhost : performance_schema 06:54:34> show processlist; +——+——+———–+——————–+———+——+ | Id | User | Host | db | Command | Time | +——+——+———–+——————–+———+——+ | 2731 | root | localhost | test | Query | 67 | | 2732 | root | localhost | test | Sleep | 139 | | 2733 | root | localhost | performance_schema | Query | 0 | +——+——+———–+——————–+———+——+
root@localhost : performance_schema 06:54:16> SELECT * FROM threads where PROCESSLIST_ID IN(2731,2732,2733); +———–+—————-+—————————+ | THREAD_ID | PROCESSLIST_ID | NAME | +———–+—————-+—————————+ | 2742 | 2732 | thread/sql/one_connection | | 2741 | 2731 | thread/sql/one_connection | | 2743 | 2733 | thread/sql/one_connection | +———–+—————-+—————————+
Session1 PID=2732; THREAD_ID: 2742 | Session2 PID 2731;THREAD_ID: 2741 | Session3 查看监控信息 | |
1 | LOCK TABLE task WRITE | ||
2 | START TRANSACTIONupdate task set type=3 where uid=1238 and tdid=117004 and date=20110522;wait……………………. | ||
3 | root@localhost : performance_schema 07:00:31> SELECT * FROM events_waits_current WHERE TIMER_END IS NULL\G;*************************** 1. row ***************************THREAD_ID: 2741EVENT_ID: 63EVENT_NAME: wait/synch/cond/sql/MDL_context::COND_wait_statusSOURCE: mdl.cc:983TIMER_START: 99074136559454208TIMER_END: NULLTIMER_WAIT: NULLSPINS: NULL
OBJECT_SCHEMA: NULL
OBJECT_NAME: NULL
OBJECT_TYPE: NULL
OBJECT_INSTANCE_BEGIN: 453433776
NESTING_EVENT_ID: NULL
OPERATION: timed_wait
NUMBER_OF_BYTES: NULL
FLAGS: 0
1 row in set (0.00 sec)
| ||
4 | root@localhost : performance_schema 07:01:51> SELECT * FROM mutex_instances WHERE LOCKED_BY_THREAD_ID IS NOT NULL;+————————————————-+———————–+———————+| NAME | OBJECT_INSTANCE_BEGIN | LOCKED_BY_THREAD_ID |+————————————————-+———————–+———————+| wait/synch/mutex/sql/MDL_wait::LOCK_wait_status | 453433720 | 2741 |+————————————————-+———————–+———————+ | ||
5 | Unlock tables |