summaryrefslogtreecommitdiff
path: root/sql/sp_cache.cc
diff options
context:
space:
mode:
authorMarc Alff <marc.alff@sun.com>2009-12-09 20:19:51 -0700
committerMarc Alff <marc.alff@sun.com>2009-12-09 20:19:51 -0700
commitc082955f0676efe069f30384102ba7807b49dee6 (patch)
treecc0a038191d1969182d5dd108c891ee10a436cc0 /sql/sp_cache.cc
parent6fd3866c6c104f8bc991d71583e627ae6fabe0ab (diff)
downloadmariadb-git-c082955f0676efe069f30384102ba7807b49dee6.tar.gz
WL#2360 Performance schema
Part III: mysys instrumentation
Diffstat (limited to 'sql/sp_cache.cc')
-rw-r--r--sql/sp_cache.cc30
1 files changed, 27 insertions, 3 deletions
diff --git a/sql/sp_cache.cc b/sql/sp_cache.cc
index d9a23d2be4e..e1f2bb1c95b 100644
--- a/sql/sp_cache.cc
+++ b/sql/sp_cache.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 MySQL AB
+/* Copyright (C) 2002 MySQL AB, 2008-2009 Sun Microsystems, Inc
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
#include "sp_cache.h"
#include "sp_head.h"
-static pthread_mutex_t Cversion_lock;
+static mysql_mutex_t Cversion_lock;
static ulong volatile Cversion= 0;
@@ -75,12 +75,36 @@ private:
HASH m_hashtable;
}; // class sp_cache
+#ifdef HAVE_PSI_INTERFACE
+static PSI_mutex_key key_Cversion_lock;
+
+static PSI_mutex_info all_sp_cache_mutexes[]=
+{
+ { &key_Cversion_lock, "Cversion_lock", PSI_FLAG_GLOBAL}
+};
+
+static void init_sp_cache_psi_keys(void)
+{
+ const char* category= "sql";
+ int count;
+
+ if (PSI_server == NULL)
+ return;
+
+ count= array_elements(all_sp_cache_mutexes);
+ PSI_server->register_mutex(category, all_sp_cache_mutexes, count);
+}
+#endif
/* Initialize the SP caching once at startup */
void sp_cache_init()
{
- pthread_mutex_init(&Cversion_lock, MY_MUTEX_INIT_FAST);
+#ifdef HAVE_PSI_INTERFACE
+ init_sp_cache_psi_keys();
+#endif
+
+ mysql_mutex_init(key_Cversion_lock, &Cversion_lock, MY_MUTEX_INIT_FAST);
}