1 /* Copyright (c) 2008, 2021, Oracle and/or its affiliates.
2 
3   This program is free software; you can redistribute it and/or modify
4   it under the terms of the GNU General Public License, version 2.0,
5   as published by the Free Software Foundation.
6 
7   This program is also distributed with certain software (including
8   but not limited to OpenSSL) that is licensed under separate terms,
9   as designated in a particular file or component or in included license
10   documentation.  The authors of MySQL hereby grant you an additional
11   permission to link the program and your derivative works with the
12   separately licensed software that they have included with MySQL.
13 
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License, version 2.0, for more details.
18 
19   You should have received a copy of the GNU General Public License
20   along with this program; if not, write to the Free Software Foundation,
21   51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
22 
23 #ifndef PFS_H
24 #define PFS_H
25 
26 /**
27   @file storage/perfschema/pfs.h
28   Performance schema instrumentation (declarations).
29 */
30 
31 #define HAVE_PSI_1
32 
33 #include <my_global.h>
34 #include <my_thread.h>
35 #include <my_thread_local.h>
36 #include <mysql/psi/psi.h>
37 
38 /**
39   Entry point to the performance schema implementation.
40   This singleton is used to discover the performance schema services.
41 */
42 extern struct PSI_bootstrap PFS_bootstrap;
43 /** Performance schema Thread Local Storage key.  */
44 extern thread_local_key_t THR_PFS;
45 extern thread_local_key_t THR_PFS_VG;  // global_variables
46 extern thread_local_key_t THR_PFS_SV;  // session_variables
47 extern thread_local_key_t THR_PFS_VBT; // variables_by_thread
48 extern thread_local_key_t THR_PFS_SG;  // global_status
49 extern thread_local_key_t THR_PFS_SS;  // session_status
50 extern thread_local_key_t THR_PFS_SBT; // status_by_thread
51 extern thread_local_key_t THR_PFS_SBU; // status_by_user
52 extern thread_local_key_t THR_PFS_SBA; // status_by_host
53 extern thread_local_key_t THR_PFS_SBH; // status_by_account
54 
55 /** True when @c THR_PFS and all other Performance Schema TLS keys are initialized. */
56 extern bool THR_PFS_initialized;
57 
58 #define PSI_VOLATILITY_UNKNOWN 0
59 #define PSI_VOLATILITY_SESSION 1
60 
61 #define PSI_COUNT_VOLATILITY 2
62 
63 #endif
64 
65