Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Memory Analyzer » How to write MAT Custom Reports?(Where is the documentation for writing custom reports with the intent of running them using ParseHeapDump.sh)
How to write MAT Custom Reports? [message #1798391] Fri, 16 November 2018 16:04 Go to next message
Mark Malynn is currently offline Mark MalynnFriend
Messages: 2
Registered: November 2018
Junior Member
Reading the MemoryAnalyzer FAQ, I learned of the ParseHeapDump.sh script and figured out how to run the canned reports (e.g., the suspects report).

I found javadoc for the report package that implies I could write an xml report definition to run a custom report, but could find no documentation about how to do it. I couldn't even find the xml schema it uses.

Any help would be greatly appreciated.

Thanks
Re: How to write MAT Custom Reports? [message #1798788 is a reply to message #1798391] Sat, 24 November 2018 21:05 Go to previous messageGo to next message
Andrew Johnson is currently offline Andrew JohnsonFriend
Messages: 205
Registered: July 2009
Senior Member
I've been considering this recently but haven't written any more documentation other than adding some JavaDoc and updating the schema.

An example report suspects.xml might help you too.

A 'section' is part of the report - either a possibly collapsible section or a separate file. A 'template' is a way of adding another report. A 'queryspec' actually runs a command. [You can also test running commands from a command line using the search queries menu.]

Reports can be controlled by a 'param' - there are several ones defined and documented in the Params Javadoc. The latest builds have some updates to the Javadoc.

The params can be used to control generation of tables - as HTML or CSV files, and to omit, sort or filter columns. Some params just control the current section - some also control any inner sections unless overridden.

A param can also be used elsewhere in the report as ${param_name} - in the command name and other param values.

I have been considering how to make reports more flexible. One idea is to allow params to be set on the command line - as:
ParseHeapDump mydump.hprof -myopt=myvalue MyNewReport.xml


where the option is set before the report in the command line. This is still experimental as I'd like some feedback on if it is useful. I used it for the new export HProf report. The ParseHeapDump options have an equals sign - but queries don't, so be careful.

I'm also considering how to deal with multiple snapshots and comparisons. One way is to define the secondary snapshot as an argument to a query, then pass it into the report.
E.g.
    @Argument(advice = Advice.SECONDARY_SNAPSHOT)
    public ISnapshot snapshot2;


delta_histogram -snapshot2 "myseconddump.hprof"


in a report as

<queryspec name="Compare">
  <param name="snapshot2" value="defaultsnapshot.hprof" />
   <command>delta_histogram -snapshot2 ${snapshot2}</command>
</queryspec>


and run as
ParseHeapDump dump1.hprof -snapshot2=myseconddump.hprof compare.xml


That's not very flexible, especially as there are inbuilt compare queries. Perhaps the param name could be employed in a future MAT. Defining it might define the current snapshot for queries. I'm not clear how to prove tables as inputs to the compare query. Possibly as <spec> sections inside a queryspec. They could then be made available to queries with IResultTable/IResultTree arguments.

Do have a go at writing some queries - and let us know what works and what doesn't.
Re: How to write MAT Custom Reports? [message #1800006 is a reply to message #1798788] Tue, 18 December 2018 19:22 Go to previous message
Mark Malynn is currently offline Mark MalynnFriend
Messages: 2
Registered: November 2018
Junior Member
Thanks for your detailed reply. Currently, the histogram output in csv format with a limit of 1000 was all that I needed. Hence, tweaking the overview.xml report was all that I needed.

I will bookmark this thread just in case I have a tougher memory issue and need to do snapshot comparisons.

Thanks again.
Previous Topic:Meaning of Overview->Details->Size
Next Topic:cannot load hprof file with heap dump error
Goto Forum:
  


Current Time: Thu Apr 18 17:02:20 GMT 2024

Powered by FUDForum. Page generated in 0.01988 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top