src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/CallSite.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 7081842 Sdiff src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler

src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/CallSite.java

Print this page




  20  * or visit www.oracle.com if you need additional information or have any
  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 
  41     CallSite() {
  42     }
  43 
  44     CallSite(int bci, Method m) {
  45         this.bci = bci;
  46         this.method = m;
  47     }
  48 
  49     void add(CallSite site) {
  50         if (getCalls() == null) {
  51             setCalls(new ArrayList<CallSite>());
  52         }
  53         getCalls().add(site);
  54     }
  55 
  56     CallSite last() {
  57         return last(-1);
  58     }
  59 


  76             }
  77         }
  78         return sb.toString();
  79     }
  80 
  81     public void print(PrintStream stream) {
  82         print(stream, 0);
  83     }
  84 
  85     void emit(PrintStream stream, int indent) {
  86         for (int i = 0; i < indent; i++) {
  87             stream.print(' ');
  88         }
  89     }
  90     private static boolean compat = true;
  91 
  92     public void print(PrintStream stream, int indent) {
  93         emit(stream, indent);
  94         String m = getMethod().getHolder().replace('/', '.') + "::" + getMethod().getName();
  95         if (getReason() == null) {
  96             stream.println("  @ " + getBci() + " " + m + " (" + getMethod().getBytes() + " bytes)");
  97 
  98         } else {
  99             if (isCompat()) {
 100                 stream.println("  @ " + getBci() + " " + m + " " + getReason());
 101             } else {
 102                 stream.println("- @ " + getBci() + " " + m +
 103                         " (" + getMethod().getBytes() + " bytes) " + getReason());
 104             }
 105         }




 106         if (getReceiver() != null) {
 107             emit(stream, indent + 3);
 108             //                 stream.println("type profile " + method.holder + " -> " + receiver + " (" +
 109             //                                receiver_count + "/" + count + "," + (receiver_count * 100 / count) + "%)");
 110             stream.println("type profile " + getMethod().getHolder() + " -> " + getReceiver() + " (" +
 111                     (getReceiverCount() * 100 / getCount()) + "%)");
 112         }
 113         if (getCalls() != null) {
 114             for (CallSite site : getCalls()) {
 115                 site.print(stream, indent + 2);
 116             }
 117         }
 118     }
 119 
 120     public int getBci() {
 121         return bci;
 122     }
 123 
 124     public void setBci(int bci) {
 125         this.bci = bci;
 126     }
 127 


 163 
 164     public void setReason(String reason) {
 165         this.reason = reason;
 166     }
 167 
 168     public List<CallSite> getCalls() {
 169         return calls;
 170     }
 171 
 172     public void setCalls(List<CallSite> calls) {
 173         this.calls = calls;
 174     }
 175 
 176     public static boolean isCompat() {
 177         return compat;
 178     }
 179 
 180     public static void setCompat(boolean aCompat) {
 181         compat = aCompat;
 182     }

















 183 }


  20  * or visit www.oracle.com if you need additional information or have any
  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     }
  61 


  78             }
  79         }
  80         return sb.toString();
  81     }
  82 
  83     public void print(PrintStream stream) {
  84         print(stream, 0);
  85     }
  86 
  87     void emit(PrintStream stream, int indent) {
  88         for (int i = 0; i < indent; i++) {
  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 
 130     public void setBci(int bci) {
 131         this.bci = bci;
 132     }
 133 


 169 
 170     public void setReason(String reason) {
 171         this.reason = reason;
 172     }
 173 
 174     public List<CallSite> getCalls() {
 175         return calls;
 176     }
 177 
 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 }
src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/CallSite.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File