-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#6: Add mallinfo() statistics support to command line version
- Loading branch information
Showing
6 changed files
with
76 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package jdump.dump; | ||
|
||
import com.sun.tools.attach.AgentInitializationException; | ||
import com.sun.tools.attach.AgentLoadException; | ||
import com.sun.tools.attach.AttachNotSupportedException; | ||
import com.sun.tools.attach.VirtualMachineDescriptor; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
public class MallInfoDump extends HotspotDump { | ||
final Configuration configuration; | ||
|
||
|
||
public MallInfoDump(Configuration configuration) { | ||
this.configuration = configuration; | ||
} | ||
|
||
|
||
@Override | ||
void performFor(VirtualMachineDescriptor vmd) { | ||
try { | ||
Attach.to(vmd); | ||
} catch (IOException | AttachNotSupportedException e) { | ||
throw new RuntimeException("Could not attach to JVM " + vmd.id()); | ||
} | ||
try { | ||
System.out.println("Dumping mallinfo() statistics for JVM " + vmd.id()); | ||
Attach.loadAgent(vmd, configuration.outputDirectory() + File.separator + filenameFor(vmd)); | ||
} catch (AgentLoadException | IOException | AgentInitializationException e) { | ||
throw new RuntimeException("Failed to load agent: " + e); | ||
} | ||
} | ||
|
||
@Override | ||
String filenameFor(VirtualMachineDescriptor vmd) { | ||
return "jdump-mallinfo-" + vmd.id() + ".txt"; | ||
} | ||
} |