diff --git a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/hprof/SmartInstance.java b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/hprof/SmartInstance.java
index 5bb32dda85..baa0af4ee0 100644
--- a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/hprof/SmartInstance.java
+++ b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/hprof/SmartInstance.java
@@ -44,6 +44,8 @@ import com.raytheon.hprof.data.heap.dump.ObjectArrayDump;
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Jan 08, 2014 2648 bsteffen Initial doc
+ * May 05, 2014 3093 bsteffen Make getClassname public
+ *
*
*
*
@@ -89,7 +91,7 @@ public class SmartInstance {
return type.getObjectId();
}
- protected String getClassName() {
+ public String getClassName() {
return className;
}
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
new file mode 100644
index 0000000000..9479ad0f61
--- /dev/null
+++ b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/CacheObjectExporter.java
@@ -0,0 +1,113 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.viz.hprof;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import com.raytheon.hprof.HprofFile;
+import com.raytheon.hprof.SmartInstance;
+
+/**
+ *
+ * Export information about cache objects.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------- -------- ----------- --------------------------
+ * May 05, 2014 3093 bsteffen Initial creation
+ *
+ *
+ *
+ * @author bsteffen
+ * @version 1.0
+ */
+public class CacheObjectExporter extends RequestableResourceExporter {
+
+ public CacheObjectExporter(HprofFile hprof, File outputDirectory) {
+ super(hprof, outputDirectory, null);
+ }
+
+ @Override
+ protected String getFileName() {
+ return "cacheObjects.txt";
+ }
+
+ @Override
+ protected String getComment() {
+ StringBuilder comment = new StringBuilder();
+ comment.append("# This file contains information about cache objects(used mostly by radar).\n");
+ return comment.toString();
+ }
+
+ @Override
+ protected String getInfo() {
+ return "Generating output for CacheObject...";
+ }
+
+ @Override
+ protected void exportInternal() throws IOException {
+ List cacheObjects = getInstances("com.raytheon.uf.viz.core.cache.CacheObject");
+ if (cacheObjects.isEmpty()) {
+ return;
+ }
+ Map> byType = new HashMap>();
+ for(SmartInstance cacheObject : cacheObjects){
+ String className = cacheObject.get("retriever").getClassName();
+ List sizes = byType.get(className);
+ if (sizes == null) {
+ sizes = new ArrayList();
+ byType.put(className, sizes);
+ }
+ sizes.add(cacheObject.getInt("size"));
+ }
+ for (Entry> entry : byType.entrySet()) {
+ println(entry.getKey() + "{");
+ println(" total objects = " + entry.getValue().size());
+ Map countBySize = new HashMap();
+ long total = 0;
+ for (Integer size : entry.getValue()) {
+ total += size;
+ Integer count = countBySize.get(size);
+ if (count == null) {
+ count = 0;
+ }
+ count = count + 1;
+ countBySize.put(size, count);
+ }
+ for (Entry cse : countBySize.entrySet()) {
+ println(" objects of size " + cse.getKey() + " = "
+ + cse.getValue());
+
+ }
+ println(" total size(bytes) = " + (total / 1024 / 1024) + "MB");
+ 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 f3748e5eb4..3ec4d12453 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
@@ -36,6 +36,7 @@ import com.raytheon.hprof.HprofFile;
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Jan 08, 2014 2648 bsteffen Initial doc
+ * May 05, 2014 3093 bsteffen Add some new exporters
*
*
*
@@ -84,5 +85,7 @@ public class CaveExporter {
new DisposingResourceExporter(hprof, outputDir).export();
new UIRunnablesExporter(hprof, outputDir).export();
new AlertMessageExporter(hprof, outputDir).export();
+ new CacheObjectExporter(hprof, outputDir).export();
+ new RadarMosaicExporter(hprof, outputDir).export();
}
}
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 06a28e7f55..08e74683be 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
@@ -45,6 +45,7 @@ import com.raytheon.hprof.SmartInstance;
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Jan 08, 2014 2648 bsteffen Initial doc
+ * May 05, 2014 3093 bsteffen Track sizes as longs.
*
*
*
@@ -71,7 +72,7 @@ public class D2DGridResourceExporter extends RequestableResourceExporter {
comment.append("# 1) Metadata maps for each resource. \n");
comment.append("# 2) Size and type of all GeneralGridData. \n");
comment.append("# 3) Total size of each resource. \n");
- comment.append("# 4) Total size of all resources.\n#");
+ comment.append("# 4) Total size of all resources.\n");
return comment.toString();
}
@@ -92,9 +93,9 @@ public class D2DGridResourceExporter extends RequestableResourceExporter {
outputResource(resource);
}
println("# Section 2 size and type of all GeneralGridData.");
- Map sizes = new HashMap();
+ Map sizes = new HashMap();
for (SmartInstance resource : resources) {
- int floats = 0;
+ long floats = 0;
List datas = new ArrayList();
if (useDataMap) {
ConcurrentHashMap dataMap = resource
@@ -147,19 +148,19 @@ public class D2DGridResourceExporter extends RequestableResourceExporter {
println("}");
}
println("# Section 3 total size of each resource.");
- List> sizesList = new ArrayList>(
+ List> sizesList = new ArrayList>(
sizes.entrySet());
Collections.sort(sizesList,
- new Comparator>() {
+ new Comparator>() {
@Override
- public int compare(Entry e1,
- Entry e2) {
+ public int compare(Entry e1,
+ Entry e2) {
return e1.getValue().compareTo(e2.getValue());
}
});
- int totalFloats = 0;
- for (Entry entry : sizesList) {
+ long totalFloats = 0;
+ for (Entry entry : sizesList) {
SmartInstance resource = entry.getKey();
StringBuilder modHint = new StringBuilder();
try {
@@ -177,8 +178,8 @@ public class D2DGridResourceExporter extends RequestableResourceExporter {
} catch (IllegalStateException e) {
/* heap dump is from after 14.2 */
}
- int floats = entry.getValue();
- int size = floats * 4 / 1024;
+ long floats = entry.getValue();
+ long size = floats * 4 / 1024;
String suffix = "KB";
if (size > 1024) {
size /= 1024;
@@ -273,8 +274,9 @@ public class D2DGridResourceExporter extends RequestableResourceExporter {
return 0;
}
- public int getFloatCount() {
- return uCapacity + vCapacity + scalarCapacity + dirCapacity;
+ public long getFloatCount() {
+ return ((long) uCapacity) + vCapacity + scalarCapacity
+ + dirCapacity;
}
@Override
diff --git a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/DisplayedResourcesExporter.java b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/DisplayedResourcesExporter.java
index 153eb81d2f..0fd9d87d9c 100644
--- a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/DisplayedResourcesExporter.java
+++ b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/DisplayedResourcesExporter.java
@@ -38,6 +38,7 @@ import com.raytheon.hprof.SmartInstance;
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Jan 08, 2014 2648 bsteffen Initial doc
+ * May 05, 2014 3093 bsteffen print frame counts
*
*
*
@@ -91,9 +92,23 @@ public class DisplayedResourcesExporter extends DisplayPaneContainerExporter {
/* Not D2D or before 14.2 */
}
SmartInstance descriptor = renderableDisplay.get("descriptor");
+ println(" " + descriptor + "{");
+ /* Frame info */
+ SmartInstance timeManager = descriptor.get("timeManager");
+ int numberOfFrames = timeManager.getInt("numberOfFrames");
+ println(" numberOfFrames = " + numberOfFrames);
+ SmartInstance[] frames = timeManager.getObjectArray("frames");
+ if (frames != null) {
+ println(" frames.length = " + frames.length);
+ }
+ int limitedNumberOfFrames = descriptor
+ .getInt("limitedNumberOfFrames");
+ if (limitedNumberOfFrames < numberOfFrames) {
+ println(" limitedNumberOfFrames = " + limitedNumberOfFrames);
+ }
+ /* resources */
SmartInstance resourceList = descriptor.get("resourceList");
SmartInstance[] array = resourceList.getObjectArray("array");
- println(" " + descriptor + "{");
for (SmartInstance resourcePair : array) {
SmartInstance resource = resourcePair.get("resource");
if (resource == null) {
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
new file mode 100644
index 0000000000..bc30e36429
--- /dev/null
+++ b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/RadarMosaicExporter.java
@@ -0,0 +1,132 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.viz.hprof;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+
+import com.raytheon.hprof.HprofFile;
+import com.raytheon.hprof.SmartInstance;
+
+/**
+ *
+ * Export information about radar mosaic resources including the resources that
+ * are mosaiced and memory information about each resource for finding memory
+ * leaks.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------- -------- ----------- --------------------------
+ * May 05, 2014 3093 bsteffen Initial creation
+ *
+ *
+ *
+ * @author bsteffen
+ * @version 1.0
+ */
+public class RadarMosaicExporter extends RequestableResourceExporter {
+
+ public RadarMosaicExporter(HprofFile hprof, File outputDirectory) {
+ super(hprof, outputDirectory, null);
+ }
+
+ @Override
+ protected String getFileName() {
+ return "radarMosaicResources.txt";
+ }
+
+ @Override
+ protected String getComment() {
+ StringBuilder comment = new StringBuilder();
+ comment.append("# This file contains information about RadarMosaicResources, there are 4 sections:\n");
+ comment.append("# 1) Metadata maps for each resource. \n");
+ comment.append("# 2) Metadata maps for each resource within each mosaic. \n");
+ comment.append("# 3) Total size of each resource. \n");
+ comment.append("# 4) Total size of all mosaics.\n");
+ return comment.toString();
+ }
+
+ @Override
+ protected String getInfo() {
+ return "Generating output for RadarMosaics...";
+ }
+
+ @Override
+ protected void exportInternal() throws IOException {
+ List resources = getInstances("com.raytheon.viz.radar.rsc.mosaic.RadarMosaicResource");
+ if (resources.isEmpty()) {
+ return;
+ }
+ println("# Section 1 metadata maps for each resource.");
+ for (SmartInstance resource : resources) {
+ outputResource(resource);
+ }
+ println("# Section 2 metadata maps for each resource within each mosaic.");
+ for (SmartInstance resource : resources) {
+ println(resource + "{");
+ SmartInstance[] subrscs = resource.get("resourceData")
+ .get("resourceList").getObjectArray("array");
+ println(" Resources to mosaic = " + subrscs.length);
+ for (SmartInstance subrsc : subrscs) {
+ outputResource(subrsc.get("resource"), " ");
+ }
+ println("}");
+ }
+ println("# Section 3 total size of each resource.");
+ long totalSize = 0;
+ for (SmartInstance resource : resources) {
+ println(resource + "{");
+ SmartInstance[] subrscs = resource.get("resourceData")
+ .get("resourceList").getObjectArray("array");
+ long rscSize = 0;
+ for (SmartInstance subrsc : subrscs) {
+ subrsc = subrsc.get("resource");
+ if (subrsc == null) {
+ continue;
+ }
+ println(" " + subrsc + "{");
+ HashMap recordMap = subrsc
+ .get("radarRecords").get("m").toHashMap();
+ println(" Total radar records = " + recordMap.size());
+ long subrscSize = 0;
+ for (SmartInstance record : recordMap.values()) {
+ subrscSize += record.get("cacheObject").getInt("size");
+ }
+ println(" Mosaiced resource memory used = "
+ + (subrscSize / 1024) + "KB");
+ rscSize += subrscSize;
+ println(" }");
+ }
+ println(" Mosaic memory used = " + (rscSize / 1024 / 1024) + "MB");
+ totalSize += rscSize;
+ println("}");
+ }
+ println("# Section 4 total size of all mosaics.");
+ println("Total memory used = " + (totalSize / 1024 / 1024) + "MB");
+
+ }
+
+
+}
diff --git a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/RequestableResourceExporter.java b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/RequestableResourceExporter.java
index 45d5b8da9c..703c6e4aa4 100644
--- a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/RequestableResourceExporter.java
+++ b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/RequestableResourceExporter.java
@@ -38,6 +38,8 @@ import com.raytheon.hprof.SmartInstance;
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Jan 08, 2014 2648 bsteffen Initial doc
+ * May 05, 2014 3093 bsteffen Allow custom indenting when outputting
+ * resources.
*
*
*
@@ -82,16 +84,20 @@ public class RequestableResourceExporter extends AbstractExporter {
}
}
- protected void outputResource(SmartInstance resource)
+ protected void outputResource(SmartInstance resource) throws IOException {
+ outputResource(resource, "");
+ }
+
+ protected void outputResource(SmartInstance resource, String indent)
throws IOException {
if (resource == null) {
return;
}
SmartInstance resourceData = resource.get("resourceData");
if (resourceData == null) {
- println(resource + "{");
- println(" No resourceData available.");
- println("}");
+ println(indent + resource + "{");
+ println(indent + " No resourceData available.");
+ println(indent + "}");
return;
}
SmartInstance metadataMap = resourceData.get(
@@ -99,12 +105,12 @@ public class RequestableResourceExporter extends AbstractExporter {
if (metadataMap == null) {
return;
}
- println(resource + "{");
- outputMetadataMap(metadataMap);
- println("}");
+ println(indent + resource + "{");
+ outputMetadataMap(metadataMap, indent + " ");
+ println(indent + "}");
}
- protected void outputMetadataMap(SmartInstance metadataMap)
+ protected void outputMetadataMap(SmartInstance metadataMap, String indent)
throws IOException {
for (Entry entry : metadataMap
.toStringKeyedHashMap().entrySet()) {
@@ -152,7 +158,7 @@ public class RequestableResourceExporter extends AbstractExporter {
operand = "isnotnull";
break;
}
- println(" " + key + " " + operand + " " + constraintValue);
+ println(indent + key + " " + operand + " " + constraintValue);
}
}
diff --git a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/UIRunnablesExporter.java b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/UIRunnablesExporter.java
index a7e70e3469..f77f9e8763 100644
--- a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/UIRunnablesExporter.java
+++ b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/UIRunnablesExporter.java
@@ -37,6 +37,7 @@ import com.raytheon.hprof.SmartInstance;
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Jan 20, 2014 2648 bsteffen Initial creation
+ * May 05, 2014 3093 bsteffen Fix spelling of displays.
*
*
*
@@ -73,7 +74,7 @@ public class UIRunnablesExporter extends AbstractExporter {
if (displays.isEmpty()) {
return;
}
- println(displays.size() + " dispaly(s)");
+ println(displays.size() + " display(s)");
for (SmartInstance display : displays) {
SmartInstance[] messages = display.get("synchronizer")
.getObjectArray("messages");