parse memory snapshot hprof index files programmatically
Asked Answered
N

1

11

I am trying to programmatically analyze an hprof file. Using the hprof-conv tool in the android-sdk I generated a bunch of com.your.package.index files.

How do I programmatically parse these .index files?

I want run some custom analysis on the dominator tree, which is easy to do through MAT (Eclipse's Memory Analyser) manually but want to do it in an automated way.

Nitrogenous answered 12/4, 2013 at 19:56 Comment(3)
For those encountering this question, here is the OP's earlier question as background: #15978223Blindage
Is hacking the Mat plugin source at option for you? I looked through the source and didn't see any "Dominator tree" though?Bannister
@Bannister I'm not sure you looked hard enough. That doesn't look as terrible to adapt as it could. The SnapshotImpl given as input looks like where the file's read in.Georgetown
P
2

You can try using the MAT from command lines and generate custom reports (dominator tree). In this you can either filter using the XML that can be used to generate the report or parse the report via a external code.

Refer: http://www.eclipse.org/forums/index.php/t/489594/

The above link should guide you through this task...

Palisade answered 20/11, 2013 at 5:54 Comment(2)
please mention that how it will analyse automatically using this tool.Hackberry
There are several ways of doing this, you can watch the hprof directory using file monitors in the java 7 NIO and trigger the MAT using the above comment. For folder monitoring code look: javapapers.com/core-java/monitor-a-folder-using-javaPalisade

© 2022 - 2024 — McMap. All rights reserved.