2013-08-05 53 views
6

我一直在閱讀MySQL 5.5源代碼,並且被整個項目的許多源文件中出現的宏HAVE_PSI_INTERFACE所困惑。什麼是HAVE_PSI_INTERFACE宏用於?

例如,在源文件存儲/例子/ 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用於什麼?

謝謝。

回答

3

PSI是什麼:Performance schema instrumentation接口。

你可以找到一個psi.h文件here(含評論)

+0

謝謝。我最近更熟悉儀器。 – lulyon