21 * questions.
22 *
23 */
24
25 package com.sun.hotspot.tools.compiler;
26
27 import java.io.PrintStream;
28 import java.util.ArrayList;
29 import java.util.List;
30
31 public class CallSite {
32
33 private int bci;
34 private Method method;
35 private int count;
36 private String receiver;
37 private int receiver_count;
38 private String reason;
39 private List<CallSite> calls;
40 private int endNodes;
41 private double timeStamp;
42
43 CallSite() {
44 }
45
46 CallSite(int bci, Method m) {
47 this.bci = bci;
48 this.method = m;
49 }
50
51 void add(CallSite site) {
52 if (getCalls() == null) {
53 setCalls(new ArrayList<CallSite>());
54 }
55 getCalls().add(site);
56 }
57
58 CallSite last() {
59 return last(-1);
60 }
89 stream.print(' ');
90 }
91 }
92 private static boolean compat = true;
93
94 public void print(PrintStream stream, int indent) {
95 emit(stream, indent);
96 String m = getMethod().getHolder().replace('/', '.') + "::" + getMethod().getName();
97 if (getReason() == null) {
98 stream.print(" @ " + getBci() + " " + m + " (" + getMethod().getBytes() + " bytes)");
99
100 } else {
101 if (isCompat()) {
102 stream.print(" @ " + getBci() + " " + m + " " + getReason());
103 } else {
104 stream.print("- @ " + getBci() + " " + m +
105 " (" + getMethod().getBytes() + " bytes) " + getReason());
106 }
107 }
108 if (getEndNodes() > 0) {
109 stream.printf(" (end time: %6.4f nodes: %d)", getTimeStamp(), getEndNodes());
110 }
111 stream.println("");
112 if (getReceiver() != null) {
113 emit(stream, indent + 4);
114 // stream.println("type profile " + method.holder + " -> " + receiver + " (" +
115 // receiver_count + "/" + count + "," + (receiver_count * 100 / count) + "%)");
116 stream.println("type profile " + getMethod().getHolder() + " -> " + getReceiver() + " (" +
117 (getReceiverCount() * 100 / getCount()) + "%)");
118 }
119 if (getCalls() != null) {
120 for (CallSite site : getCalls()) {
121 site.print(stream, indent + 2);
122 }
123 }
124 }
125
126 public int getBci() {
127 return bci;
128 }
129
178 public void setCalls(List<CallSite> calls) {
179 this.calls = calls;
180 }
181
182 public static boolean isCompat() {
183 return compat;
184 }
185
186 public static void setCompat(boolean aCompat) {
187 compat = aCompat;
188 }
189
190 void setEndNodes(int n) {
191 endNodes = n;
192 }
193
194 public int getEndNodes() {
195 return endNodes;
196 }
197
198 void setTimeStamp(double time) {
199 timeStamp = time;
200 }
201
202 public double getTimeStamp() {
203 return timeStamp;
204 }
205
206 }
|
21 * questions.
22 *
23 */
24
25 package com.sun.hotspot.tools.compiler;
26
27 import java.io.PrintStream;
28 import java.util.ArrayList;
29 import java.util.List;
30
31 public class CallSite {
32
33 private int bci;
34 private Method method;
35 private int count;
36 private String receiver;
37 private int receiver_count;
38 private String reason;
39 private List<CallSite> calls;
40 private int endNodes;
41 private int endLiveNodes;
42 private double timeStamp;
43
44 CallSite() {
45 }
46
47 CallSite(int bci, Method m) {
48 this.bci = bci;
49 this.method = m;
50 }
51
52 void add(CallSite site) {
53 if (getCalls() == null) {
54 setCalls(new ArrayList<CallSite>());
55 }
56 getCalls().add(site);
57 }
58
59 CallSite last() {
60 return last(-1);
61 }
90 stream.print(' ');
91 }
92 }
93 private static boolean compat = true;
94
95 public void print(PrintStream stream, int indent) {
96 emit(stream, indent);
97 String m = getMethod().getHolder().replace('/', '.') + "::" + getMethod().getName();
98 if (getReason() == null) {
99 stream.print(" @ " + getBci() + " " + m + " (" + getMethod().getBytes() + " bytes)");
100
101 } else {
102 if (isCompat()) {
103 stream.print(" @ " + getBci() + " " + m + " " + getReason());
104 } else {
105 stream.print("- @ " + getBci() + " " + m +
106 " (" + getMethod().getBytes() + " bytes) " + getReason());
107 }
108 }
109 if (getEndNodes() > 0) {
110 stream.printf(" (end time: %6.4f nodes: %d live: %d)", getTimeStamp(), getEndNodes(), getEndLiveNodes());
111 }
112 stream.println("");
113 if (getReceiver() != null) {
114 emit(stream, indent + 4);
115 // stream.println("type profile " + method.holder + " -> " + receiver + " (" +
116 // receiver_count + "/" + count + "," + (receiver_count * 100 / count) + "%)");
117 stream.println("type profile " + getMethod().getHolder() + " -> " + getReceiver() + " (" +
118 (getReceiverCount() * 100 / getCount()) + "%)");
119 }
120 if (getCalls() != null) {
121 for (CallSite site : getCalls()) {
122 site.print(stream, indent + 2);
123 }
124 }
125 }
126
127 public int getBci() {
128 return bci;
129 }
130
179 public void setCalls(List<CallSite> calls) {
180 this.calls = calls;
181 }
182
183 public static boolean isCompat() {
184 return compat;
185 }
186
187 public static void setCompat(boolean aCompat) {
188 compat = aCompat;
189 }
190
191 void setEndNodes(int n) {
192 endNodes = n;
193 }
194
195 public int getEndNodes() {
196 return endNodes;
197 }
198
199 void setEndLiveNodes(int n) {
200 endLiveNodes = n;
201 }
202
203 public int getEndLiveNodes() {
204 return endLiveNodes;
205 }
206
207 void setTimeStamp(double time) {
208 timeStamp = time;
209 }
210
211 public double getTimeStamp() {
212 return timeStamp;
213 }
214
215 }
|