提交 337d3aa4 authored 作者: Thomas Mueller's avatar Thomas Mueller

Slightly improved output

上级 404d2456
...@@ -256,6 +256,7 @@ public class MVStoreTool { ...@@ -256,6 +256,7 @@ public class MVStoreTool {
} }
} }
} }
pageSizeSum = Math.max(1, pageSizeSum);
for (Integer mapId : mapSizes.keySet()) { for (Integer mapId : mapSizes.keySet()) {
int percent = 100 * mapSizes.get(mapId) / pageSizeSum; int percent = 100 * mapSizes.get(mapId) / pageSizeSum;
pw.printf("map %x: %d bytes, %d%%%n", mapId, mapSizes.get(mapId), percent); pw.printf("map %x: %d bytes, %d%%%n", mapId, mapSizes.get(mapId), percent);
...@@ -275,8 +276,10 @@ public class MVStoreTool { ...@@ -275,8 +276,10 @@ public class MVStoreTool {
} }
pw.printf("%n%0" + len + "x eof%n", fileSize); pw.printf("%n%0" + len + "x eof%n", fileSize);
pw.printf("\n"); pw.printf("\n");
pageCount = Math.max(1, pageCount);
pw.printf("page size total: %d bytes, page count: %d, average page size: %d bytes\n", pw.printf("page size total: %d bytes, page count: %d, average page size: %d bytes\n",
pageSizeTotal, pageCount, pageSizeTotal / pageCount); pageSizeTotal, pageCount, pageSizeTotal / pageCount);
pageSizeTotal = Math.max(1, pageSizeTotal);
for (Integer mapId : mapSizesTotal.keySet()) { for (Integer mapId : mapSizesTotal.keySet()) {
int percent = (int) (100 * mapSizesTotal.get(mapId) / pageSizeTotal); int percent = (int) (100 * mapSizesTotal.get(mapId) / pageSizeTotal);
pw.printf("map %x: %d bytes, %d%%%n", mapId, mapSizesTotal.get(mapId), percent); pw.printf("map %x: %d bytes, %d%%%n", mapId, mapSizesTotal.get(mapId), percent);
...@@ -384,7 +387,7 @@ public class MVStoreTool { ...@@ -384,7 +387,7 @@ public class MVStoreTool {
} else if (value == max) { } else if (value == max) {
return 100; return 100;
} }
return (int) (1 + 98 * value / max); return (int) (1 + 98 * value / Math.max(1, max));
} }
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论