content_image/714822.jpg
<img src='content_image/714822.jpg'>

15 rows in set (0.00 sec) 

4. Once instruments and consumers are enabled, run the workload that you want to monitor. In this example, the mysqlslap  load emulation client is used to simulate a workload. 

shell> ./mysqlslap --auto-generate-sql --concurrency=100 --iterations=10 --number-of-queries=1000 --number-char-cols=6 --number-int-cols=6; 

5. Query the wait event data. In this example, wait event data is queried from the events_waits_summary_global_by_event_name  table which aggregates data found in the events_waits_current , events_waits_history , and events_waits_history_long  tables. Data is summarized by event name ( EVENT_NAME ), which is the name of the instrument that produced the event. Summarized data includes: 

• COUNT_STAR 

The number of summarized wait events. 

• SUM_TIMER_WAIT 

The total wait time of the summarized timed wait events. 

• MIN_TIMER_WAIT 

The minimum wait time of the summarized timed wait events. 

• AVG_TIMER_WAIT 

The average wait time of the summarized timed wait events. 

• MAX_TIMER_WAIT 

The maximum wait time of the summarized timed wait events. 

The following query returns the instrument name ( EVENT_NAME ), the number of wait events ( COUNT_STAR ), and the total wait time for the events for that instrument ( SUM_TIMER_WAIT ). Because waits are timed in picoseconds (trillionths of a second) by default, wait times are divided by 1000000000 to show wait times in milliseconds. Data is presented in descending order, by the number of summarized wait events ( COUNT_STAR ). You can adjust the ORDER BY  clause to order the data by total wait time. 

mysql> SELECT EVENT_NAME, COUNT_STAR, SUM_TIMER_WAIT/1000000000 SUM_TIMER_WAIT_MS FROM performance_schema.events_waits_summary_global_by_event_name WHERE SUM_TIMER_WAIT > 0 AND EVENT_NAME LIKE ’wait/synch/mutex/innodb/%’ ORDER BY COUNT_STAR DESC; +---------------------------------------------------------+------------+-------------------+ 

