1 /*
2    Copyright (c) 2010, 2021, Oracle and/or its affiliates.
3 
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License, version 2.0,
6    as published by the Free Software Foundation.
7 
8    This program is also distributed with certain software (including
9    but not limited to OpenSSL) that is licensed under separate terms,
10    as designated in a particular file or component or in included license
11    documentation.  The authors of MySQL hereby grant you an additional
12    permission to link the program and your derivative works with the
13    separately licensed software that they have included with MySQL.
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 
25 /*
26  * hrt_gstopwatch.c
27  *
28  */
29 
30 #include "hrt_gstopwatch.h"
31 
32 /*
33  * High-Resolution Time Global Stopwatch Utility -- Implementation
34  */
35 
36 static hrt_stopwatch gsw;
37 
38 extern void
hrt_gsw_init(int cap)39 hrt_gsw_init(int cap)
40 {
41     hrt_sw_init(&gsw, cap);
42 }
43 
44 extern void
hrt_gsw_close(void)45 hrt_gsw_close(void)
46 {
47     hrt_sw_close(&gsw);
48 }
49 
50 extern int
hrt_gsw_top(void)51 hrt_gsw_top(void)
52 {
53     return hrt_sw_top(&gsw);
54 }
55 
56 extern int
hrt_gsw_capacity(void)57 hrt_gsw_capacity(void)
58 {
59     return hrt_sw_capacity(&gsw);
60 }
61 
62 extern int
hrt_gsw_pushmark(void)63 hrt_gsw_pushmark(void)
64 {
65     return hrt_sw_pushmark(&gsw);
66 }
67 
68 extern void
hrt_gsw_popmark(void)69 hrt_gsw_popmark(void)
70 {
71     hrt_sw_popmark(&gsw);
72 }
73 
74 extern double
hrt_gsw_rtmicros(int y,int x)75 hrt_gsw_rtmicros(int y, int x)
76 {
77     return hrt_sw_rtmicros(&gsw, y, x);
78 }
79 
80 extern double
hrt_gsw_ctmicros(int y,int x)81 hrt_gsw_ctmicros(int y, int x)
82 {
83     return hrt_sw_ctmicros(&gsw, y, x);
84 }
85 
86 extern void
hrt_gsw_clear(void)87 hrt_gsw_clear(void)
88 {
89     hrt_sw_clear(&gsw);
90 }
91