首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

Eclipse OpenJ9 中的类共享(4)verbose 选项

Eclipse OpenJ9 中的类共享(4)verbose 选项

verbose 选项verbose 选项提供了关于类共享正在做什么的有用反馈。它们都是 -Xshareclasses                                的子选项。本节将提供如何使用详细输出的一些示例。
verbose 选项(参加清单 7)提供了关于 JVM 启动和关闭的简要状态信息:
清单 7. 获取 JVM                                状态信息
1
2
3
4
5
6
7
8
9
C:\OpenJ9>wa6480_openj9\j2sdk-image\bin\java -Xshareclasses:name=Cache1,verbose Hello
[-Xshareclasses persistent cache enabled]
[-Xshareclasses verbose output enabled]
JVMSHRC236I Created shared classes persistent cache Cache1
JVMSHRC246I Attached shared classes persistent cache Cache1
JVMSHRC765I Memory page protection on runtime data, string read-write data and partially filled pages is successfully enabled
Hello
JVMSHRC168I Total shared class bytes read=11088.Total bytes stored=2416962
JVMSHRC818I Total unstored bytes due to the setting of shared cache soft max is 0.Unstored AOT bytes due to the setting of -Xscmaxaot is 0.Unstored JIT bytes due to the setting of -Xscmaxjitdata is 0.




verboseIO 将每个类加载请求的一个状态行输出到共享缓存。要理解 verboseIO                                的输出,应该了解类加载器的分层结构,因为这可以让您清楚地看出由任何非引导程序类加载器加载的类。在输出中,为每个类加载器都分配了一个唯一                                ID,但引导程序加载器的 ID 始终为 0。
请注意,有时候即使类已经缓存,verboseIO                                仍然显示正在从磁盘加载类并存储到缓存中,这是正常的。例如,从应用程序类路径上的每个 JAR                                加载的第一个类无论它是否存在于缓存中,总是从磁盘加载并存储。这是为了确认类路径中的 JAR 确实已存在于文件系统上。
在清单 8 中,第一部分演示了缓存的填充,第二部分演示了缓存类的读取:
清单 8. 使用                                verboseIO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
C:\OpenJ9>wa6480_openj9\j2sdk-image\bin\java -Xshareclasses:name=Cache1,verboseIO Hello
[-Xshareclasses verbose I/O output enabled]
Failed to find class java/lang/Object in shared cache for class-loader id 0.
Stored class java/lang/Object in shared cache for class-loader id 0 with URL C:\OpenJ9\wa6480_openj9\j2sdk-image\jre\lib\rt.jar (index 2).
Failed to find class java/lang/J9VMInternals in shared cache for class-loader id 0.
Stored class java/lang/J9VMInternals in shared cache for class-loader id 0 with URL C:\OpenJ9\wa6480_openj9\j2sdk-image\jre\lib\rt.jar (index 2).
Failed to find class com/ibm/oti/vm/VM in shared cache for class-loader id 0.
Stored class com/ibm/oti/vm/VM in shared cache for class-loader id 0 with URL C:\OpenJ9\wa6480_openj9\j2sdk-image\jre\lib\rt.jar (index 2).
Failed to find class java/lang/J9VMInternals$ClassInitializationLock in shared cache for class-loader id 0.


C:\OpenJ9>wa6480_openj9\j2sdk-image\bin\java -Xshareclasses:name=Cache1,verboseIO Hello
[-Xshareclasses verbose I/O output enabled]
Found class java/lang/Object in shared cache for class-loader id 0.
Found class java/lang/J9VMInternals in shared cache for class-loader id 0.
Found class com/ibm/oti/vm/VM in shared cache for class-loader id 0.
Found class java/lang/J9VMInternals$ClassInitializationLock in shared cache for class-loader id 0.






verboseHelper 子选项(参见清单 9)是一个高级选项,提供了来自 Helper API                                        的状态输出。verboseHelper 子选项可以帮助使用 Helper API                                        的开发人员了解它的驱动方式。 中介绍了关于此输出的更多细节。
清单 9. 来自 Helper API                                的状态输出
1
2
3
4
5
6
7
8
9
10
11
C:\OpenJ9>wa6480_openj9\j2sdk-image\bin\java -Xshareclasses:name=Cache1,verboseHelper Hello
[-Xshareclasses Helper API verbose output enabled]
Info for SharedClassURLClasspathHelper id 1: Verbose output enabled for SharedClassURLClasspathHelper id 1
Info for SharedClassURLClasspathHelper id 1: Created SharedClassURLClasspathHelper with id 1
Info for SharedClassURLClasspathHelper id 2: Verbose output enabled for SharedClassURLClasspathHelper id 2
Info for SharedClassURLClasspathHelper id 2: Created SharedClassURLClasspathHelper with id 2
Info for SharedClassURLClasspathHelper id 1: There are no confirmed elements in the classpath.Returning null.
Info for SharedClassURLClasspathHelper id 2: There are no confirmed elements in the classpath.Returning null.
Info for SharedClassURLClasspathHelper id 2: setClasspath() updated classpath.No invalid URLs found
Info for SharedClassURLClasspathHelper id 2: Number of confirmed entries is now 1
Hello




verboseAOT 和 -Xjit:verbose 子选项提供了从/向共享缓存执行 AOT                                加载和存储的相关信息,如清单 10 所示。
清单 10. AOT 加载和存储的 Verbose                                信息
1
2
3
4
5
6
7
8
C:\OpenJ9>wa6480_openj9\j2sdk-image\bin\java -Xshareclasses:name=demo,verboseAOT -Xjit:verbose -cp shcdemo.jar ClassLoadStress

+ (AOT cold) java/nio/Bits.makeChar(BB)C @ 0x00000000540049E0-0x0000000054004ABF OrdinaryMethod - Q_SZ=2 Q_SZI=2 QW=6 j9m=0000000004A4B690 bcsz=12 GCR compThread=1 CpuLoad=298%(37%avg) JvmCpu=175%
Stored AOT code for ROMMethod 0x00000000123C2168 in shared cache.

+ (AOT load) java/lang/String.substring(II)Ljava/lang/String; @ 0x0000000054017728-0x00000000540179DD Q_SZ=0 Q_SZI=0 QW=1 j9m=00000000049D9DF0 bcsz=100 compThread=0
Found AOT code for ROMMethod 0x0000000012375700 in shared cache.


返回列表