Skip to content

Commit fa3cfa0

Browse files
author
Marc Alff
committed
WL#2360 Performance schema
Part 1: Instrumentation interface
1 parent 4b28a6c commit fa3cfa0

18 files changed

+3857
-23
lines changed

Makefile.am

+5-4
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,12 @@ test-full-qa:
269269
#
270270

271271
API_PREPROCESSOR_HEADER = $(top_srcdir)/include/mysql/plugin.h \
272-
$(top_srcdir)/include/mysql.h
272+
$(top_srcdir)/include/mysql.h \
273+
$(top_srcdir)/include/mysql/psi/psi_abi_v1.h \
274+
$(top_srcdir)/include/mysql/psi/psi_abi_v2.h
273275

274-
TEST_PREPROCESSOR_HEADER = $(top_srcdir)/include/mysql/plugin.h \
275-
$(top_srcdir)/sql/mysql_priv.h \
276-
$(top_srcdir)/include/mysql.h
276+
TEST_PREPROCESSOR_HEADER = $(API_PREPROCESSOR_HEADER) \
277+
$(top_srcdir)/sql/mysql_priv.h
277278

278279
#
279280
# Rules for checking that the abi/api has not changed.

include/Makefile.am

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2000-2006 MySQL AB
1+
# Copyright (C) 2000-2006 MySQL AB, 2009 Sun Microsystems, Inc
22
#
33
# This library is free software; you can redistribute it and/or
44
# modify it under the terms of the GNU Library General Public
@@ -24,6 +24,8 @@ pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \
2424
my_xml.h mysql_embed.h mysql/services.h \
2525
mysql/service_my_snprintf.h mysql/service_thd_alloc.h \
2626
my_pthread.h my_no_pthread.h \
27+
mysql/psi/psi.h mysql/psi/mysql_thread.h \
28+
mysql/psi/mysql_file.h \
2729
decimal.h errmsg.h my_global.h my_net.h \
2830
my_getopt.h sslopt-longopts.h my_dir.h \
2931
sslopt-vars.h sslopt-case.h sql_common.h keycache.h \
@@ -38,13 +40,15 @@ noinst_HEADERS = config-win.h config-netware.h lf.h my_bit.h \
3840
my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \
3941
thr_lock.h t_ctype.h violite.h my_md5.h base64.h \
4042
my_handler.h my_time.h service_versions.h \
41-
my_rdtsc.h \
43+
my_rdtsc.h mysql/psi/psi_abi_v1.h mysql/psi/psi_abi_v2.h \
4244
my_vle.h my_user.h my_atomic.h atomic/nolock.h \
4345
atomic/rwlock.h atomic/x86-gcc.h atomic/generic-msvc.h \
4446
atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \
4547
atomic/solaris.h
4648

47-
EXTRA_DIST = mysql.h.pp mysql/plugin.h.pp probes_mysql.d.base
49+
EXTRA_DIST = mysql.h.pp mysql/plugin.h.pp probes_mysql.d.base \
50+
mysql/psi/psi_abi_v1.h.pp \
51+
mysql/psi/psi_abi_v2.h.pp
4852

4953
# Remove built files and the symlinked directories
5054
CLEANFILES = $(BUILT_SOURCES) readline openssl probes_mysql.d probes_mysql_nodtrace.h

include/my_global.h

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2000-2003 MySQL AB
1+
/* Copyright (C) 2000-2003 MySQL AB, 2009 Sun Microsystems, Inc
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -83,6 +83,16 @@
8383
#endif
8484
#endif /* _WIN32... */
8585

86+
#ifdef EMBEDDED_LIBRARY
87+
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
88+
#undef WITH_PERFSCHEMA_STORAGE_ENGINE
89+
#endif
90+
#endif /* EMBEDDED_LIBRARY */
91+
92+
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
93+
#define HAVE_PSI_INTERFACE
94+
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
95+
8696
/* Make it easier to add conditionl code for windows */
8797
#ifdef __WIN__
8898
#define IF_WIN(A,B) (A)

include/my_no_pthread.h

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef MY_NO_PTHREAD_INCLUDED
22
#define MY_NO_PTHREAD_INCLUDED
33

4-
/* Copyright (C) 2000 MySQL AB
4+
/* Copyright (C) 2000 MySQL AB, 2008-2009 Sun Microsystems, Inc
55
66
This program is free software; you can redistribute it and/or modify
77
it under the terms of the GNU General Public License as published by
@@ -48,5 +48,16 @@
4848
#define rw_unlock(A)
4949
#define rwlock_destroy(A)
5050

51+
#define mysql_mutex_init(A, B, C) do {} while (0)
52+
#define mysql_mutex_lock(A) do {} while (0)
53+
#define mysql_mutex_unlock(A) do {} while (0)
54+
#define mysql_mutex_destroy(A) do {} while (0)
55+
56+
#define mysql_rwlock_init(A, B, C) do {} while (0)
57+
#define mysql_rwlock_rdlock(A) do {} while (0)
58+
#define mysql_rwlock_wrlock(A) do {} while (0)
59+
#define mysql_rwlock_unlock(A) do {} while (0)
60+
#define mysql_rwlock_destroy(A) do {} while (0)
61+
5162
#endif
5263
#endif /* MY_NO_PTHREAD_INCLUDED */

include/my_pthread.h

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2000 MySQL AB
1+
/* Copyright (C) 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -99,7 +99,7 @@ struct timespec {
9999

100100

101101
int win_pthread_mutex_trylock(pthread_mutex_t *mutex);
102-
int pthread_create(pthread_t *,pthread_attr_t *,pthread_handler,void *);
102+
int pthread_create(pthread_t *, const pthread_attr_t *, pthread_handler, void *);
103103
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr);
104104
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
105105
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
@@ -137,8 +137,8 @@ int pthread_join(pthread_t thread, void **value_ptr);
137137
#define pthread_mutex_init(A,B) (InitializeCriticalSection(A),0)
138138
#define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
139139
#define pthread_mutex_trylock(A) win_pthread_mutex_trylock((A))
140-
#define pthread_mutex_unlock(A) LeaveCriticalSection(A)
141-
#define pthread_mutex_destroy(A) DeleteCriticalSection(A)
140+
#define pthread_mutex_unlock(A) (LeaveCriticalSection(A), 0)
141+
#define pthread_mutex_destroy(A) (DeleteCriticalSection(A), 0)
142142
#define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH)
143143

144144

@@ -630,6 +630,10 @@ extern int pthread_dummy(int);
630630
#endif
631631
#endif
632632

633+
#include <mysql/psi/mysql_thread.h>
634+
635+
#define INSTRUMENT_ME 0
636+
633637
struct st_my_thread_var
634638
{
635639
int thr_errno;

include/my_sys.h

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2000-2003 MySQL AB
1+
/* Copyright (C) 2000-2003 MySQL AB, 2008-2009 Sun Microsystems, Inc
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -1018,5 +1018,15 @@ void netware_reg_user(const char *ip, const char *user,
10181018
const char *application);
10191019
#endif
10201020

1021+
#include <mysql/psi/psi.h>
1022+
1023+
#ifdef HAVE_PSI_INTERFACE
1024+
extern MYSQL_PLUGIN_IMPORT struct PSI_bootstrap *PSI_hook;
1025+
void my_init_mysys_psi_keys(void);
1026+
#endif
1027+
1028+
struct st_mysql_file;
1029+
extern struct st_mysql_file *mysql_stdin;
1030+
10211031
C_MODE_END
10221032
#endif /* _my_sys_h */

0 commit comments

Comments
 (0)