Skip to content

Commit

Permalink
vjmap 的sur区fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
calvin1978 committed Nov 12, 2018
1 parent 723d64a commit fec8808
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
16 changes: 11 additions & 5 deletions vjmap/src/main/java/com/vip/vjtools/vjmap/ResultPrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ public void printAllGens(PrintStream tty, List<ClassStats> list, boolean orderBy

}
}
tty.printf(" Total: %7d/%7s , min size=%d%n", totalCount, FormatUtils.toFloatUnit(totalSize), minSize);
tty.printf(" Total: %7d/%7s , minSize=%d%n", totalCount, FormatUtils.toFloatUnit(totalSize), minSize);
}

/**
* 打印只包含存活区的结果
*/
public void printSurvivor(PrintStream tty, List<ClassStats> list, boolean orderByName, long minSize, int minAge) {
public void printSurvivor(PrintStream tty, List<ClassStats> list, boolean orderByName, long minSize, int age,
int minAge) {
if (orderByName) {
Collections.sort(list, ClassStats.NAME_COMPARATOR);
} else {
Expand All @@ -77,8 +78,13 @@ public void printSurvivor(PrintStream tty, List<ClassStats> list, boolean orderB
}
}

tty.printf(" Total: %7d %7s, min age=%d, min size=%d%n", totalSurCount, FormatUtils.toFloatUnit(totalSurSize),
minAge, minSize);
if (age != -1) {
tty.printf(" Total: %7d %7s, age=%d, minSize=%d%n", totalSurCount, FormatUtils.toFloatUnit(totalSurSize),
age, minSize);
} else {
tty.printf(" Total: %7d %7s, minAge=%d, minSize=%d%n", totalSurCount, FormatUtils.toFloatUnit(totalSurSize),
minAge, minSize);
}
}

/**
Expand Down Expand Up @@ -110,7 +116,7 @@ public void printOldGen(PrintStream tty, List<ClassStats> list, boolean orderByN
}
}

tty.printf(" Total: %7d %7s, min size=%d%n", totalOldCount, FormatUtils.toFloatUnit(totalOldSize), minSize);
tty.printf(" Total: %7d %7s, minSize=%d%n", totalOldCount, FormatUtils.toFloatUnit(totalOldSize), minSize);
}

}
2 changes: 1 addition & 1 deletion vjmap/src/main/java/com/vip/vjtools/vjmap/VJMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static void runSurviorAccessor(int age, int minAge, boolean orderByName,
List<ClassStats> list = accessor.caculateHistogram(age, minAge);

ResultPrinter resultPrinter = new ResultPrinter();
resultPrinter.printSurvivor(tty, list, orderByName, minSize, minAge);
resultPrinter.printSurvivor(tty, list, orderByName, minSize, age, minAge);
}

public static void runOldGenAccessor(boolean orderByName, long minSize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public List<ClassStats> caculateHistogram(int excactAge, int minAge) {

tty.printf("%n#age #count #bytes%n");

for (int i = 0; i <= maxAge; i++) {
for (int i = 1; i <= maxAge; i++) {
tty.printf("%3d: %9d %7s%n", i, ageCount[i], FormatUtils.toFloatUnit(ageSize[i]));
}

Expand Down

0 comments on commit fec8808

Please sign in to comment.