|
1 | 1 | /* |
2 | | - * Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
@@ -136,9 +136,6 @@ protected void buildMonitorMap(Map<String, Monitor> map) throws MonitorException |
136 | 136 | // synchronize with the target jvm |
137 | 137 | synchWithTarget(map); |
138 | 138 |
|
139 | | - // work around 1.4.2 counter inititization bugs |
140 | | - kludge(map); |
141 | | - |
142 | 139 | insertedMonitors = new ArrayList<Monitor>(map.values()); |
143 | 140 | } |
144 | 141 |
|
@@ -301,151 +298,6 @@ protected Monitor pollFor(Map<String, Monitor> map, String name, long timeLimit) |
301 | 298 | return monitor; |
302 | 299 | } |
303 | 300 |
|
304 | | - /** |
305 | | - * method to make adjustments for known counter problems. This |
306 | | - * method depends on the availability of certain counters, which |
307 | | - * is generally guaranteed by the synchWithTarget() method. |
308 | | - */ |
309 | | - protected void kludge(Map<String, Monitor> map) { |
310 | | - if (Boolean.getBoolean("sun.jvmstat.perfdata.disableKludge")) { |
311 | | - // bypass all kludges |
312 | | - return; |
313 | | - } |
314 | | - |
315 | | - String name = "java.vm.version"; |
316 | | - StringMonitor jvm_version = (StringMonitor)map.get(name); |
317 | | - if (jvm_version == null) { |
318 | | - jvm_version = (StringMonitor)findByAlias(name); |
319 | | - } |
320 | | - |
321 | | - name = "java.vm.name"; |
322 | | - StringMonitor jvm_name = (StringMonitor)map.get(name); |
323 | | - if (jvm_name == null) { |
324 | | - jvm_name = (StringMonitor)findByAlias(name); |
325 | | - } |
326 | | - |
327 | | - name = "hotspot.vm.args"; |
328 | | - StringMonitor args = (StringMonitor)map.get(name); |
329 | | - if (args == null) { |
330 | | - args = (StringMonitor)findByAlias(name); |
331 | | - } |
332 | | - |
333 | | - assert ((jvm_name != null) && (jvm_version != null) && (args != null)); |
334 | | - |
335 | | - if (jvm_name.stringValue().indexOf("HotSpot") >= 0) { |
336 | | - if (jvm_version.stringValue().startsWith("1.4.2")) { |
337 | | - kludgeMantis(map, args); |
338 | | - } |
339 | | - } |
340 | | - } |
341 | | - |
342 | | - /** |
343 | | - * method to repair the 1.4.2 parallel scavenge counters that are |
344 | | - * incorrectly initialized by the JVM when UseAdaptiveSizePolicy |
345 | | - * is set. This bug couldn't be fixed for 1.4.2 FCS due to putback |
346 | | - * restrictions. |
347 | | - */ |
348 | | - private void kludgeMantis(Map<String, Monitor> map, StringMonitor args) { |
349 | | - /* |
350 | | - * the HotSpot 1.4.2 JVM with the +UseParallelGC option along |
351 | | - * with its default +UseAdaptiveSizePolicy option has a bug with |
352 | | - * the initialization of the sizes of the eden and survivor spaces. |
353 | | - * See bugid 4890736. |
354 | | - * |
355 | | - * note - use explicit 1.4.2 counter names here - don't update |
356 | | - * to latest counter names or attempt to find aliases. |
357 | | - */ |
358 | | - |
359 | | - String cname = "hotspot.gc.collector.0.name"; |
360 | | - StringMonitor collector = (StringMonitor)map.get(cname); |
361 | | - |
362 | | - if (collector.stringValue().equals("PSScavenge")) { |
363 | | - boolean adaptiveSizePolicy = true; |
364 | | - |
365 | | - /* |
366 | | - * HotSpot processes the -XX:Flags/.hotspotrc arguments prior to |
367 | | - * processing the command line arguments. This allows the command |
368 | | - * line arguments to override any defaults set in .hotspotrc |
369 | | - */ |
370 | | - cname = "hotspot.vm.flags"; |
371 | | - StringMonitor flags = (StringMonitor)map.get(cname); |
372 | | - String allArgs = flags.stringValue() + " " + args.stringValue(); |
373 | | - |
374 | | - /* |
375 | | - * ignore the -XX: prefix as it only applies to the arguments |
376 | | - * passed from the command line (i.e. the invocation api). |
377 | | - * arguments passed through .hotspotrc omit the -XX: prefix. |
378 | | - */ |
379 | | - int ahi = allArgs.lastIndexOf("+AggressiveHeap"); |
380 | | - int aspi = allArgs.lastIndexOf("-UseAdaptiveSizePolicy"); |
381 | | - |
382 | | - if (ahi != -1) { |
383 | | - /* |
384 | | - * +AggressiveHeap was set, check if -UseAdaptiveSizePolicy |
385 | | - * is set after +AggressiveHeap. |
386 | | - */ |
387 | | - // |
388 | | - if ((aspi != -1) && (aspi > ahi)) { |
389 | | - adaptiveSizePolicy = false; |
390 | | - } |
391 | | - } else { |
392 | | - /* |
393 | | - * +AggressiveHeap not set, must be +UseParallelGC. The |
394 | | - * relative position of -UseAdaptiveSizePolicy is not |
395 | | - * important in this case, as it will override the |
396 | | - * UseParallelGC default (+UseAdaptiveSizePolicy) if it |
397 | | - * appears anywhere in the JVM arguments. |
398 | | - */ |
399 | | - if (aspi != -1) { |
400 | | - adaptiveSizePolicy = false; |
401 | | - } |
402 | | - } |
403 | | - |
404 | | - if (adaptiveSizePolicy) { |
405 | | - // adjust the buggy AdaptiveSizePolicy size counters. |
406 | | - |
407 | | - // first remove the real counters. |
408 | | - String eden_size = "hotspot.gc.generation.0.space.0.size"; |
409 | | - String s0_size = "hotspot.gc.generation.0.space.1.size"; |
410 | | - String s1_size = "hotspot.gc.generation.0.space.2.size"; |
411 | | - map.remove(eden_size); |
412 | | - map.remove(s0_size); |
413 | | - map.remove(s1_size); |
414 | | - |
415 | | - // get the maximum new generation size |
416 | | - String new_max_name = "hotspot.gc.generation.0.capacity.max"; |
417 | | - LongMonitor new_max = (LongMonitor)map.get(new_max_name); |
418 | | - |
419 | | - /* |
420 | | - * replace the real counters with pseudo counters that are |
421 | | - * initialized to the correct values. The maximum size of |
422 | | - * the eden and survivor spaces are supposed to be: |
423 | | - * max_eden_size = new_size - (2*alignment). |
424 | | - * max_survivor_size = new_size - (2*alignment). |
425 | | - * since we don't know the alignment value used, and because |
426 | | - * of other parallel scavenge bugs that result in oversized |
427 | | - * spaces, we just set the maximum size of each space to the |
428 | | - * full new gen size. |
429 | | - */ |
430 | | - Monitor monitor = null; |
431 | | - |
432 | | - LongBuffer lb = LongBuffer.allocate(1); |
433 | | - lb.put(new_max.longValue()); |
434 | | - monitor = new PerfLongMonitor(eden_size, Units.BYTES, |
435 | | - Variability.CONSTANT, false, lb); |
436 | | - map.put(eden_size, monitor); |
437 | | - |
438 | | - monitor = new PerfLongMonitor(s0_size, Units.BYTES, |
439 | | - Variability.CONSTANT, false, lb); |
440 | | - map.put(s0_size, monitor); |
441 | | - |
442 | | - monitor = new PerfLongMonitor(s1_size, Units.BYTES, |
443 | | - Variability.CONSTANT, false, lb); |
444 | | - map.put(s1_size, monitor); |
445 | | - } |
446 | | - } |
447 | | - } |
448 | | - |
449 | 301 | /** |
450 | 302 | * method to extract the next monitor entry from the instrumentation memory. |
451 | 303 | * assumes that nextEntry is the offset into the byte array |
|
0 commit comments