# HG changeset patch # User Peter Hofer # Date 1323111657 -3600 # Node ID 54915831e5650b02ee28a86a7f936a07e1f6542b # Parent 54d4c210a34e83b3aee3204fa218ac2c82bdffc4 IdealGraphVisualizer: add filter for Graal Call Analysis graphs diff -r 54d4c210a34e -r 54915831e565 src/share/tools/IdealGraphVisualizer/Filter/nbproject/project.xml --- a/src/share/tools/IdealGraphVisualizer/Filter/nbproject/project.xml Fri Dec 02 17:46:54 2011 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Filter/nbproject/project.xml Mon Dec 05 20:00:57 2011 +0100 @@ -23,6 +23,14 @@ + com.sun.hotspot.igv.layout + + + + 1.0 + + + org.jdesktop.layout diff -r 54d4c210a34e -r 54915831e565 src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/EdgeColorIndexFilter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/EdgeColorIndexFilter.java Mon Dec 05 20:00:57 2011 +0100 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ +package com.sun.hotspot.igv.filter; + +import com.sun.hotspot.igv.graph.Connection; +import com.sun.hotspot.igv.graph.Diagram; +import com.sun.hotspot.igv.graph.Figure; +import com.sun.hotspot.igv.graph.InputSlot; +import com.sun.hotspot.igv.graph.OutputSlot; +import com.sun.hotspot.igv.graph.Slot; +import java.awt.Color; +import java.util.List; + +public class EdgeColorIndexFilter extends AbstractFilter { + + public static final String INPUTS = "INPUTS"; + public static final String OUTPUTS = "OUTPUTS"; + private final String applyTo; + private final Color[] colors; + + public EdgeColorIndexFilter(String applyTo, Color... color) { + if (!applyTo.equals(INPUTS) && !applyTo.equals(OUTPUTS)) { + throw new IllegalArgumentException("applyTo"); + } + + this.applyTo = applyTo; + this.colors = color; + } + + public String getName() { + return "Edge Color Index Filter"; + } + + public void apply(Diagram d) { + List
figures = d.getFigures(); + for (Figure f : figures) { + Slot[] slots; + if (applyTo.equals(INPUTS)) { + List inputSlots = f.getInputSlots(); + slots = inputSlots.toArray(new Slot[inputSlots.size()]); + } else { + List outputSlots = f.getOutputSlots(); + slots = outputSlots.toArray(new Slot[outputSlots.size()]); + } + int index = 0; + for (Slot slot : slots) { + if (index < colors.length && colors[index] != null) { + slot.setColor(colors[index]); + for (Connection c : slot.getConnections()) { + + c.setColor(colors[index]); + } + } + index++; + } + + } + } +} diff -r 54d4c210a34e -r 54915831e565 src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/callgraph.filter --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/callgraph.filter Mon Dec 05 20:00:57 2011 +0100 @@ -0,0 +1,5 @@ +colorize("abstract", "1", yellow); +colorize("leaf", "1", lightGray); + +var f = new com.sun.hotspot.igv.filter.EdgeColorIndexFilter("INPUTS", [black, pink]); +f.apply(graph); diff -r 54d4c210a34e -r 54915831e565 src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/layer.xml --- a/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/layer.xml Fri Dec 02 17:46:54 2011 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/layer.xml Mon Dec 05 20:00:57 2011 +0100 @@ -29,5 +29,9 @@ + + + +