Omaha #3093 add usage to hprof tool and standardize outputting size of things.

Former-commit-id: 7fd433be3f94ac37e644d12623af36bf4092ab3c
This commit is contained in:
Ben Steffensmeier 2014-05-22 15:56:18 -05:00
parent 341170eb05
commit c5abcecc61
7 changed files with 48 additions and 26 deletions

View file

@ -43,6 +43,8 @@ import com.raytheon.hprof.data.heap.dump.InstanceDump;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------- -------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Jan 08, 2014 2648 bsteffen Initial doc * Jan 08, 2014 2648 bsteffen Initial doc
* May 22, 2014 3093 bsteffen Add printMB, printKB
*
* *
* </pre> * </pre>
* *
@ -100,6 +102,14 @@ public abstract class AbstractExporter {
print(output + "\n"); print(output + "\n");
} }
protected void printMB(String desc, long bytes) throws IOException {
print(desc + (bytes / 1024 / 1024) + "MB\n");
}
protected void printKB(String desc, long bytes) throws IOException {
print(desc + (bytes / 1024) + "KB\n");
}
protected void close() { protected void close() {
if (writer != null) { if (writer != null) {
try { try {

View file

@ -41,6 +41,7 @@ import com.raytheon.hprof.SmartInstance;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------- -------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* May 05, 2014 3093 bsteffen Initial creation * May 05, 2014 3093 bsteffen Initial creation
* May 22, 2014 3093 bsteffen Use printMB, printKB
* *
* </pre> * </pre>
* *
@ -105,7 +106,7 @@ public class CacheObjectExporter extends RequestableResourceExporter {
+ cse.getValue()); + cse.getValue());
} }
println(" total size(bytes) = " + (total / 1024 / 1024) + "MB"); printMB(" total size = ", total);
println("}"); println("}");
} }
} }

View file

@ -49,8 +49,26 @@ public class CaveExporter {
public static void main(String[] args) { public static void main(String[] args) {
if (args.length < 1) { if (args.length < 1) {
System.out.println("SUMMARY:");
System.out System.out
.println("Provide some args, an hprof file is required, an output directory is optional."); .println(" Analyze an hprof file and gneerate text files with information that can be");
System.out.println(" useful for diagnosing problems with cave.");
System.out.println("USAGE:");
System.out
.println(" java -jar com.raytheon.uf.viz.hprof-....jar [-zero] <hprofFile> <outputDir>");
System.out.println("ARGUMENTS:");
System.out
.println(" -zero when this is provided all primitive arrays except char[] are ");
System.out
.println(" replaced with zero so the file can be compressed much smaller.");
System.out
.println(" This will modify the file in place and even still generates the");
System.out.println(" text files");
System.out
.println(" hprofFile the name/path to the hprof file");
System.out
.println(" outputDir the name/path to a directory where text files are written");
System.exit(1); System.exit(1);
} }
int argIdx = 0; int argIdx = 0;

View file

@ -46,6 +46,7 @@ import com.raytheon.hprof.SmartInstance;
* ------------- -------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Jan 08, 2014 2648 bsteffen Initial doc * Jan 08, 2014 2648 bsteffen Initial doc
* May 05, 2014 3093 bsteffen Track sizes as longs. * May 05, 2014 3093 bsteffen Track sizes as longs.
* May 22, 2014 3093 bsteffen Use printMB, printKB
* *
* </pre> * </pre>
* *
@ -179,19 +180,13 @@ public class D2DGridResourceExporter extends RequestableResourceExporter {
/* heap dump is from after 14.2 */ /* heap dump is from after 14.2 */
} }
long floats = entry.getValue(); long floats = entry.getValue();
long size = floats * 4 / 1024; printKB(resource.toString() + modHint.toString() + " uses is ",
String suffix = "KB"; floats * 4);
if (size > 1024) {
size /= 1024;
suffix = "MB";
}
println(resource.toString() + modHint.toString() + " uses is "
+ size + suffix);
totalFloats += floats; totalFloats += floats;
} }
println("# Section 4 total size of all resources."); println("# Section 4 total size of all resources.");
println("Total memory usage for " + resources.size() printMB("Total memory usage for " + resources.size()
+ " resources is " + totalFloats * 4 / 1024 / 1024 + "MB"); + " resources is ", totalFloats * 4);
} }
private static class GeneralGridDataInstance { private static class GeneralGridDataInstance {

View file

@ -42,6 +42,7 @@ import com.raytheon.hprof.data.heap.dump.ClassDump;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------- -------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Jan 08, 2014 2648 bsteffen Initial doc * Jan 08, 2014 2648 bsteffen Initial doc
* May 22, 2014 3093 bsteffen Use printMB, printKB
* *
* </pre> * </pre>
* *
@ -94,10 +95,10 @@ public class GLInfoExporter extends AbstractExporter {
long memMax = memoryCache.getLong("maxSize"); long memMax = memoryCache.getLong("maxSize");
long texUsed = textureCache.getLong("curSize"); long texUsed = textureCache.getLong("curSize");
long texMax = textureCache.getLong("maxSize"); long texMax = textureCache.getLong("maxSize");
println("RAM texture cache using " + (memUsed / 1024 / 1024) + "MB of " printMB("RAM texture cache using ", memUsed);
+ (memMax / 1024 / 1024) + "MB"); printMB("RAM texture cache available is ", memMax);
println("GL texture cache using " + (texUsed / 1024 / 1024) + "MB of " printMB("GL texture cache using ", texUsed);
+ (texMax / 1024 / 1024) + "MB"); printMB("GL texture cache available is ", texMax);
List<SmartInstance> geoms = getInstances("com.raytheon.viz.core.gl.GLGeometryObject2D"); List<SmartInstance> geoms = getInstances("com.raytheon.viz.core.gl.GLGeometryObject2D");
int coords = 0; int coords = 0;
for (SmartInstance geom : geoms) { for (SmartInstance geom : geoms) {
@ -109,8 +110,7 @@ public class GLInfoExporter extends AbstractExporter {
} }
} }
} }
println("GL vbo size(estimate) is " + (coords * 2 * 4 / 1024 / 1024) printMB("GL vbo size(estimate) is ", coords * 2 * 4);
+ "MB");
} }
} }

