I've been reading MySQL 5.5 source code, and got confused by the macro HAVE_PSI_INTERFACE, which is appeared in many source file of the whole project.
For example, in the source file storage/example/ha_example.cc, there is the following code:
#ifdef HAVE_PSI_INTERFACE
static PSI_mutex_key ex_key_mutex_example, ex_key_mutex_EXAMPLE_SHARE_mutex;
static PSI_mutex_info all_example_mutexes[]=
{
{ &ex_key_mutex_example, "example", PSI_FLAG_GLOBAL},
{ &ex_key_mutex_EXAMPLE_SHARE_mutex, "EXAMPLE_SHARE::mutex", 0}
};
static void init_example_psi_keys()
{
const char* category= "example";
int count;
if (PSI_server == NULL)
return;
count= array_elements(all_example_mutexes);
PSI_server->register_mutex(category, all_example_mutexes, count);
}
#endif
So what does the HAVE_PSI_INTERFACE mean? Specifically, what does the PSI stand for? And what is the macro HAVE_PSI_INTERFACE used for?
Thanks.
PSI stands for: Performance schema instrumentation interface.
You can find a psi.h file here (with comments)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With