Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the HAVE_PSI_INTERFACE macro used for?

Tags:

mysql

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.

like image 986
lulyon Avatar asked Aug 05 '13 14:08

lulyon


1 Answers

PSI stands for: Performance schema instrumentation interface.

You can find a psi.h file here (with comments)

like image 191
Bartosz Meister Avatar answered Oct 24 '22 15:10

Bartosz Meister