118 |
118 |
119 // Only one counter exists with the specified name in the |
119 // Only one counter exists with the specified name in the |
120 // current implementation. We first look up in the SUN_CI namespace |
120 // current implementation. We first look up in the SUN_CI namespace |
121 // since most counters are in SUN_CI namespace. |
121 // since most counters are in SUN_CI namespace. |
122 |
122 |
123 if ((c = (Counter) counters.get(SUN_CI + name)) != null) { |
123 if ((c = counters.get(SUN_CI + name)) != null) { |
124 return c; |
124 return c; |
125 } |
125 } |
126 if ((c = (Counter) counters.get(COM_SUN_CI + name)) != null) { |
126 if ((c = counters.get(COM_SUN_CI + name)) != null) { |
127 return c; |
127 return c; |
128 } |
128 } |
129 if ((c = (Counter) counters.get(JAVA_CI + name)) != null) { |
129 if ((c = counters.get(JAVA_CI + name)) != null) { |
130 return c; |
130 return c; |
131 } |
131 } |
132 |
132 |
133 // FIXME: should tolerate if counter doesn't exist |
133 // FIXME: should tolerate if counter doesn't exist |
134 throw new AssertionError("Counter " + name + " does not exist"); |
134 throw new AssertionError("Counter " + name + " does not exist"); |
135 } |
135 } |
136 |
136 |
137 private void initCompilerCounters() { |
137 private void initCompilerCounters() { |
138 // Build a tree map of the current list of performance counters |
138 // Build a tree map of the current list of performance counters |
139 ListIterator iter = getInternalCompilerCounters().listIterator(); |
139 counters = new TreeMap<>(); |
140 counters = new TreeMap<String, Counter>(); |
140 for (Counter c: getInternalCompilerCounters()) { |
141 while (iter.hasNext()) { |
|
142 Counter c = (Counter) iter.next(); |
|
143 counters.put(c.getName(), c); |
141 counters.put(c.getName(), c); |
144 } |
142 } |
145 |
143 |
146 compilerThreads = (LongCounter) lookup("threads"); |
144 compilerThreads = (LongCounter) lookup("threads"); |
147 totalCompiles = (LongCounter) lookup("totalCompiles"); |
145 totalCompiles = (LongCounter) lookup("totalCompiles"); |
198 public long getCompiledMethodSize() { |
196 public long getCompiledMethodSize() { |
199 return nmethodSize.longValue(); |
197 return nmethodSize.longValue(); |
200 } |
198 } |
201 |
199 |
202 public java.util.List<CompilerThreadStat> getCompilerThreadStats() { |
200 public java.util.List<CompilerThreadStat> getCompilerThreadStats() { |
203 List<CompilerThreadStat> list = new ArrayList<CompilerThreadStat>(threads.length); |
201 List<CompilerThreadStat> list = new ArrayList<>(threads.length); |
204 int i = 0; |
202 int i = 0; |
205 if (threads[0] == null) { |
203 if (threads[0] == null) { |
206 // no adaptor thread |
204 // no adaptor thread |
207 i = 1; |
205 i = 1; |
208 } |
206 } |