Omaha #3093 Improvements to hprof tool: spelling fixes, allow grid memory >2GB, output for radar memory troubleshooting.
Former-commit-id:462ec63608
[formerly18ec643a30
] [formerly462ec63608
[formerly18ec643a30
] [formerly973c6fdb55
[formerly 3bd0a076add20c38fad41461295fb430e8ceb5cb]]] Former-commit-id:973c6fdb55
Former-commit-id:3e9e6abde2
[formerly0bd28752bc
] Former-commit-id:ed9993067e
This commit is contained in:
parent
3c9f5ff37b
commit
d02dfbb11f
8 changed files with 299 additions and 25 deletions
|
@ -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
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -89,7 +91,7 @@ public class SmartInstance {
|
|||
return type.getObjectId();
|
||||
}
|
||||
|
||||
protected String getClassName() {
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* May 05, 2014 3093 bsteffen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @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<SmartInstance> cacheObjects = getInstances("com.raytheon.uf.viz.core.cache.CacheObject");
|
||||
if (cacheObjects.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Map<String, List<Integer>> byType = new HashMap<String, List<Integer>>();
|
||||
for(SmartInstance cacheObject : cacheObjects){
|
||||
String className = cacheObject.get("retriever").getClassName();
|
||||
List<Integer> sizes = byType.get(className);
|
||||
if (sizes == null) {
|
||||
sizes = new ArrayList<Integer>();
|
||||
byType.put(className, sizes);
|
||||
}
|
||||
sizes.add(cacheObject.getInt("size"));
|
||||
}
|
||||
for (Entry<String, List<Integer>> entry : byType.entrySet()) {
|
||||
println(entry.getKey() + "{");
|
||||
println(" total objects = " + entry.getValue().size());
|
||||
Map<Integer, Integer> countBySize = new HashMap<Integer, Integer>();
|
||||
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<Integer, Integer> cse : countBySize.entrySet()) {
|
||||
println(" objects of size " + cse.getKey() + " = "
|
||||
+ cse.getValue());
|
||||
|
||||
}
|
||||
println(" total size(bytes) = " + (total / 1024 / 1024) + "MB");
|
||||
println("}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<SmartInstance, Integer> sizes = new HashMap<SmartInstance, Integer>();
|
||||
Map<SmartInstance, Long> sizes = new HashMap<SmartInstance, Long>();
|
||||
for (SmartInstance resource : resources) {
|
||||
int floats = 0;
|
||||
long floats = 0;
|
||||
List<GeneralGridDataInstance> datas = new ArrayList<GeneralGridDataInstance>();
|
||||
if (useDataMap) {
|
||||
ConcurrentHashMap<SmartInstance, SmartInstance> dataMap = resource
|
||||
|
@ -147,19 +148,19 @@ public class D2DGridResourceExporter extends RequestableResourceExporter {
|
|||
println("}");
|
||||
}
|
||||
println("# Section 3 total size of each resource.");
|
||||
List<Entry<SmartInstance, Integer>> sizesList = new ArrayList<Entry<SmartInstance, Integer>>(
|
||||
List<Entry<SmartInstance, Long>> sizesList = new ArrayList<Entry<SmartInstance, Long>>(
|
||||
sizes.entrySet());
|
||||
Collections.sort(sizesList,
|
||||
new Comparator<Entry<SmartInstance, Integer>>() {
|
||||
new Comparator<Entry<SmartInstance, Long>>() {
|
||||
|
||||
@Override
|
||||
public int compare(Entry<SmartInstance, Integer> e1,
|
||||
Entry<SmartInstance, Integer> e2) {
|
||||
public int compare(Entry<SmartInstance, Long> e1,
|
||||
Entry<SmartInstance, Long> e2) {
|
||||
return e1.getValue().compareTo(e2.getValue());
|
||||
}
|
||||
});
|
||||
int totalFloats = 0;
|
||||
for (Entry<SmartInstance, Integer> entry : sizesList) {
|
||||
long totalFloats = 0;
|
||||
for (Entry<SmartInstance, Long> 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
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* May 05, 2014 3093 bsteffen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @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<SmartInstance> 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<SmartInstance, SmartInstance> 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");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<String, SmartInstance> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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");
|
||||
|
|
Loading…
Add table
Reference in a new issue