[转帖]2.20 Native Operating System Tools
https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr020.html#BABBHHIE
2.20 Native Operating System Tools
This section lists a number of native tools available on Windows, Linux, and Oracle Solaris operating systems that are useful for troubleshooting or monitoring purposes. A brief description is provided for each tool. For further details, refer to the operating system documentation (or man pages for Oracle Solaris and Linux operating systems).
The format of log files and output from command-line utilities depends on the release. For example, if you develop a script that relies on the format of the fatal error log, then the same script may not work if the format of the log file changes in a future release.
You can also search for Windows-specific debug support on MSDN developer network.
The following sections describe troubleshooting techniques and improvements to a few native operating system tools.
2.20.1 DTrace Tool
Oracle Solaris 10 operating system includes the DTrace tool, which allows dynamic tracing of the operating system kernel and user-level programs. This tool supports scripting at system-call entry and exit, at user-mode function entry and exit, and at many other probe points. The scripts are written in the D programming language, which is a C-like language with safe pointer semantics. These scripts can help you in troubleshooting problems or solving performance issues.
The dtrace
command is a generic front end to the DTrace tool. This command provides a simple interface to invoke the D language, to retrieve buffered trace data, and to access a set of basic routines to format and print traced data.
You can write your own customized DTrace scripts, using the D language, or download and use one or more of the many scripts that are already available on various sites.
The probes are delivered and instrumented by kernel modules called providers. The types of tracing offered by the probe providers include user instruction tracing, function boundary tracing, kernel lock instrumentation, profile interrupt, system call tracing, and many more. If you write your own scripts, you use the D language to enable the probes; this language also allows conditional tracing and output formatting.
You can use the dtrace -l
command to explore the set of providers and probes that are available on your Oracle Solaris operating system.
The DTraceToolkit is a collection of useful documented scripts developed by the Open Oracle Solaris DTrace community. For more information about the DTraceToolkit, see the DTraceToolkit.
For more information about dynamic tracing in general, see the Solaris Dynamic Tracing Guide.
2.20.2 Probe Providers in Java HotSpot VM
The Java HotSpot VM contains two built-in probe providers: hotspot
and hotspot_jni
. These providers deliver probes that can be used to monitor the internal state and activities of the VM, as well as the Java application that is running.
The JVM probe providers can be categorized as follows:
VM lifecycle: VM initialization begin and end, and VM shutdown
Thread lifecycle: thread start and stop, thread name, thread ID, and so on
Class-loading: Java class loading and unloading
Garbage collection: start and stop of garbage collection, systemwide or by memory pool
Method compilation: method compilation begin and end, and method loading and unloading
Monitor probes: wait events, notification events, contended monitor entry and exit
Application tracking: method entry and return, allocation of a Java object
In order to call from native code to Java code, the native code must make a call through the JNI interface. The hotspot_jni
provider manages DTrace probes at the entry point and return point for each of the methods that the JNI interface provides for invoking Java code and examining the state of the VM.
At probe points, you can print the stack trace of the current thread using the ustack
built-in function. This function prints Java method names in addition to C/C++ native function names. Example 2-38 is a simple D script that prints a full stack trace whenever a thread calls the read
system call.
Example 2-38 Stack Trace at Probe Points with DTrace
#!/usr/sbin/dtrace -s
syscall::read:entry
/pid == $1 && tid == 1/ {
ustack(50, 0x2000);
}
The script in Example 2-38 is stored in a file named read.d
and is run by specifying the PID of the Java process that is traced as shown in Example 2-39.
Example 2-39 Run Dscript with the PID
read.d pid
If your Java application generated a lot of I/O or had some unexpected latency, then the DTrace tool and its ustack()
action can help you diagnose the problem.
2.20.3 Improvements to pmap Tool
The pmap
utility was improved in Oracle Solaris 10 operating system to print stack segments with the text [stack]
. This text helps you to locate the stack easily.
Example 2-40 shows the stack trace with improved pmap tool.
Example 2-40 Stack Trace with Improved pmap Tool
19846: /net/myserver/export1/user/j2sdk6/bin/java -Djava.endorsed.d
00010000 72K r-x-- /export/disk09/jdk/6/rc/b63/binaries/solsparc/bin/java
00030000 16K rwx-- /export/disk09/jdk/6/rc/b63/binaries/solsparc/bin/java
00034000 32544K rwx-- [ heap ]
D1378000 32K rwx-R [ stack tid=44 ]
D1478000 32K rwx-R [ stack tid=43 ]
D1578000 32K rwx-R [ stack tid=42 ]
D1678000 32K rwx-R [ stack tid=41 ]
D1778000 32K rwx-R [ stack tid=40 ]
D1878000 32K rwx-R [ stack tid=39 ]
D1974000 48K rwx-R [ stack tid=38 ]
D1A78000 32K rwx-R [ stack tid=37 ]
D1B78000 32K rwx-R [ stack tid=36 ]
[.. more lines removed here to reduce output ..]
FF370000 8K r-x-- /usr/lib/libsched.so.1
FF380000 8K r-x-- /platform/sun4u-us3/lib/libc_psr.so.1
FF390000 16K r-x-- /lib/libthread.so.1
FF3A4000 8K rwx-- /lib/libthread.so.1
FF3B0000 8K r-x-- /lib/libdl.so.1
FF3C0000 168K r-x-- /lib/ld.so.1
FF3F8000 8K rwx-- /lib/ld.so.1
FF3FA000 8K rwx-- /lib/ld.so.1
FFB80000 24K ----- [ anon ]
FFBF0000 64K rwx-- [ stack ]
total 167224K
2.20.4 Improvements to pstack Tool
Prior to Oracle Solaris 10 operating system, the pstack
utility did not support Java. It printed hexadecimal addresses for both interpreted and compiled Java methods.
Starting with Oracle Solaris 10 operating system, the pstack
command-line tool prints mixed mode stack traces (Java and C/C++ frames) from a core file or a live process. The tool prints Java method names for interpreted, compiled, and inlined Java methods.
[转帖]2.20 Native Operating System Tools的更多相关文章
- SI - 系统 - 操作系统简述 (Operating System)
Unix 操作系统:System V.BSD Microsoft Windows Apple Mac OS Linux FreeBSD 安装 https://jingyan.baidu.com/art ...
- General-Purpose Operating System Protection Profile
1 Protection Profile Introduction This document defines the security functionality expected to be ...
- Unable to open the physical file xxxx. Operating system error 2
在新UAT服务器上,需要将tempdb放置在SSD(固态硬盘)上.由于SSD(固态硬盘)特性,所以tempdb的文件只能放置在D盘下面,而不能是D盘下的某一个目录下面. ALTER DATABASE ...
- Full exploitation of a cluster hardware configuration requires some enhancements to a single-system operating system.
COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION Operating System Desi ...
- osquery An Operating System Instrumentation Framewor
catalog . Getting Started . install guide for OS X and Linux . Features Overview . Logging . query e ...
- IX-Protected Dataplane Operating System解读
一.概述 商业操作系统在应用程序每秒钟需要数百万次操作时才能保持高吞吐量和低(尾)延迟,对于最慢的请求只需几百微秒.通常认为对于高性能网络(小信息的高包率.低延迟)的构建,最好都是在内核之外构建用户态 ...
- 快速了解 Robot Operating System(ROS) 机器人操作系统
http://www.ros.org/ 关于ROS About ROS http://www.ros.org/about-ros/ 机器人操作系统(ROS)是用于编写机器人软件的灵活框架.目的在简化 ...
- How to Make a Computer Operating System
How to Make a Computer Operating System 如何制作一个操作系统(翻译版) 原文地址:Github:How to Make a Computer Operating ...
- OSMC Vs. OpenELEC Vs. LibreELEC – Kodi Operating System Comparison
Kodi's two slim-and-trim kid brothers LibreELEC and OpenELEC were once great solutions for getting t ...
- PatentTips - Method for guest operating system integrity validation
BACKGROUND The embodiments relate to guest operating system integrity validation, and more particula ...
随机推荐
- 共赴元宇宙新纪元,华为云VR开发应用大赛总决赛倒计时7天!
摘要:"第三届华为云VR开发应用暨沈阳元宇宙开发应用大赛"总决赛即将于2月13日在沈阳市和平区揭幕. 由沈阳市和平区人民政府.华为技术有限公司共同主办的"第三届华为云VR ...
- Python中Round函数:怎么解释?怎么用?
摘要:在本文中,介绍了什么是round函数以及如何从python内核中实现它.同时,还介绍舍入函数的一些缺点,以及如何纠正它们,如何在数据科学中广泛使用的库中发挥作用. Python中的舍入函数,返回 ...
- 云小课 | 华为云KYON之L2CG
摘要:本文介绍KYON独创的L2CG,打通大二层网络,支持企业携带私网IP直接上云,让业务敏捷迁移,大幅降低企业上云的复杂度和成本.同时支持虚拟机粒度迁移,让企业上云过程中无需迁移整个子网. 本文分享 ...
- 如何利用 A/B 实验提升产品用户留存? 看字节实战案例给你答案!
技术交流.求职机会,欢迎关注字节跳动数据平台微信公众号,回复[1]进入官方交流群 产品增长中最为经典的模型为 AARRR 漏斗模型,该模型追求最大化拉新,第一步"获客"(Acqui ...
- PPT 玩转形状
形状 https://www.cnblogs.com/vipsoft/p/16943810.html 形状也可以非常复杂 形状的神奇功能--合并形状 编辑顶点 https://www.cnblogs. ...
- python虚拟环境venv
Python3虚拟环境是为了在开发过程中隔离项目所需的 Python 环境.虚拟环境允许我们在同一台计算机上的不同项目中使用不同的 Python 版本和软件包,而不会相互干扰 首先创建一个虚拟环境的工 ...
- AliAGC 自动增益控制算法:解决复杂场景下的音量问题
音视频会议,直播连麦以及短视频已经成为人们工作.教学以及娱乐的一部分,其背后都离不开音视频实时通信等关键技术的广泛应用.音频方面,可预见的是客户业务形式的多样性,环境的复杂性,以及接入设备的差异性会带 ...
- WSL2 配置 ArchLinux 初始化环境
这篇文章针对的是在 Win11 系统的 WSL2 下安装 ArchLinux 系统, 网上很多中文教程都是使用 LxRunOffline 去做的,但是实际上该方法已经过时了,目前有更加先进的ArchW ...
- L2-030 冰岛人 (25 分) (阅读理解)
补题链接:Here 2018年世界杯,冰岛队因1:1平了强大的阿根廷队而一战成名.好事者发现冰岛人的名字后面似乎都有个"松"(son),于是有网友科普如下: 冰岛人沿用的是维京人古 ...
- AtCoder Beginner Contest 177 (个人题解,C后缀和,D并查集,E质因数分解)
补题链接:Here A - Don't be late 题意:高桥(Takahashi )现在要去距离家 \(D\) 米的地方面基,请问如果以最高速度 \(S\) 能否再 \(T\) 时刻准时到达? ...