我一直在阅读 MySQL 5.5 源代码,并且被宏 HAVE_PSI_INTERFACE 弄糊涂了,它出现在整个项目的许多源文件中。
例如在源文件storage/example/ha_example.cc中,有如下代码:
#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
那么 HAVE_PSI_INTERFACE 是什么意思?具体来说,PSI 代表什么?宏 HAVE_PSI_INTERFACE 的用途是什么?
谢谢。
最佳答案
PSI 代表:性能模式检测接口(interface)。
你可以找到一个 psi.h 文件 here (有评论)
关于mysql - HAVE_PSI_INTERFACE 宏的用途是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18060134/