MySQL  8.0.19
Source Code Documentation
stage_monitor_handler.h
Go to the documentation of this file.
1 /* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
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 STAGE_MONITOR_HANDLER_INCLUDED
24 #define STAGE_MONITOR_HANDLER_INCLUDED
25 
28 
30  public:
33 
34  /**
35  Fetch the registry and the service for this class
36 
37  @returns 0 in case of success, or 1 otherwise
38  */
40 
41  /**
42  Terminate the stage monitor.
43  It means the stage monitor is declared as not running and the service is
44  released.
45 
46  @returns 0 in case of success, or 1 otherwise
47  */
49 
50  /**
51  Set that a new stage is now in progress.
52  @param key The PSI key for the stage
53  @param file the file for this stage
54  @param line the line of the file for this stage
55  @param estimated_work what work is estimated for this stage
56  @param work_completed what work already completed for this stage
57 
58  @returns 0 in case of success, or 1 otherwise
59  */
60  int set_stage(PSI_stage_key key, const char *file, int line,
61  ulonglong estimated_work, ulonglong work_completed);
62 
63  /**
64  Set the currently estimated work for this stage
65  */
66  void set_estimated_work(ulonglong estimated_work);
67 
68  /**
69  Set the currently completed work for this stage
70  */
71  void set_completed_work(ulonglong completed_work);
72 
73  // get methods
74 
75  /**
76  End the current stage
77  */
78  void end_stage();
79 
80  private:
81  /** The generic service handle for the PSI stage service*/
83  /** The progress handler when a stage is running*/
85  /** Is the reference to the PSI stage service still valid*/
87  /** Lock for use vs termination scenarios */
89 };
90 
91 #endif /* STAGE_MONITOR_HANDLER_INCLUDED */
Plugin_stage_monitor_handler::stage_progress_handler
PSI_stage_progress * stage_progress_handler
The progress handler when a stage is running.
Definition: stage_monitor_handler.h:84
Plugin_stage_monitor_handler::end_stage
void end_stage()
End the current stage.
Definition: stage_monitor_handler.cc:126
Plugin_stage_monitor_handler::set_estimated_work
void set_estimated_work(ulonglong estimated_work)
Set the currently estimated work for this stage.
Definition: stage_monitor_handler.cc:102
my_h_service
struct my_h_service_imp * my_h_service
A handle type for acquired Service.
Definition: registry.h:32
mysql_mutex_t
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:49
PSI_stage_progress_v1
Interface for an instrumented stage progress.
Definition: psi_stage_bits.h:60
Plugin_stage_monitor_handler::set_completed_work
void set_completed_work(ulonglong completed_work)
Set the currently completed work for this stage.
Definition: stage_monitor_handler.cc:114
Plugin_stage_monitor_handler::~Plugin_stage_monitor_handler
virtual ~Plugin_stage_monitor_handler()
Definition: stage_monitor_handler.cc:36
Plugin_stage_monitor_handler::Plugin_stage_monitor_handler
Plugin_stage_monitor_handler()
Definition: stage_monitor_handler.cc:28
key
static const char * key
Definition: suite_stubs.c:14
Plugin_stage_monitor_handler
Definition: stage_monitor_handler.h:29
Plugin_stage_monitor_handler::set_stage
int set_stage(PSI_stage_key key, const char *file, int line, ulonglong estimated_work, ulonglong work_completed)
Set that a new stage is now in progress.
Definition: stage_monitor_handler.cc:78
plugin_psi.h
PSI_stage_key
unsigned int PSI_stage_key
Instrumented stage key.
Definition: psi_stage_bits.h:40
Plugin_stage_monitor_handler::stage_monitor_lock
mysql_mutex_t stage_monitor_lock
Lock for use vs termination scenarios.
Definition: stage_monitor_handler.h:88
Plugin_stage_monitor_handler::service_running
bool service_running
Is the reference to the PSI stage service still valid.
Definition: stage_monitor_handler.h:86
Plugin_stage_monitor_handler::terminate_stage_monitor
int terminate_stage_monitor()
Terminate the stage monitor.
Definition: stage_monitor_handler.cc:40
ulonglong
unsigned long long int ulonglong
Definition: my_inttypes.h:55
Plugin_stage_monitor_handler::generic_service
my_h_service generic_service
The generic service handle for the PSI stage service.
Definition: stage_monitor_handler.h:82
Plugin_stage_monitor_handler::initialize_stage_monitor
int initialize_stage_monitor()
Fetch the registry and the service for this class.
Definition: stage_monitor_handler.cc:61
my_service.h