Command Line processing of hprof [message #1065652] |
Wed, 26 June 2013 23:28  |
Eclipse User |
|
|
|
Hi everyone,
I would like to be able to use MAT to process my hprof dumps headlessly through command line shell scripts. The main features that I am looking for are outputting the histogram and dominator trees in csv format (which i have achieved using a rudimentary report xml modified from the built-in overview report); a dynamically generated output based on the input OQL command, ie: <shell script> <path_to_hprof> <OQL query>; and also a diff between different versions of hprof files.
There are still gaping holes in my knowledge, for instance, how do command line inputs get mapped into the query classes arguments, whether report xmls are extensible beyond the very basic as examplified by the built-in reports overview, suspects and top_components, and the more intricate relationships between query classes and the results they output.
Also I can't seem to get the dropins folder to make MAT recognize my custom plugin from command line calls. Perhaps I have put them in the wrong place (mat root folder)?
Thank you in advance.
Cheers,
Yu Yang Lai
|
|
|
|
Re: Command Line processing of hprof [message #1068073 is a reply to message #1067930] |
Thu, 11 July 2013 23:17   |
Eclipse User |
|
|
|
Hi Andrew,
Thanks for the reply! I managed to run org.eclipse.mat.api on custom reports by pointing the command to the xml file path, without having to write any plugin extensions. The output was in an inconvenient zip file format but nothing I can't remedy with a few lines of script. I also figured that I could run dynamic oql queries by generating the new xml report file on the fly, so that part is solved.
Now I have a new question: my dominator tree report outputs a csv file with the classname appended with an address and a whole bunch of stuffs which contains illegal characters (including commas) and thus is choking up my csv parser. Is there any way to turn off the appending of addresses and just include the class name (like the histogram report)? I included my dominator tree report as an attachment. Thank you so much for your time and attention.
Attachment: domtree.xml
(Size: 0.22KB, Downloaded 492 times)
|
|
|
|
|
Re: Command Line processing of hprof [message #1069290 is a reply to message #1068232] |
Mon, 15 July 2013 15:54   |
Eclipse User |
|
|
|
Running your query gives output as follows:
class sun.nio.cs.StandardCharsets @ 0x77cb7a4a0,304,8200,0.03488,
class java.util.Locale @ 0x77cbff7e8,232,6968,0.02964,
"java.lang.String @ 0x77cb92bd8 \u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000a\u000b\u000c\u000d\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !""#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_...",40,2416,0.01028,
class sun.jkernel.DownloadManager @ 0x77cb42bf8,328,2296,0.00977,
Can you parse fields with double quotes around (and commas or doubled double-quotes inside) ?
Do you want to open a bug for the trailing comma or CR instead of CR LF to end each line?
|
|
|
Re: Command Line processing of hprof [message #1069865 is a reply to message #1069290] |
Tue, 16 July 2013 19:10   |
Eclipse User |
|
|
|
At the moment I am using a shell script to parse the csv and thus its buggy when the classname contains all sorts of strange characters. The current plan is to build a better parser using python but that is pushed back in favour of more pressing projects.
As for opening a bug, it would be great, could you point me to the right place for it? Thanks.
|
|
|
Re: Command Line processing of hprof [message #1070615 is a reply to message #1069865] |
Thu, 18 July 2013 10:15   |
Eclipse User |
|
|
|
There's a link for reporting a bug on the left hand side of the Memory Analyzer home page.
The dominator tree CSV does not have illegal characters (comma) as they are protected by double quotes, but parsing may be a bit more difficult. One idea is to note that only the first field might have internal commas and double quotes, so reverse the line, parse the field, then reverse back.
E.g. something like:
rev domtree.csv | cut -d , -f 5- | rev
If we fix the trailing comma in MAT then this might need a slight change.
|
|
|
Re: Command Line processing of hprof [message #1070793 is a reply to message #1070615] |
Thu, 18 July 2013 17:33   |
Eclipse User |
|
|
|
Thanks, parsing from the back solved >99% of the parsing errors, but I'll get back to you after I tried my python script thanks.
P.S. Any plans to make a more full featured support for CLI commands? Like OQL and diffs etc. That would be great. Thanks.
|
|
|
|
Re: Command Line processing of hprof [message #1102635 is a reply to message #1067930] |
Fri, 06 September 2013 00:23   |
Eclipse User |
|
|
|
Hi,
I would also like to run on the command line to parse large hepas with long running oql.
I read the help link referenced by Andrew and see the two items taht must be added to separate files....
However where does the report.xsd file reside?
Regards
John
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07139 seconds