comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/DefaultVisualizer.java @ 15486:8f09b84f325f

Truffle/Instrumentation: Revise DefaultVisualizer
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Fri, 02 May 2014 16:12:07 -0700
parents be0c151d912b
children 2d63ce48d222
comparison
equal deleted inserted replaced
15485:2e56c2096ac5 15486:8f09b84f325f
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any 22 * or visit www.oracle.com if you need additional information or have any
23 * questions. 23 * questions.
24 */ 24 */
25 package com.oracle.truffle.api.instrument.impl; 25 package com.oracle.truffle.api.instrument.impl;
26
27 import java.io.*;
28 26
29 import com.oracle.truffle.api.*; 27 import com.oracle.truffle.api.*;
30 import com.oracle.truffle.api.frame.*; 28 import com.oracle.truffle.api.frame.*;
31 import com.oracle.truffle.api.instrument.*; 29 import com.oracle.truffle.api.instrument.*;
32 import com.oracle.truffle.api.nodes.*; 30 import com.oracle.truffle.api.nodes.*;
51 boolean estimated = false; 49 boolean estimated = false;
52 if (section == null) { 50 if (section == null) {
53 section = node.getEncapsulatingSourceSection(); 51 section = node.getEncapsulatingSourceSection();
54 estimated = true; 52 estimated = true;
55 } 53 }
56 54 return section.getShortDescription() + (estimated ? "~" : "");
57 String sourceString;
58 if (section == null || section.getSource() == null) {
59 sourceString = "<unknown source>";
60 } else {
61 String sourceName = new File(section.getSource().getName()).getName();
62 int startLine = section.getStartLine();
63 sourceString = String.format("%s:%d%s", sourceName, startLine, estimated ? "~" : "");
64 }
65 return sourceString;
66 } 55 }
67 56
68 public String displayMethodName(Node node) { 57 public String displayMethodName(Node node) {
69 if (node == null) { 58 if (node == null) {
70 return null; 59 return null;