diff --git a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/AbstractExporter.java b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/AbstractExporter.java index 57d3bfd8f6..0d27916600 100644 --- a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/AbstractExporter.java +++ b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/AbstractExporter.java @@ -43,6 +43,8 @@ import com.raytheon.hprof.data.heap.dump.InstanceDump; * Date Ticket# Engineer Description * ------------- -------- ----------- -------------------------- * Jan 08, 2014 2648 bsteffen Initial doc + * May 22, 2014 3093 bsteffen Add printMB, printKB + * * * * @@ -100,6 +102,14 @@ public abstract class AbstractExporter { 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() { if (writer != null) { try { diff --git a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/CacheObjectExporter.java b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/CacheObjectExporter.java index 9479ad0f61..11e631b0d4 100644 --- a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/CacheObjectExporter.java +++ b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/CacheObjectExporter.java @@ -41,6 +41,7 @@ import com.raytheon.hprof.SmartInstance; * Date Ticket# Engineer Description * ------------- -------- ----------- -------------------------- * May 05, 2014 3093 bsteffen Initial creation + * May 22, 2014 3093 bsteffen Use printMB, printKB * * * @@ -105,7 +106,7 @@ public class CacheObjectExporter extends RequestableResourceExporter { + cse.getValue()); } - println(" total size(bytes) = " + (total / 1024 / 1024) + "MB"); + printMB(" total size = ", total); println("}"); } } diff --git a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/CaveExporter.java b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/CaveExporter.java index 9da9462837..08616c5844 100644 --- a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/CaveExporter.java +++ b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/CaveExporter.java @@ -49,8 +49,26 @@ public class CaveExporter { public static void main(String[] args) { if (args.length < 1) { + System.out.println("SUMMARY:"); 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] "); + 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); } int argIdx = 0; diff --git a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/D2DGridResourceExporter.java b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/D2DGridResourceExporter.java index 08e74683be..54fa5d3bc2 100644 --- a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/D2DGridResourceExporter.java +++ b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/D2DGridResourceExporter.java @@ -46,6 +46,7 @@ import com.raytheon.hprof.SmartInstance; * ------------- -------- ----------- -------------------------- * Jan 08, 2014 2648 bsteffen Initial doc * May 05, 2014 3093 bsteffen Track sizes as longs. + * May 22, 2014 3093 bsteffen Use printMB, printKB * * * @@ -179,19 +180,13 @@ public class D2DGridResourceExporter extends RequestableResourceExporter { /* heap dump is from after 14.2 */ } long floats = entry.getValue(); - long size = floats * 4 / 1024; - String suffix = "KB"; - if (size > 1024) { - size /= 1024; - suffix = "MB"; - } - println(resource.toString() + modHint.toString() + " uses is " - + size + suffix); + printKB(resource.toString() + modHint.toString() + " uses is ", + floats * 4); totalFloats += floats; } println("# Section 4 total size of all resources."); - println("Total memory usage for " + resources.size() - + " resources is " + totalFloats * 4 / 1024 / 1024 + "MB"); + printMB("Total memory usage for " + resources.size() + + " resources is ", totalFloats * 4); } private static class GeneralGridDataInstance { diff --git a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/GLInfoExporter.java b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/GLInfoExporter.java index dfc1795815..acc6fa35ce 100644 --- a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/GLInfoExporter.java +++ b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/GLInfoExporter.java @@ -42,6 +42,7 @@ import com.raytheon.hprof.data.heap.dump.ClassDump; * Date Ticket# Engineer Description * ------------- -------- ----------- -------------------------- * Jan 08, 2014 2648 bsteffen Initial doc + * May 22, 2014 3093 bsteffen Use printMB, printKB * * * @@ -94,10 +95,10 @@ public class GLInfoExporter extends AbstractExporter { long memMax = memoryCache.getLong("maxSize"); long texUsed = textureCache.getLong("curSize"); long texMax = textureCache.getLong("maxSize"); - println("RAM texture cache using " + (memUsed / 1024 / 1024) + "MB of " - + (memMax / 1024 / 1024) + "MB"); - println("GL texture cache using " + (texUsed / 1024 / 1024) + "MB of " - + (texMax / 1024 / 1024) + "MB"); + printMB("RAM texture cache using ", memUsed); + printMB("RAM texture cache available is ", memMax); + printMB("GL texture cache using ", texUsed); + printMB("GL texture cache available is ", texMax); List geoms = getInstances("com.raytheon.viz.core.gl.GLGeometryObject2D"); int coords = 0; for (SmartInstance geom : geoms) { @@ -109,8 +110,7 @@ public class GLInfoExporter extends AbstractExporter { } } } - println("GL vbo size(estimate) is " + (coords * 2 * 4 / 1024 / 1024) - + "MB"); + printMB("GL vbo size(estimate) is ", coords * 2 * 4); } } diff --git a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/GridRequestableDataFactoryExporter.java b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/GridRequestableDataFactoryExporter.java index ef631b823a..b764fe523d 100644 --- a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/GridRequestableDataFactoryExporter.java +++ b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/GridRequestableDataFactoryExporter.java @@ -99,15 +99,13 @@ public class GridRequestableDataFactoryExporter extends } } totalSize += size; - println(" Soft Referenced Memory = " + (size / 1024) + "KB"); + printKB(" Soft Referenced Memory = ", size); println("}"); } } if (totalSize > 0) { - println("Total Soft Referenced Memory = " - + (totalSize / 1024 / 1024) - + "MB"); + printMB("Total Soft Referenced Memory = ", totalSize); } } diff --git a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/RadarMosaicExporter.java b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/RadarMosaicExporter.java index bc30e36429..47e11175f4 100644 --- a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/RadarMosaicExporter.java +++ b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/RadarMosaicExporter.java @@ -40,6 +40,7 @@ import com.raytheon.hprof.SmartInstance; * Date Ticket# Engineer Description * ------------- -------- ----------- -------------------------- * May 05, 2014 3093 bsteffen Initial creation + * May 22, 2014 3093 bsteffen Use printMB, printKB * * * @@ -114,17 +115,16 @@ public class RadarMosaicExporter extends RequestableResourceExporter { for (SmartInstance record : recordMap.values()) { subrscSize += record.get("cacheObject").getInt("size"); } - println(" Mosaiced resource memory used = " - + (subrscSize / 1024) + "KB"); + printKB(" Mosaiced resource memory used = ", subrscSize); rscSize += subrscSize; println(" }"); } - println(" Mosaic memory used = " + (rscSize / 1024 / 1024) + "MB"); + printMB(" Mosaic memory used = ", rscSize); totalSize += rscSize; println("}"); } println("# Section 4 total size of all mosaics."); - println("Total memory used = " + (totalSize / 1024 / 1024) + "MB"); + printMB("Total memory used = ", totalSize); }