View file

@ -99,15 +99,13 @@ public class GridRequestableDataFactoryExporter extends
} }
} }
totalSize += size; totalSize += size;
println(" Soft Referenced Memory = " + (size / 1024) + "KB"); printKB(" Soft Referenced Memory = ", size);
println("}"); println("}");
} }
} }
if (totalSize > 0) { if (totalSize > 0) {
println("Total Soft Referenced Memory = " printMB("Total Soft Referenced Memory = ", totalSize);
+ (totalSize / 1024 / 1024)
+ "MB");
} }
} }

View file

@ -40,6 +40,7 @@ import com.raytheon.hprof.SmartInstance;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------- -------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* May 05, 2014 3093 bsteffen Initial creation * May 05, 2014 3093 bsteffen Initial creation
* May 22, 2014 3093 bsteffen Use printMB, printKB
* *
* </pre> * </pre>
* *
@ -114,17 +115,16 @@ public class RadarMosaicExporter extends RequestableResourceExporter {
for (SmartInstance record : recordMap.values()) { for (SmartInstance record : recordMap.values()) {
subrscSize += record.get("cacheObject").getInt("size"); subrscSize += record.get("cacheObject").getInt("size");
} }
println(" Mosaiced resource memory used = " printKB(" Mosaiced resource memory used = ", subrscSize);
+ (subrscSize / 1024) + "KB");
rscSize += subrscSize; rscSize += subrscSize;
println(" }"); println(" }");
} }
println(" Mosaic memory used = " + (rscSize / 1024 / 1024) + "MB"); printMB(" Mosaic memory used = ", rscSize);
totalSize += rscSize; totalSize += rscSize;
println("}"); println("}");
} }
println("# Section 4 total size of all mosaics."); println("# Section 4 total size of all mosaics.");
println("Total memory used = " + (totalSize / 1024 / 1024) + "MB"); printMB("Total memory used = ", totalSize);
} }