< prev index next >

src/jdk/nashorn/internal/runtime/Timing.java

Print this page
rev 1901 : 8135251: Use Unsafe.defineAnonymousClass for loading Nashorn script code
Reviewed-by: hannesw, lagergren, sundar


 206                 len = sb.length() - len;
 207 
 208                 while (len++ < maxKeyLength) {
 209                     sb.append(' ');
 210                 }
 211 
 212                 final long duration = timings.get(timingName).longValue();
 213                 final String strDuration = toMillisPrint(duration);
 214                 len = strDuration.length();
 215                 for (int i = 0; i < maxValueLength - len; i++) {
 216                     sb.append(' ');
 217                 }
 218 
 219                 sb.append(strDuration).
 220                     append(" ms\n");
 221 
 222                 knownTime += duration;
 223             }
 224 
 225             final long total = t - startTime;
 226             sb.append('\n');
 227             sb.append("Total runtime: ").
 228                 append(toMillisPrint(total)).
 229                 append(" ms (Non-runtime: ").
 230                 append(toMillisPrint(knownTime)).
 231                 append(" ms [").
 232                 append((int)(knownTime * 100.0 / total)).
 233                 append("%])");
 234 
 235             sb.append("\n\nEmitted compile units: ").
 236                 append(CompileUnit.getEmittedUnitCount());
 237 
 238             return sb.toString();


 239         }
 240 
 241         private void accumulateTime(final String module, final long duration) {
 242             timings.computeIfAbsent(module, newTimingCreator).add(duration);
 243         }
 244     }
 245 }


 206                 len = sb.length() - len;
 207 
 208                 while (len++ < maxKeyLength) {
 209                     sb.append(' ');
 210                 }
 211 
 212                 final long duration = timings.get(timingName).longValue();
 213                 final String strDuration = toMillisPrint(duration);
 214                 len = strDuration.length();
 215                 for (int i = 0; i < maxValueLength - len; i++) {
 216                     sb.append(' ');
 217                 }
 218 
 219                 sb.append(strDuration).
 220                     append(" ms\n");
 221 
 222                 knownTime += duration;
 223             }
 224 
 225             final long total = t - startTime;
 226             return sb.append("\nTotal runtime: ").

 227                 append(toMillisPrint(total)).
 228                 append(" ms (Non-runtime: ").
 229                 append(toMillisPrint(knownTime)).
 230                 append(" ms [").
 231                 append((int)(knownTime * 100.0 / total)).
 232                 append("%])").
 233                 append("\n\nEmitted compile units: ").
 234                 append(CompileUnit.getEmittedUnitCount()).
 235                 append("\nCompile units installed as named classes: ").
 236                 append(Context.getNamedInstalledScriptCount()).
 237                 append("\nCompile units installed as anonymous classes: ").
 238                 append(Context.getAnonymousInstalledScriptCount()).
 239                 toString();
 240         }
 241 
 242         private void accumulateTime(final String module, final long duration) {
 243             timings.computeIfAbsent(module, newTimingCreator).add(duration);
 244         }
 245     }
 246 }
< prev index next >