Mercurial > hg > graal-jvmci-8
changeset 3709:54915831e565
IdealGraphVisualizer: add filter for Graal Call Analysis graphs
author | Peter Hofer <peter.hofer@jku.at> |
---|---|
date | Mon, 05 Dec 2011 20:00:57 +0100 |
parents | 54d4c210a34e |
children | 4e037604f6ee |
files | src/share/tools/IdealGraphVisualizer/Filter/nbproject/project.xml src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/EdgeColorIndexFilter.java src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/callgraph.filter src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/layer.xml |
diffstat | 4 files changed, 97 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ </run-dependency> </dependency> <dependency> + <code-name-base>com.sun.hotspot.igv.layout</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>1.0</specification-version> + </run-dependency> + </dependency> + <dependency> <code-name-base>org.jdesktop.layout</code-name-base> <build-prerequisite/> <compile-dependency/>
--- /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<Figure> figures = d.getFigures(); + for (Figure f : figures) { + Slot[] slots; + if (applyTo.equals(INPUTS)) { + List<InputSlot> inputSlots = f.getInputSlots(); + slots = inputSlots.toArray(new Slot[inputSlots.size()]); + } else { + List<OutputSlot> 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++; + } + + } + } +}
--- /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);
--- 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 @@ <file name="Graal Mark FrameState With Lock" url="filters/framestatelocks.filter"> <attr name="enabled" boolvalue="false"/> </file> + + <file name="Graal Call Analysis" url="filters/callgraph.filter"> + <attr name="enabled" boolvalue="false"/> + </file> </folder> </filesystem>