Merge "Omaha #3093 add hprof output for grid cached data." into omaha_14.4.1
Former-commit-id:bfc67a6036
[formerly48e05989c0
] [formerlydee7b221b2
] [formerlybfc67a6036
[formerly48e05989c0
] [formerlydee7b221b2
] [formerly7350bd5f07
[formerlydee7b221b2
[formerly 83e3d888511ec9f99fc534175314ecf5e054f725]]]] Former-commit-id:7350bd5f07
Former-commit-id:75d6272fca
[formerlye15707fefd
] [formerly c3c190e158677dbbfe5b27b210740fa52400b819 [formerly9f3e64da32
]] Former-commit-id: 29df8de90a177119f3a5b8a0dac3a249479f8c2c [formerlyc950d06758
] Former-commit-id:363f71d74f
This commit is contained in:
commit
e1789bdd8f
3 changed files with 155 additions and 0 deletions
|
@ -45,6 +45,8 @@ import com.raytheon.hprof.data.heap.dump.ObjectArrayDump;
|
||||||
* ------------- -------- ----------- --------------------------
|
* ------------- -------- ----------- --------------------------
|
||||||
* Jan 08, 2014 2648 bsteffen Initial doc
|
* Jan 08, 2014 2648 bsteffen Initial doc
|
||||||
* May 05, 2014 3093 bsteffen Make getClassname public
|
* May 05, 2014 3093 bsteffen Make getClassname public
|
||||||
|
* May 21, 2014 3093 bsteffen Add getFloatArray,
|
||||||
|
* toStringKeyedConcurrentHashMap
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
|
@ -186,6 +188,24 @@ public class SmartInstance {
|
||||||
return intArray;
|
return intArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float[] getFloatArray(String fieldName) {
|
||||||
|
BasicType type = fields.get(fieldName);
|
||||||
|
if (type == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Id fieldId = type.getObjectId();
|
||||||
|
BasicType[] primArray = hprof.getHeapDump().getPrimitiveArray(fieldId);
|
||||||
|
if (primArray == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
float[] floatArray = new float[primArray.length];
|
||||||
|
|
||||||
|
for (int i = 0; i < floatArray.length; i += 1) {
|
||||||
|
floatArray[i] = primArray[i].getFloat();
|
||||||
|
}
|
||||||
|
return floatArray;
|
||||||
|
}
|
||||||
|
|
||||||
public String getString(String fieldName) {
|
public String getString(String fieldName) {
|
||||||
Id fieldId = getId(fieldName);
|
Id fieldId = getId(fieldName);
|
||||||
if (fieldId == null) {
|
if (fieldId == null) {
|
||||||
|
@ -253,6 +273,25 @@ public class SmartInstance {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ConcurrentHashMap<String, SmartInstance> toStringKeyedConcurrentHashMap() {
|
||||||
|
if (!getClassName().equals(ConcurrentHashMap.class.getName())) {
|
||||||
|
throw new IllegalStateException(this
|
||||||
|
+ " is not a ConcurrentHashMap.");
|
||||||
|
}
|
||||||
|
ConcurrentHashMap<String, SmartInstance> map = new ConcurrentHashMap<String, SmartInstance>();
|
||||||
|
SmartInstance[] segments = getObjectArray("segments");
|
||||||
|
for (SmartInstance segment : segments) {
|
||||||
|
SmartInstance[] table = segment.getObjectArray("table");
|
||||||
|
for (SmartInstance entry : table) {
|
||||||
|
while (entry != null) {
|
||||||
|
map.put(entry.getString("key"), entry.get("value"));
|
||||||
|
entry = entry.get("next");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
public HashMap<SmartInstance, SmartInstance> toHashMap() {
|
public HashMap<SmartInstance, SmartInstance> toHashMap() {
|
||||||
if (!getClassName().equals(HashMap.class.getName())) {
|
if (!getClassName().equals(HashMap.class.getName())) {
|
||||||
throw new IllegalStateException(this + " is not a HashMap.");
|
throw new IllegalStateException(this + " is not a HashMap.");
|
||||||
|
|
|
@ -38,6 +38,7 @@ import com.raytheon.hprof.HprofFile;
|
||||||
* Jan 08, 2014 2648 bsteffen Initial doc
|
* Jan 08, 2014 2648 bsteffen Initial doc
|
||||||
* May 05, 2014 3093 bsteffen Add some new exporters
|
* May 05, 2014 3093 bsteffen Add some new exporters
|
||||||
* May 20, 2014 3093 bsteffen Add option to zero primitive arrays.
|
* May 20, 2014 3093 bsteffen Add option to zero primitive arrays.
|
||||||
|
* May 21, 2014 3093 bsteffen Add GridRequestableDataFactoryExporter
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -98,5 +99,6 @@ public class CaveExporter {
|
||||||
new AlertMessageExporter(hprof, outputDir).export();
|
new AlertMessageExporter(hprof, outputDir).export();
|
||||||
new CacheObjectExporter(hprof, outputDir).export();
|
new CacheObjectExporter(hprof, outputDir).export();
|
||||||
new RadarMosaicExporter(hprof, outputDir).export();
|
new RadarMosaicExporter(hprof, outputDir).export();
|
||||||
|
new GridRequestableDataFactoryExporter(hprof, outputDir).export();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,114 @@
|
||||||
|
/**
|
||||||
|
* 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 java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import com.raytheon.hprof.HprofFile;
|
||||||
|
import com.raytheon.hprof.SmartInstance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Export information about the cached grid data.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------- -------- ----------- --------------------------
|
||||||
|
* May 20, 2014 3093 bsteffen Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author bsteffen
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public class GridRequestableDataFactoryExporter extends
|
||||||
|
RequestableResourceExporter {
|
||||||
|
|
||||||
|
public GridRequestableDataFactoryExporter(HprofFile hprof,
|
||||||
|
File outputDirectory) {
|
||||||
|
super(hprof, outputDirectory, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getFileName() {
|
||||||
|
return "gridRequestableDataFactory.txt";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getComment() {
|
||||||
|
StringBuilder comment = new StringBuilder();
|
||||||
|
comment.append("# This file contains information about GridRequestableDataFactory\n");
|
||||||
|
comment.append("# which caches grids used in derived parameters using soft references.\n");
|
||||||
|
return comment.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getInfo() {
|
||||||
|
return "Generating output for GridRequestableDataFactory...";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void exportInternal() throws IOException {
|
||||||
|
List<SmartInstance> factories = getInstances("com.raytheon.viz.grid.data.GridRequestableDataFactory");
|
||||||
|
if (factories.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
long totalSize = 0;
|
||||||
|
for (SmartInstance factory : factories) {
|
||||||
|
Map<String, SmartInstance> dataMap = factory.get(
|
||||||
|
"requestableDataMap").toStringKeyedConcurrentHashMap();
|
||||||
|
for (Entry<String, SmartInstance> entry : dataMap.entrySet()) {
|
||||||
|
SmartInstance data = entry.getValue();
|
||||||
|
println(data + "{");
|
||||||
|
println(" dataURI = " + entry.getKey());
|
||||||
|
long size = 0;
|
||||||
|
HashMap<SmartInstance, SmartInstance> cache = data.get("cache")
|
||||||
|
.get("m").toHashMap();
|
||||||
|
for (SmartInstance ref : cache.values()) {
|
||||||
|
SmartInstance[] recArray = ref.getObjectArray("referent");
|
||||||
|
if (recArray != null) {
|
||||||
|
for (SmartInstance rec : recArray) {
|
||||||
|
float[] rawFloats = rec.getFloatArray("floatData");
|
||||||
|
size += rawFloats.length * 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
totalSize += size;
|
||||||
|
println(" Soft Referenced Memory = " + (size / 1024) + "KB");
|
||||||
|
println("}");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (totalSize > 0) {
|
||||||
|
println("Total Soft Referenced Memory = "
|
||||||
|
+ (totalSize / 1024 / 1024)
|
||||||
|
+ "MB");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue