This patch adds several INFORMATION_SCHEMA tables, several FLUSH and SHOW commands, and the userstat_running variable. These tables and commands can be used to understand the server activity better and identify the source of the load.
The functionality is disabled by default, and must be enabled by setting the userstat_running variable to ON. It works by keeping several hash tables in memory. To avoid contention over global mutexes, each connection has its own local statistics, which are occasionally merged into the global statistics, and the local statistics are then reset to 0.