File tree Expand file tree Collapse file tree 7 files changed +39
-5
lines changed
src/org/graalvm/visualvm/application/views/monitor
src/org/graalvm/visualvm/application/jvm
src/org/graalvm/visualvm/jvm Expand file tree Collapse file tree 7 files changed +39
-5
lines changed Original file line number Diff line number Diff line change @@ -5,5 +5,5 @@ OpenIDE-Module: org.graalvm.visualvm.application/0
5
5
OpenIDE-Module-Layer: org/graalvm/visualvm/application/resources/layer.xml
6
6
OpenIDE-Module-Install: org/graalvm/visualvm/application/Installer.class
7
7
OpenIDE-Module-Localizing-Bundle: org/graalvm/visualvm/application/resources/Bundle.properties
8
- OpenIDE-Module-Specification-Version: 1.12
8
+ OpenIDE-Module-Specification-Version: 1.13
9
9
Original file line number Diff line number Diff line change @@ -355,6 +355,23 @@ public HeapHistogram takeHeapHistogram() {
355
355
return null ;
356
356
}
357
357
358
+ /**
359
+ * Returns the number of processors available to the Java virtual machine.
360
+ *
361
+ * <p> This value may change during a particular invocation of the virtual
362
+ * machine. Applications that are sensitive to the number of available
363
+ * processors should therefore occasionally poll this property and adjust
364
+ * their resource usage appropriately. </p>
365
+ *
366
+ * @return the maximum number of processors available to the virtual
367
+ * machine; never smaller than one
368
+ * @since VisualVM 2.0
369
+ */
370
+ public int getAvailableProcessors () {
371
+ // default implementation
372
+ return 1 ;
373
+ }
374
+
358
375
/**
359
376
* provides access to current values of monitored data in instance of {@link MonitoredData}.
360
377
* The methods may return <CODE>null</CODE> if the {@link MonitoredData} are not available
Original file line number Diff line number Diff line change 12
12
<compile-dependency />
13
13
<run-dependency >
14
14
<release-version >0</release-version >
15
- <specification-version >1.7 </specification-version >
15
+ <specification-version >1.13 </specification-version >
16
16
</run-dependency >
17
17
</dependency >
18
18
<dependency >
Original file line number Diff line number Diff line change @@ -463,6 +463,7 @@ private void initialize(Application application) {
463
463
heapName = names [0 ];
464
464
permgenName = names [1 ];
465
465
}
466
+ processorsCount = jvm .getAvailableProcessors ();
466
467
}
467
468
468
469
memoryMXBean = null ;
@@ -471,8 +472,6 @@ private void initialize(Application application) {
471
472
JvmMXBeans mxbeans = JvmMXBeansFactory .getJvmMXBeans (jmxModel );
472
473
if (mxbeans != null ) {
473
474
memoryMXBean = mxbeans .getMemoryMXBean ();
474
- OperatingSystemMXBean osbean = mxbeans .getOperatingSystemMXBean ();
475
- if (osbean != null ) processorsCount = osbean .getAvailableProcessors ();
476
475
}
477
476
}
478
477
Original file line number Diff line number Diff line change 12
12
<compile-dependency />
13
13
<run-dependency >
14
14
<release-version >0</release-version >
15
- <specification-version >1.11 </specification-version >
15
+ <specification-version >1.13 </specification-version >
16
16
</run-dependency >
17
17
</dependency >
18
18
<dependency >
Original file line number Diff line number Diff line change @@ -492,6 +492,16 @@ public boolean isCollectionTimeSupported() {
492
492
return gcList != null && !gcList .isEmpty ();
493
493
}
494
494
495
+ @ Override
496
+ public int getAvailableProcessors () {
497
+ int processors = jmxSupport .getAvailableProcessors ();
498
+
499
+ if (processors != -1 ) {
500
+ return processors ;
501
+ }
502
+ return super .getAvailableProcessors ();
503
+ }
504
+
495
505
public MonitoredData getMonitoredData () {
496
506
if (application .getState () == Stateful .STATE_AVAILABLE ) {
497
507
if (monitoredVm != null ) {
Original file line number Diff line number Diff line change @@ -152,6 +152,14 @@ long getProcessCPUTime() {
152
152
return -1 ;
153
153
}
154
154
155
+ int getAvailableProcessors () {
156
+ JvmMXBeans jmx = getJvmMXBeans ();
157
+ if (jmx != null ) {
158
+ return jmx .getOperatingSystemMXBean ().getAvailableProcessors ();
159
+ }
160
+ return -1 ;
161
+ }
162
+
155
163
synchronized JvmMXBeans getJvmMXBeans () {
156
164
if (mxbeans == null ) {
157
165
JmxModel jmxModel = JmxModelFactory .getJmxModelFor (application );
You can’t perform that action at this time.
0 commit comments