-
Notifications
You must be signed in to change notification settings - Fork 7
/
query_report.dita
235 lines (232 loc) · 9.67 KB
/
query_report.dita
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2019,2020 IBM Corporation. All rights reserved. This program
and the accompanying materials are made available under the terms of the
Eclipse Public License v1.0 which accompanies this distribution, and is available
at http://www.eclipse.org/legal/epl-v10.html Contributors: Andrew Johnson/IBM
- initial API and implementation -->
<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd" >
<reference id="ref_query_report" xml:lang="en-us">
<title>Query Report</title>
<shortdesc>Run a single query to produce a HTML report in batch mode.
</shortdesc>
<prolog>
<copyright>
<copyryear year=""></copyryear>
<copyrholder>
Copyright (c) 2020 IBM Corporation.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
</copyrholder>
</copyright>
</prolog>
<refbody>
<section>
<title>Motivation</title>
<p>Sometime it is useful to run a single query on a heap dump when in
batch mode. This could be because it is known in advance what needs
to be
run, or the heap dump needs to remain on a big machine with no easily
available graphical user interface.
</p>
</section>
<section>
<title>Arguments</title>
<simpletable>
<sthead>
<stentry>Argument</stentry>
<stentry>Description</stentry>
</sthead>
<strow>
<stentry>-command</stentry>
<stentry>The command line version of the query to be run. This
is like the text typed into the <xref format="dita" href="../selectingqueries.dita">'Search Queries' query browser</xref> command line.
</stentry>
</strow>
<strow>
<stentry>other report options</stentry>
<stentry>See <xref format="dita" href="../../tasks/batch.dita#task_batch__report_options">batch mode control of report options</xref></stentry>
</strow>
</simpletable>
</section>
<section id="result">
<title>Result</title>
<p>An HTML report holding the result of the query.</p>
</section>
<example platform="windows">
<p>Simple example of a histogram for Windows</p>
<p>
<codeph>
<cmdname>./mat/ParseHeapDump.bat</cmdname>
<varname>myheapdump.hprof</varname>
<option>-command=</option><cmdname>histogram</cmdname>
<parmname>org.eclipse.mat.api:query</parmname>
</codeph>
</p>
</example>
<example platform="linux">
<p>Simple example of a histogram for Linux</p>
<p>
<codeph>
<cmdname>./mat/ParseHeapDump.sh</cmdname>
<varname>myheapdump.hprof</varname>
<option>-command=</option><cmdname>histogram</cmdname>
<parmname>org.eclipse.mat.api:query</parmname>
</codeph>
</p>
</example>
<example platform="windows">
<p>Simple OQL example for Windows</p>
<p>
<codeph>
<cmdname>./mat/ParseHeapDump.bat</cmdname>
<varname>myheapdump.hprof</varname>
"<option>-command=</option><cmdname>oql</cmdname> <varname>\\\"SELECT * FROM java.lang.String s\\\"</varname>"
<parmname>org.eclipse.mat.api:query</parmname>
</codeph>
<note>The OQL query <cmdname>oql</cmdname> has the actual OQL statement surrounded by
double quotes. These need to be escaped here as shown.
The whole of the command option must be passed to Eclipse Memory Analyzer as a single argument
starting with <option>-command</option>. As the query command has spaces the
whole argument is surrounded by double quotes so the operating system
treats it as a single item.</note>
</p>
</example>
<example platform="linux">
<p>Simple OQL example for Linux</p>
<p>
<codeph>
<cmdname>./mat/ParseHeapDump.sh</cmdname>
<varname>myheapdump.hprof</varname>
"<option>-command=</option><cmdname>oql</cmdname> <varname>\"SELECT * FROM java.lang.String s\"</varname>"
<parmname>org.eclipse.mat.api:query</parmname>
</codeph>
<note>The OQL query <cmdname>oql</cmdname> has the actual OQL statement surrounded by
double quotes. These need to be escaped here as shown.
The whole of the command option must be passed to Eclipse Memory Analyzer as a single argument
starting with <option>-command</option>. As the query command has spaces the
whole argument is surrounded by double quotes so the operating system
treats it as a single item.</note>
</p>
</example>
<example platform="windows">
<p>Another OQL example for Windows</p>
<p>
<codeph>
<cmdname>./mat/ParseHeapDump.bat</cmdname>
<varname>myheapdump.hprof</varname>
"<option>-command=</option><cmdname>oql</cmdname> <varname>\\\"SELECT s AS Object, toString(s) AS \\\\\\\"String value\\\\\\\" FROM \\\\\\\"java.lang.String.*\\\\\\\" s WHERE toString(s) LIKE \\\\\\\".*\\..*\\\\\\\" AND s.hash ^^^> 0\\\"</varname>
<parmname>org.eclipse.mat.api:query</parmname>
</codeph>
<msgblock>
Task: Reopening parsed heap dump file
[.........]
Subtask: Query
[
Subtask: Test 'Query command' of section 'Query'
[
Subtask: SELECT s AS Object, toString(s) AS "String value" FROM "java.lang.String.*" s WHERE ((toString(s) LIKE ".*\..*") and (s.hash > 0))
[
Subtask: Collecting objects of classes
[
Subtask: Checking class java.lang.StringConcatHelper
[
Subtask: Checking class java.lang.String[][]
[
Subtask: Checking class java.lang.StringLatin1
[
Subtask: Checking class java.lang.StringCoding$Result
[
Subtask: Checking class java.lang.StringBuilder
[
Subtask: Checking class java.lang.String$CaseInsensitiveComparator
[
Subtask: Checking class java.lang.StringCoding$1
[
Subtask: Checking class java.lang.String[]
[
Subtask: Checking class java.lang.StringCoding
[
Subtask: Checking class java.lang.String
[
</msgblock>
<note>The OQL query <cmdname>oql</cmdname> has the actual OQL statement surrounded by
double quotes. These need to be escaped here as shown.
The whole of the command option must be passed to Eclipse Memory Analyzer as a single argument
starting with <option>-command</option>. As the query command has spaces the
whole argument is surrounded by double quotes so the operating system
treats it as a single item.
Any double quotes in the OQL statement need 7 backslashes before.
The greater-than sign > needs to be escaped with 3 carets ^^^ as it appears
to be outside of double-quotes to the Windows command line interpreter and so
would be misinterpreted as a redirect.
A backslash in the OQL statement needs to be doubled.
There are no character escapes in OQL string literals.
It is not therefore possible to add a double quote to a <cmdname>SELECT</cmdname>
<cmdname>AS</cmdname> column name. It makes no sense to add it to a
class pattern for a <cmdname>FROM</cmdname> item.
It is not possible to add a double quote to a <cmdname>LIKE</cmdname>
regular expression string literal. It would be possible to use the <codeph>matches()</codeph>
method and build the pattern using a string concatenation using character quote holding a double quote.
</note>
</p>
</example>
<example platform="linux">
<p>Another OQL example for Linux</p>
<p>
<codeph>
<cmdname>./mat/ParseHeapDump.sh</cmdname>
<varname>myheapdump.hprof</varname>
"<option>-command=</option><cmdname>oql</cmdname> <varname>\"select s as \\\"a b\\\" from \\\"java.lang.String.*\\\" WHERE toString(s) LIKE \\\".*\\\..*\\\" AND s.hash > 0\"</varname>
<parmname>org.eclipse.mat.api:query</parmname>
</codeph>
<msgblock>
Task: Reopening parsed heap dump file
[.........]
Subtask: Single Query
[
Subtask: Test 'Query Command' of section 'Single Query'
[
Subtask: SELECT s AS Object, toString(s) AS "String value" FROM "java.lang.String.*" s WHERE ((toString(s) LIKE ".*\..*") and (s.hash > 0))
[
Subtask: Collecting objects of classes
[
Subtask: Checking class java.lang.String[]
[
Subtask: Checking class java.lang.String[][]
[
Subtask: Checking class java.lang.String$CaseInsensitiveComparator
[
Subtask: Checking class java.lang.StringCoding$StringEncoder
[
Subtask: Checking class java.lang.StringCoding
[
Subtask: Checking class java.lang.StringBuffer
[
Subtask: Checking class java.lang.StringBuilder
[
Subtask: Checking class java.lang.String
[
Subtask: Checking class java.lang.StringCoding$StringDecoder
</msgblock>
<note>The OQL query <cmdname>oql</cmdname> has the actual OQL statement surrounded by
double quotes. These need to be escaped here as shown.
The whole of the command option must be passed to Eclipse Memory Analyzer as a single argument
starting with <option>-command</option>. As the query command has spaces the
whole argument is surrounded by double quotes so the operating system
treats it as a single item.
Any double quotes in the OQL statement need 3 backslashes before.
A backslash in the OQL statement needs to be doubled.
There are no character escapes in OQL string literals.
It is not therefore possible to add a double quote to a <cmdname>SELECT</cmdname>
<cmdname>AS</cmdname> column name. It makes no sense to add it to a
class pattern for a <cmdname>FROM</cmdname> item.
It is not possible to add a double quote to a <cmdname>LIKE</cmdname>
regular expression string literal. It would be possible to use the <codeph>matches()</codeph>
method and build the pattern using a string concatenation using character quote holding a double quote.
</note>
</p>
</example>
</refbody>
</reference>