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

Former-commit-id: edd27c14cd [formerly c5abcecc61 [formerly 7fd433be3f94ac37e644d12623af36bf4092ab3c]]
Former-commit-id: c5abcecc61
Former-commit-id: eac412d380
This commit is contained in:
Ben Steffensmeier 2014-05-22 15:56:18 -05:00
parent 4d7f4a29db
commit d26fc4e108
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
* ------------- -------- ----------- --------------------------
* Jan 08, 2014 2648 bsteffen Initial doc
* May 22, 2014 3093 bsteffen Add printMB, printKB
*
*
* </pre>
*
@ -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 {

View file

@ -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
*
* </pre>
*
@ -105,7 +106,7 @@ public class CacheObjectExporter extends RequestableResourceExporter {
+ cse.getValue());
}
println(" total size(bytes) = " + (total / 1024 / 1024) + "MB");
printMB(" total size = ", total);
println("}");
}
}

View file

@ -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] <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);
}
int argIdx = 0;

View file

@ -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
*
* </pre>
*
@ -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 {

View file

@ -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
*
* </pre>
*
@ -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<SmartInstance> 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);
}
}

View file

@ -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);
}
}

View file

@ -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
*
* </pre>
*
@ -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);
}