changeset 10711:68d4d5457546

add sequential id prefixes to IGV graphs
author Doug Simon <doug.simon@oracle.com>
date Thu, 11 Jul 2013 20:56:18 +0200
parents cd28ead65a53
children 7f50d79c46f2
files graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java	Thu Jul 11 16:21:29 2013 +0200
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java	Thu Jul 11 20:56:18 2013 +0200
@@ -46,6 +46,7 @@
 
     private GraphPrinter printer;
     private List<String> previousInlineContext;
+    private int[] dumpIds = {};
     private int failuresCount;
 
     /**
@@ -69,6 +70,14 @@
         }
     }
 
+    private int nextDumpId() {
+        int depth = previousInlineContext.size();
+        if (dumpIds.length < depth) {
+            dumpIds = Arrays.copyOf(dumpIds, depth);
+        }
+        return dumpIds[depth - 1]++;
+    }
+
     // This field must be lazily initialized as this class may be loaded in a version
     // VM startup phase at which not all required features (such as system properties)
     // are online.
@@ -169,7 +178,7 @@
                     public void run() {
                         // Finally, output the graph.
                         try {
-                            printer.print(graph, message, predefinedSchedule);
+                            printer.print(graph, nextDumpId() + ":" + message, predefinedSchedule);
                         } catch (IOException e) {
                             failuresCount++;
                             printer = null;