Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/jdk17u
Path: blob/master/src/hotspot/share/jfr/dcmd/jfrDcmds.hpp
66644 views
1
/*
2
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*
23
*/
24
25
#ifndef SHARE_JFR_DCMD_JFRDCMDS_HPP
26
#define SHARE_JFR_DCMD_JFRDCMDS_HPP
27
28
#include "services/diagnosticCommand.hpp"
29
class JfrJavaArguments;
30
31
class JfrDCmd : public DCmd {
32
private:
33
const char* _args;
34
const int _num_arguments;
35
char _delimiter;
36
protected:
37
JfrDCmd(outputStream* output, bool heap, int num_arguments);
38
virtual const char* javaClass() const = 0;
39
void invoke(JfrJavaArguments& method, TRAPS) const;
40
public:
41
virtual void execute(DCmdSource source, TRAPS);
42
virtual void print_help(const char* name) const;
43
virtual GrowableArray<const char*>* argument_name_array() const;
44
virtual GrowableArray<DCmdArgumentInfo*>* argument_info_array() const;
45
virtual void parse(CmdLine* line, char delim, TRAPS);
46
};
47
48
class JfrStartFlightRecordingDCmd : public JfrDCmd {
49
public:
50
JfrStartFlightRecordingDCmd(outputStream* output, bool heap) : JfrDCmd(output, heap, num_arguments()) {}
51
52
static const char* name() {
53
return "JFR.start";
54
}
55
static const char* description() {
56
return "Starts a new JFR recording";
57
}
58
static const char* impact() {
59
return "Medium: Depending on the settings for a recording, the impact can range from low to high.";
60
}
61
static const JavaPermission permission() {
62
JavaPermission p = {"java.lang.management.ManagementPermission", "monitor", NULL};
63
return p;
64
}
65
virtual const char* javaClass() const {
66
return "jdk/jfr/internal/dcmd/DCmdStart";
67
}
68
static int num_arguments() {
69
return 11;
70
}
71
};
72
73
class JfrDumpFlightRecordingDCmd : public JfrDCmd {
74
public:
75
JfrDumpFlightRecordingDCmd(outputStream* output, bool heap) : JfrDCmd(output, heap, num_arguments()) {}
76
77
static const char* name() {
78
return "JFR.dump";
79
}
80
static const char* description() {
81
return "Copies contents of a JFR recording to file. Either the name or the recording id must be specified.";
82
}
83
static const char* impact() {
84
return "Low";
85
}
86
static const JavaPermission permission() {
87
JavaPermission p = {"java.lang.management.ManagementPermission", "monitor", NULL};
88
return p;
89
}
90
virtual const char* javaClass() const {
91
return "jdk/jfr/internal/dcmd/DCmdDump";
92
}
93
static int num_arguments() {
94
return 7;
95
}
96
};
97
98
class JfrCheckFlightRecordingDCmd : public JfrDCmd {
99
public:
100
JfrCheckFlightRecordingDCmd(outputStream* output, bool heap) : JfrDCmd(output, heap, num_arguments()) {}
101
102
static const char* name() {
103
return "JFR.check";
104
}
105
static const char* description() {
106
return "Checks running JFR recording(s)";
107
}
108
static const char* impact() {
109
return "Low";
110
}
111
static const JavaPermission permission() {
112
JavaPermission p = {"java.lang.management.ManagementPermission", "monitor", NULL};
113
return p;
114
}
115
virtual const char* javaClass() const {
116
return "jdk/jfr/internal/dcmd/DCmdCheck";
117
}
118
static int num_arguments() {
119
return 2;
120
}
121
};
122
123
class JfrStopFlightRecordingDCmd : public JfrDCmd {
124
public:
125
JfrStopFlightRecordingDCmd(outputStream* output, bool heap) : JfrDCmd(output, heap, num_arguments()) {}
126
127
static const char* name() {
128
return "JFR.stop";
129
}
130
static const char* description() {
131
return "Stops a JFR recording";
132
}
133
static const char* impact() {
134
return "Low";
135
}
136
static const JavaPermission permission() {
137
JavaPermission p = {"java.lang.management.ManagementPermission", "monitor", NULL};
138
return p;
139
}
140
virtual const char* javaClass() const {
141
return "jdk/jfr/internal/dcmd/DCmdStop";
142
}
143
static int num_arguments() {
144
return 2;
145
}
146
};
147
148
class JfrConfigureFlightRecorderDCmd : public DCmdWithParser {
149
friend class JfrOptionSet;
150
protected:
151
DCmdArgument<char*> _repository_path;
152
DCmdArgument<char*> _dump_path;
153
DCmdArgument<jlong> _stack_depth;
154
DCmdArgument<jlong> _global_buffer_count;
155
DCmdArgument<MemorySizeArgument> _global_buffer_size;
156
DCmdArgument<MemorySizeArgument> _thread_buffer_size;
157
DCmdArgument<MemorySizeArgument> _memory_size;
158
DCmdArgument<MemorySizeArgument> _max_chunk_size;
159
DCmdArgument<bool> _sample_threads;
160
bool _verbose;
161
162
public:
163
JfrConfigureFlightRecorderDCmd(outputStream* output, bool heap);
164
void set_verbose(bool verbose) {
165
_verbose = verbose;
166
}
167
static const char* name() {
168
return "JFR.configure";
169
}
170
static const char* description() {
171
return "Configure JFR";
172
}
173
static const char* impact() {
174
return "Low";
175
}
176
static const JavaPermission permission() {
177
JavaPermission p = {"java.lang.management.ManagementPermission", "monitor", NULL};
178
return p;
179
}
180
static int num_arguments();
181
virtual void execute(DCmdSource source, TRAPS);
182
virtual void print_help(const char* name) const;
183
};
184
185
186
bool register_jfr_dcmds();
187
188
#endif // SHARE_JFR_DCMD_JFRDCMDS_HPP
189
190