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

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

Print this page




  26  * The main command line driver of a parser for LogCompilation output.
  27  * @author never
  28  */
  29 
  30 package com.sun.hotspot.tools.compiler;
  31 
  32 import java.io.PrintStream;
  33 import java.util.*;
  34 import org.xml.sax.*;
  35 import org.xml.sax.helpers.*;
  36 
  37 public class LogCompilation extends DefaultHandler implements ErrorHandler, Constants {
  38 
  39     public static void usage(int exitcode) {
  40         System.out.println("Usage: LogCompilation [ -v ] [ -c ] [ -s ] [ -e | -N ] file1 ...");
  41         System.out.println("  -c:   clean up malformed 1.5 xml");
  42         System.out.println("  -i:   print inlining decisions");
  43         System.out.println("  -S:   print compilation statistics");
  44         System.out.println("  -s:   sort events by start time");
  45         System.out.println("  -e:   sort events by elapsed time");
  46         System.out.println("  -N:   sort events by name and start");
  47         System.exit(exitcode);
  48     }
  49 
  50     public static void main(String[] args) throws Exception {
  51         Comparator<LogEvent> defaultSort = LogParser.sortByStart;
  52         boolean statistics = false;
  53         boolean printInlining = false;
  54         boolean cleanup = false;
  55         int index = 0;
  56 
  57         while (args.length > index) {
  58             if (args[index].equals("-e")) {
  59                 defaultSort = LogParser.sortByElapsed;
  60                 index++;
  61             } else if (args[index].equals("-n")) {
  62                 defaultSort = LogParser.sortByNameAndStart;
  63                 index++;
  64             } else if (args[index].equals("-s")) {
  65                 defaultSort = LogParser.sortByStart;
  66                 index++;


 120         for (LogEvent e : events) {
 121             if (e instanceof Compilation) {
 122                 Compilation c = (Compilation) e;
 123                 c.printShort(out);
 124                 out.printf(" %6.4f\n", c.getElapsedTime());
 125                 attempts[c.getAttempts()]++;
 126                 maxattempts = Math.max(maxattempts,c.getAttempts());
 127                 elapsed += c.getElapsedTime();
 128                 for (Phase phase : c.getPhases()) {
 129                     Double v = phaseTime.get(phase.getName());
 130                     if (v == null) {
 131                         v = Double.valueOf(0.0);
 132                     }
 133                     phaseTime.put(phase.getName(), Double.valueOf(v.doubleValue() + phase.getElapsedTime()));
 134 
 135                     Integer v2 = phaseNodes.get(phase.getName());
 136                     if (v2 == null) {
 137                         v2 = Integer.valueOf(0);
 138                     }
 139                     phaseNodes.put(phase.getName(), Integer.valueOf(v2.intValue() + phase.getNodes()));
 140                     out.printf("\t%s %6.4f %d %d\n", phase.getName(), phase.getElapsedTime(), phase.getStartNodes(), phase.getNodes());




 141                 }
 142             } else if (e instanceof MakeNotEntrantEvent) {
 143                 MakeNotEntrantEvent mne = (MakeNotEntrantEvent) e;
 144                 NMethod nm = mne.getNMethod();
 145                 if (mne.isZombie()) {
 146                     if (nm == null) {
 147                         System.err.println(mne.getId());
 148                     }
 149                     cacheSize -= nm.getSize();
 150                     nmethodsLive--;
 151                 }
 152             } else if (e instanceof NMethod) {
 153                 nmethodsLive++;
 154                 nmethodsCreated++;
 155                 NMethod nm = (NMethod) e;
 156                 cacheSize += nm.getSize();
 157                 maxCacheSize = Math.max(cacheSize, maxCacheSize);
 158             }
 159         }
 160         out.printf("NMethods: %d created %d live %d bytes (%d peak) in the code cache\n",


  26  * The main command line driver of a parser for LogCompilation output.
  27  * @author never
  28  */
  29 
  30 package com.sun.hotspot.tools.compiler;
  31 
  32 import java.io.PrintStream;
  33 import java.util.*;
  34 import org.xml.sax.*;
  35 import org.xml.sax.helpers.*;
  36 
  37 public class LogCompilation extends DefaultHandler implements ErrorHandler, Constants {
  38 
  39     public static void usage(int exitcode) {
  40         System.out.println("Usage: LogCompilation [ -v ] [ -c ] [ -s ] [ -e | -N ] file1 ...");
  41         System.out.println("  -c:   clean up malformed 1.5 xml");
  42         System.out.println("  -i:   print inlining decisions");
  43         System.out.println("  -S:   print compilation statistics");
  44         System.out.println("  -s:   sort events by start time");
  45         System.out.println("  -e:   sort events by elapsed time");
  46         System.out.println("  -n:   sort events by name and start");
  47         System.exit(exitcode);
  48     }
  49 
  50     public static void main(String[] args) throws Exception {
  51         Comparator<LogEvent> defaultSort = LogParser.sortByStart;
  52         boolean statistics = false;
  53         boolean printInlining = false;
  54         boolean cleanup = false;
  55         int index = 0;
  56 
  57         while (args.length > index) {
  58             if (args[index].equals("-e")) {
  59                 defaultSort = LogParser.sortByElapsed;
  60                 index++;
  61             } else if (args[index].equals("-n")) {
  62                 defaultSort = LogParser.sortByNameAndStart;
  63                 index++;
  64             } else if (args[index].equals("-s")) {
  65                 defaultSort = LogParser.sortByStart;
  66                 index++;


 120         for (LogEvent e : events) {
 121             if (e instanceof Compilation) {
 122                 Compilation c = (Compilation) e;
 123                 c.printShort(out);
 124                 out.printf(" %6.4f\n", c.getElapsedTime());
 125                 attempts[c.getAttempts()]++;
 126                 maxattempts = Math.max(maxattempts,c.getAttempts());
 127                 elapsed += c.getElapsedTime();
 128                 for (Phase phase : c.getPhases()) {
 129                     Double v = phaseTime.get(phase.getName());
 130                     if (v == null) {
 131                         v = Double.valueOf(0.0);
 132                     }
 133                     phaseTime.put(phase.getName(), Double.valueOf(v.doubleValue() + phase.getElapsedTime()));
 134 
 135                     Integer v2 = phaseNodes.get(phase.getName());
 136                     if (v2 == null) {
 137                         v2 = Integer.valueOf(0);
 138                     }
 139                     phaseNodes.put(phase.getName(), Integer.valueOf(v2.intValue() + phase.getNodes()));
 140                     /* Print phase name, elapsed time, nodes at the start of the phase,
 141                        nodes created in the phase, live nodes at the start of the phase,
 142                        live nodes added in the phase.
 143                     */
 144                     out.printf("\t%s %6.4f %d %d %d %d\n", phase.getName(), phase.getElapsedTime(), phase.getStartNodes(), phase.getNodes(), phase.getStartLiveNodes(), phase.getLiveNodes());
 145                 }
 146             } else if (e instanceof MakeNotEntrantEvent) {
 147                 MakeNotEntrantEvent mne = (MakeNotEntrantEvent) e;
 148                 NMethod nm = mne.getNMethod();
 149                 if (mne.isZombie()) {
 150                     if (nm == null) {
 151                         System.err.println(mne.getId());
 152                     }
 153                     cacheSize -= nm.getSize();
 154                     nmethodsLive--;
 155                 }
 156             } else if (e instanceof NMethod) {
 157                 nmethodsLive++;
 158                 nmethodsCreated++;
 159                 NMethod nm = (NMethod) e;
 160                 cacheSize += nm.getSize();
 161                 maxCacheSize = Math.max(cacheSize, maxCacheSize);
 162             }
 163         }
 164         out.printf("NMethods: %d created %d live %d bytes (%d peak) in the code cache\n",
src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/LogCompilation.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File