Run a single query to produce a report in batch mode.
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.
Argument | Description |
---|---|
-command | The command line version of the query to be run. This is like the text typed into the 'Search Queries' query browser command line. |
other report options | See batch mode control of report options |
A report holding the result of the query (by default, in HTML).
.\mat\ParseHeapDump.bat
myheapdump.hprof
-command=histogram
org.eclipse.mat.api:query
./mat/ParseHeapDump.sh
myheapdump.hprof
-command=histogram
org.eclipse.mat.api:query
.\mat\ParseHeapDump.bat
myheapdump.hprof
-command=histogram
-format=txt
-unzip
org.eclipse.mat.api:query
./mat/ParseHeapDump.sh
myheapdump.hprof
-command=histogram
-format=txt
-unzip
org.eclipse.mat.api:query
.\mat\ParseHeapDump.bat
myheapdump.hprof
"-command=oql \\\"SELECT * FROM java.lang.String s\\\""
org.eclipse.mat.api:query
./mat/ParseHeapDump.sh
myheapdump.hprof
"-command=oql \"SELECT * FROM java.lang.String s\""
org.eclipse.mat.api:query
.\mat\ParseHeapDump.bat
myheapdump.hprof
"-command=oql \\\"SELECT s AS Object, toString(s) AS \\\\\\\"String value\\\\\\\" FROM \\\\\\\"java.lang.String.*\\\\\\\" s WHERE toString(s) LIKE \\\\\\\".*\\..*\\\\\\\" AND s.hash ^^^> 0\\\""
org.eclipse.mat.api:query
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 [
matches()
method and build the pattern using a string concatenation using character quote holding a double quote.
./mat/ParseHeapDump.sh
myheapdump.hprof
"-command=oql \"select s as \\\"a b\\\" from \\\"java.lang.String.*\\\" WHERE toString(s) LIKE \\\".*\\\..*\\\" AND s.hash > 0\""
org.eclipse.mat.api:query
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
matches()
method and build the pattern using a string concatenation using character quote holding a double quote.