MySQL 9.0.0
Source Code Documentation
stage_monitor_handler.h
Go to the documentation of this file.
1/* Copyright (c) 2018, 2024, 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 designed to work 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 either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef STAGE_MONITOR_HANDLER_INCLUDED
25#define STAGE_MONITOR_HANDLER_INCLUDED
26
29
31 public:
34
35 /**
36 Fetch the registry and the service for this class
37
38 @returns 0 in case of success, or 1 otherwise
39 */
41
42 /**
43 Terminate the stage monitor.
44 It means the stage monitor is declared as not running and the service is
45 released.
46
47 @returns 0 in case of success, or 1 otherwise
48 */
50
51 /**
52 Set that a new stage is now in progress.
53 @param key The PSI key for the stage
54 @param file the file for this stage
55 @param line the line of the file for this stage
56 @param estimated_work what work is estimated for this stage
57 @param work_completed what work already completed for this stage
58
59 @returns 0 in case of success, or 1 otherwise
60 */
61 int set_stage(PSI_stage_key key, const char *file, int line,
62 ulonglong estimated_work, ulonglong work_completed);
63
64 /**
65 Set the currently estimated work for this stage
66 */
67 void set_estimated_work(ulonglong estimated_work);
68
69 /**
70 Set the currently completed work for this stage
71 */
72 void set_completed_work(ulonglong completed_work);
73
74 // get methods
75
76 /**
77 End the current stage
78 */
79 void end_stage();
80
81 private:
82 /** The generic service handle for the PSI stage service*/
84 /** The progress handler when a stage is running*/
86 /** Is the reference to the PSI stage service still valid*/
88 /** Lock for use vs termination scenarios */
90};
91
92#endif /* STAGE_MONITOR_HANDLER_INCLUDED */
Definition: stage_monitor_handler.h:30
int initialize_stage_monitor()
Fetch the registry and the service for this class.
Definition: stage_monitor_handler.cc:62
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:79
int terminate_stage_monitor()
Terminate the stage monitor.
Definition: stage_monitor_handler.cc:41
PSI_stage_progress * stage_progress_handler
The progress handler when a stage is running.
Definition: stage_monitor_handler.h:85
void end_stage()
End the current stage.
Definition: stage_monitor_handler.cc:127
void set_completed_work(ulonglong completed_work)
Set the currently completed work for this stage.
Definition: stage_monitor_handler.cc:115
Plugin_stage_monitor_handler()
Definition: stage_monitor_handler.cc:29
virtual ~Plugin_stage_monitor_handler()
Definition: stage_monitor_handler.cc:37
my_h_service generic_service
The generic service handle for the PSI stage service.
Definition: stage_monitor_handler.h:83
void set_estimated_work(ulonglong estimated_work)
Set the currently estimated work for this stage.
Definition: stage_monitor_handler.cc:103
bool service_running
Is the reference to the PSI stage service still valid.
Definition: stage_monitor_handler.h:87
mysql_mutex_t stage_monitor_lock
Lock for use vs termination scenarios.
Definition: stage_monitor_handler.h:89
unsigned int PSI_stage_key
Instrumented stage key.
Definition: psi_stage_bits.h:43
struct my_h_service_imp * my_h_service
A handle type for acquired Service.
Definition: registry.h:33
unsigned long long int ulonglong
Definition: my_inttypes.h:56
Definition: os0file.h:89
required string key
Definition: replication_asynchronous_connection_failover.proto:60
Interface for an instrumented stage progress.
Definition: psi_stage_bits.h:63
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50