author | sundar |
Mon, 15 Sep 2014 15:18:13 +0530 | |
changeset 26647 | a6acc63c2a31 |
parent 25859 | 3317bb8137f4 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
5506 | 2 |
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
package sun.management.snmp.jvminstr; |
|
26 |
||
27 |
// java imports |
|
28 |
// |
|
29 |
import java.io.Serializable; |
|
30 |
import java.lang.management.ManagementFactory; |
|
31 |
import java.lang.management.CompilationMXBean; |
|
32 |
||
33 |
// jmx imports |
|
34 |
// |
|
35 |
import javax.management.MBeanServer; |
|
36 |
import com.sun.jmx.snmp.SnmpString; |
|
37 |
import com.sun.jmx.snmp.SnmpStatusException; |
|
38 |
||
39 |
// jdmk imports |
|
40 |
// |
|
41 |
import com.sun.jmx.snmp.agent.SnmpMib; |
|
42 |
||
43 |
import sun.management.snmp.jvmmib.JvmCompilationMBean; |
|
44 |
import sun.management.snmp.jvmmib.EnumJvmJITCompilerTimeMonitoring; |
|
45 |
import sun.management.snmp.util.MibLogger; |
|
46 |
||
47 |
/** |
|
48 |
* The class is used for implementing the "JvmCompilation" group. |
|
49 |
*/ |
|
50 |
public class JvmCompilationImpl implements JvmCompilationMBean { |
|
51 |
||
52 |
/** |
|
53 |
* Variable for storing the value of "JvmJITCompilerTimeMonitoring". |
|
54 |
* |
|
55 |
* "Indicates whether the Java virtual machine supports |
|
56 |
* compilation time monitoring. |
|
57 |
* |
|
58 |
* See java.management.CompilationMXBean. |
|
59 |
* isCompilationTimeMonitoringSupported() |
|
60 |
* " |
|
61 |
* |
|
62 |
*/ |
|
63 |
static final EnumJvmJITCompilerTimeMonitoring |
|
64 |
JvmJITCompilerTimeMonitoringSupported = |
|
65 |
new EnumJvmJITCompilerTimeMonitoring("supported"); |
|
66 |
static final EnumJvmJITCompilerTimeMonitoring |
|
67 |
JvmJITCompilerTimeMonitoringUnsupported = |
|
68 |
new EnumJvmJITCompilerTimeMonitoring("unsupported"); |
|
69 |
||
70 |
||
71 |
/** |
|
72 |
* Constructor for the "JvmCompilation" group. |
|
73 |
* If the group contains a table, the entries created through an SNMP SET |
|
74 |
* will not be registered in Java DMK. |
|
75 |
*/ |
|
76 |
public JvmCompilationImpl(SnmpMib myMib) { |
|
77 |
} |
|
78 |
||
79 |
||
80 |
/** |
|
81 |
* Constructor for the "JvmCompilation" group. |
|
82 |
* If the group contains a table, the entries created through an SNMP |
|
83 |
* SET will be AUTOMATICALLY REGISTERED in Java DMK. |
|
84 |
*/ |
|
85 |
public JvmCompilationImpl(SnmpMib myMib, MBeanServer server) { |
|
86 |
} |
|
87 |
||
88 |
private static CompilationMXBean getCompilationMXBean() { |
|
89 |
return ManagementFactory.getCompilationMXBean(); |
|
90 |
} |
|
91 |
||
92 |
/** |
|
93 |
* Getter for the "JvmJITCompilerTimeMonitoring" variable. |
|
94 |
*/ |
|
95 |
public EnumJvmJITCompilerTimeMonitoring getJvmJITCompilerTimeMonitoring() |
|
96 |
throws SnmpStatusException { |
|
97 |
||
98 |
// If we reach this point, then we can safely assume that |
|
99 |
// getCompilationMXBean() will not return null, because this |
|
100 |
// object will not be instantiated when there is no compilation |
|
101 |
// system (see JVM_MANAGEMENT_MIB_IMPL). |
|
102 |
// |
|
103 |
if(getCompilationMXBean().isCompilationTimeMonitoringSupported()) |
|
104 |
return JvmJITCompilerTimeMonitoringSupported; |
|
105 |
else |
|
106 |
return JvmJITCompilerTimeMonitoringUnsupported; |
|
107 |
} |
|
108 |
||
109 |
/** |
|
110 |
* Getter for the "JvmJITCompilerTimeMs" variable. |
|
111 |
*/ |
|
112 |
public Long getJvmJITCompilerTimeMs() throws SnmpStatusException { |
|
113 |
final long t; |
|
114 |
if(getCompilationMXBean().isCompilationTimeMonitoringSupported()) |
|
115 |
t = getCompilationMXBean().getTotalCompilationTime(); |
|
116 |
else |
|
117 |
t = 0; |
|
25186
63e1a2ec30f5
8048267: Replace uses of 'new Long()' with appropriate alternative across core classes
prappo
parents:
5506
diff
changeset
|
118 |
return t; |
2 | 119 |
} |
120 |
||
121 |
/** |
|
122 |
* Getter for the "JvmJITCompilerName" variable. |
|
123 |
*/ |
|
124 |
public String getJvmJITCompilerName() throws SnmpStatusException { |
|
125 |
return JVM_MANAGEMENT_MIB_IMPL. |
|
126 |
validJavaObjectNameTC(getCompilationMXBean().getName()); |
|
127 |
} |
|
128 |
||
129 |
} |