1 /* Copyright (c) 2010, 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
21   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
22 
23 #ifndef PFS_EVENTS_STAGES_H
24 #define PFS_EVENTS_STAGES_H
25 
26 /**
27   @file storage/perfschema/pfs_events_stages.h
28   Events waits data structures (declarations).
29 */
30 
31 #include "pfs_events.h"
32 
33 struct PFS_thread;
34 struct PFS_account;
35 struct PFS_user;
36 struct PFS_host;
37 
38 /** A stage record. */
39 struct PFS_events_stages : public PFS_events
40 {
41   PSI_stage_progress m_progress;
42 };
43 
44 void insert_events_stages_history(PFS_thread *thread, PFS_events_stages *stage);
45 void insert_events_stages_history_long(PFS_events_stages *stage);
46 
47 extern bool flag_events_stages_current;
48 extern bool flag_events_stages_history;
49 extern bool flag_events_stages_history_long;
50 
51 extern bool events_stages_history_long_full;
52 extern PFS_ALIGNED PFS_cacheline_uint32 events_stages_history_long_index;
53 extern PFS_events_stages *events_stages_history_long_array;
54 extern ulong events_stages_history_long_size;
55 
56 int init_events_stages_history_long(uint events_stages_history_long_sizing);
57 void cleanup_events_stages_history_long();
58 
59 void reset_events_stages_current();
60 void reset_events_stages_history();
61 void reset_events_stages_history_long();
62 void reset_events_stages_by_thread();
63 void reset_events_stages_by_account();
64 void reset_events_stages_by_user();
65 void reset_events_stages_by_host();
66 void reset_events_stages_global();
67 void aggregate_account_stages(PFS_account *account);
68 void aggregate_user_stages(PFS_user *user);
69 void aggregate_host_stages(PFS_host *host);
70 
71 #endif
72 
73