Using the New MySQL Query Profiler

SELECT @@profiling;

SET profiling = 1;

SHOW PROFILES;

SHOW PROFILE;
SHOW PROFILE ALL;

SHOW PROFILES;

SHOW PROFILE FOR QUERY 1;

SHOW PROFILE ALL FOR QUERY 1;

SELECT *
FROM information_schema.profiling
WHERE query_id = 1;

SELECT SUM(duration)
FROM information_schema.profiling
WHERE query_id = 1;

SELECT MIN(seq) seq,
state,
COUNT(*) numb_ops,
ROUND(SUM(duration), 5) sum_dur,
ROUND(AVG(duration), 5) avg_dur,
ROUND(SUM(cpu_user), 5) sum_cpu,
ROUND(AVG(cpu_user), 5) avg_cpu
FROM information_schema.profiling
WHERE query_id = 1
GROUP BY state
ORDER BY seq;