From 27165c51b8c555abfb988893b7059a16c1b8f06c Mon Sep 17 00:00:00 2001 From: Ben Steffensmeier Date: Wed, 12 Feb 2014 17:07:16 -0600 Subject: [PATCH] Issue #2648 Add AlertMessage output. Change-Id: I34818b15ce9a85c3b58b2475a0b1e94a596bf06e Former-commit-id: f45ec64979c48d73ab6fb2ed43cbe338405d25d3 [formerly f45ec64979c48d73ab6fb2ed43cbe338405d25d3 [formerly 47826e8d3e4570c9f970fc30f5dac462611b91bf]] Former-commit-id: c96be7613c654ed6f297367936438b69147b17c2 Former-commit-id: 4cffeac65f7c8a767a0be5d5b45534fc3c0e98c5 --- .../com.raytheon.uf.viz.hprof/build.xml | 2 +- .../raytheon/hprof/data/HeapDumpRecord.java | 10 +++ .../uf/viz/hprof/AlertMessageExporter.java | 76 +++++++++++++++++++ .../raytheon/uf/viz/hprof/CaveExporter.java | 1 + .../uf/viz/hprof/UIRunnablesExporter.java | 6 +- 5 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/AlertMessageExporter.java diff --git a/javaUtilities/com.raytheon.uf.viz.hprof/build.xml b/javaUtilities/com.raytheon.uf.viz.hprof/build.xml index a35d235784..b823ca393b 100644 --- a/javaUtilities/com.raytheon.uf.viz.hprof/build.xml +++ b/javaUtilities/com.raytheon.uf.viz.hprof/build.xml @@ -32,7 +32,7 @@ - + diff --git a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/hprof/data/HeapDumpRecord.java b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/hprof/data/HeapDumpRecord.java index 17c97d4179..853ea103c3 100644 --- a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/hprof/data/HeapDumpRecord.java +++ b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/hprof/data/HeapDumpRecord.java @@ -158,10 +158,18 @@ public class HeapDumpRecord extends AbstractHprofRecord { System.out.println("Sorting all objects..."); long startTime = System.currentTimeMillis(); + System.out.print("Instances..."); Collections.sort(instances, new DumpBufferIndexComparator()); + System.out.println("Done"); + System.out.print("Object Arrays..."); Collections.sort(objectArrays, new DumpBufferIndexComparator()); + System.out.println("Done"); + System.out.print("Primitive Arrays..."); Collections.sort(primitiveArrays, new DumpBufferIndexComparator()); + System.out.println("Done"); + System.out.print("Classes..."); Collections.sort(classes, new DumpBufferIndexComparator()); + System.out.println("Done"); this.instancesById = new long[instances.size()]; for (int i = 0; i < instances.size(); i++) { @@ -183,8 +191,10 @@ public class HeapDumpRecord extends AbstractHprofRecord { this.classesById[i] = classes.get(i); } + System.out.print("Instances By Class..."); /* Add one id and one int before the class id */ Collections.sort(instances, new DumpBufferIndexComparator(idSize + 4)); + System.out.println("Done"); this.instancesByClass = new long[instances.size()]; for (int i = 0; i < instances.size(); i++) { diff --git a/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/AlertMessageExporter.java b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/AlertMessageExporter.java new file mode 100644 index 0000000000..96038f8163 --- /dev/null +++ b/javaUtilities/com.raytheon.uf.viz.hprof/src/com/raytheon/uf/viz/hprof/AlertMessageExporter.java @@ -0,0 +1,76 @@ +/** + * 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.List; + +import com.raytheon.hprof.HprofFile; +import com.raytheon.hprof.SmartInstance; + +/** + * + * Export information about AlertMessages + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Feb 12, 2014  2648     bsteffen    Initial creation
+ * 
+ * 
+ * + * @author bsteffen + * @version 1.0 + */ +public class AlertMessageExporter extends AbstractExporter { + + public AlertMessageExporter(HprofFile hprof, File outputDirectory) { + super(hprof, outputDirectory); + } + + @Override + protected String getFileName() { + return "alertMessages.txt"; + } + + @Override + protected String getComment() { + return "# This file contains information about AlertMessages."; + } + + @Override + protected String getInfo() { + return "Generating output for AlertMessages..."; + } + + @Override + protected void exportInternal() throws IOException { + List messages = getInstances("com.raytheon.uf.viz.core.alerts.AlertMessage"); + for (SmartInstance message : messages) { + println(message + ": " + message.getString("dataURI")); + } + } + + +} 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 ea11bf5e7b..f3748e5eb4 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 @@ -83,5 +83,6 @@ public class CaveExporter { new GFEResourceExporter(hprof, outputDir).export(); new DisposingResourceExporter(hprof, outputDir).export(); new UIRunnablesExporter(hprof, outputDir).export(); + new AlertMessageExporter(hprof, outputDir).export(); } } 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 7ad2a458c9..a7e70e3469 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 @@ -79,7 +79,11 @@ public class UIRunnablesExporter extends AbstractExporter { .getObjectArray("messages"); println(messages.length + " message(s)"); for (SmartInstance message : messages) { - println(message.get("runnable").toString()); + if (message != null) { + println(message.get("runnable").toString()); + } else { + println("null"); + } } }