Skip to content

8269685: Optimize HeapHprofBinWriter implementation #4666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 13 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void prologue(long usedSize) {

public boolean doObj(Oop oop) {
try {
writeHeapRecordPrologue();
writeHeapRecordPrologue(calculateOopDumpRecordSize(oop));
if (oop instanceof TypeArray) {
writePrimitiveArray((TypeArray)oop);
} else if (oop instanceof ObjArray) {
Expand Down Expand Up @@ -127,6 +127,8 @@ public void epilogue() {
}
}

abstract protected int calculateOopDumpRecordSize(Oop oop) throws IOException;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Lin,
I don't like these empty methods in this abstract class.
Should they be just abstract instead?
Thanks,
Serguei

protected void writeJavaThreads() throws IOException {
Threads threads = VM.getVM().getThreads();
for (int i = 0; i < threads.getNumberOfThreads(); i++) {
Expand Down Expand Up @@ -420,6 +422,9 @@ protected void writeHeapFooter() throws IOException {
protected void writeHeapRecordPrologue() throws IOException {
}

protected void writeHeapRecordPrologue(int size) throws IOException {
}

protected void writeHeapRecordEpilogue() throws IOException {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ protected void writeHeapFooter() throws IOException {
out.println("</gxl>");
}

@Override
protected int calculateOopDumpRecordSize(Oop oop) throws IOException {
return 0;
}

//-- Internals only below this point

// Java identifier to XML NMTOKEN type string
Expand Down
Loading