109 long maxCacheSize = 0;
110 int nmethodsCreated = 0;
111 int nmethodsLive = 0;
112 int[] attempts = new int[32];
113 double regallocTime = 0;
114 int maxattempts = 0;
115
116 LinkedHashMap<String, Double> phaseTime = new LinkedHashMap<String, Double>(7);
117 LinkedHashMap<String, Integer> phaseNodes = new LinkedHashMap<String, Integer>(7);
118 double elapsed = 0;
119
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 out.printf("\t%s %6.4f\n", phase.getName(), phase.getElapsedTime());
130 Double v = phaseTime.get(phase.getName());
131 if (v == null) {
132 v = Double.valueOf(0.0);
133 }
134 phaseTime.put(phase.getName(), Double.valueOf(v.doubleValue() + phase.getElapsedTime()));
135
136 Integer v2 = phaseNodes.get(phase.getName());
137 if (v2 == null) {
138 v2 = Integer.valueOf(0);
139 }
140 phaseNodes.put(phase.getName(), Integer.valueOf(v2.intValue() + 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",
|
109 long maxCacheSize = 0;
110 int nmethodsCreated = 0;
111 int nmethodsLive = 0;
112 int[] attempts = new int[32];
113 double regallocTime = 0;
114 int maxattempts = 0;
115
116 LinkedHashMap<String, Double> phaseTime = new LinkedHashMap<String, Double>(7);
117 LinkedHashMap<String, Integer> phaseNodes = new LinkedHashMap<String, Integer>(7);
118 double elapsed = 0;
119
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",
|