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.

Contents   Previous   Next

[转帖]2.20 Native Operating System Tools的更多相关文章

  1. SI - 系统 - 操作系统简述 (Operating System)

    Unix 操作系统:System V.BSD Microsoft Windows Apple Mac OS Linux FreeBSD 安装 https://jingyan.baidu.com/art ...

  2. General-Purpose Operating System Protection Profile

    1 Protection Profile Introduction   This document defines the security functionality expected to be ...

  3. Unable to open the physical file xxxx. Operating system error 2

    在新UAT服务器上,需要将tempdb放置在SSD(固态硬盘)上.由于SSD(固态硬盘)特性,所以tempdb的文件只能放置在D盘下面,而不能是D盘下的某一个目录下面. ALTER  DATABASE ...

  4. 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 ...

  5. osquery An Operating System Instrumentation Framewor

    catalog . Getting Started . install guide for OS X and Linux . Features Overview . Logging . query e ...

  6. IX-Protected Dataplane Operating System解读

    一.概述 商业操作系统在应用程序每秒钟需要数百万次操作时才能保持高吞吐量和低(尾)延迟,对于最慢的请求只需几百微秒.通常认为对于高性能网络(小信息的高包率.低延迟)的构建,最好都是在内核之外构建用户态 ...

  7. 快速了解 Robot Operating System(ROS) 机器人操作系统

     http://www.ros.org/ 关于ROS About ROS http://www.ros.org/about-ros/ 机器人操作系统(ROS)是用于编写机器人软件的灵活框架.目的在简化 ...

  8. How to Make a Computer Operating System

    How to Make a Computer Operating System 如何制作一个操作系统(翻译版) 原文地址:Github:How to Make a Computer Operating ...

  9. 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 ...

  10. PatentTips - Method for guest operating system integrity validation

    BACKGROUND The embodiments relate to guest operating system integrity validation, and more particula ...

随机推荐

  1. 数据库开发实战教程:使用Python连接Kerberos的Presto

    [摘要]本文将为大家带来Python连接presto开源的两个实践案例. Python连接presto开源提供了以下两个库可以使用 presto-python-client:https://githu ...

  2. 开抢| 华为开发者大会2021(Cloud)早鸟票来了!

    他们,是技术的引领者 他们,是科学的追随者 他们用代码守护蓝色星球的生态 破解宇宙深处的密码 化解城市生活的不畅 捉摸自然气候的脾性 ...... 这些改变世界的成果背后 每一个开发者都了不起 --那 ...

  3. 云小课|VMware备份上云学习专列来了,快加入吧~

    阅识风云是华为云信息大咖,擅长将复杂信息多元化呈现,其出品的一张图(云图说).深入浅出的博文(云小课)或短视频(云视厅)总有一款能让您快速上手华为云.更多精彩内容请单击此处. 摘要:华为云云备份CBR ...

  4. Python 读取图片 转 base64 并生成 JSON

    Python 读取图片 转 base64 并生成 JSON import json import base64 img_path = r'D:\OpenSource\PaddlePaddle\Padd ...

  5. Go--较复杂的结构类型

    一.List List是一种有序的集合,可以包含任意数量的元素.与数组相比,list的长度可以动态调整,可以随时添加或删除元素,类似于切片 在go中,List是一个双向链表的实现. 实例 packag ...

  6. 如临现场的视觉感染力,NBA决赛直播还能这样看?

    在6月16日结束的NBA总决赛中,勇士4-2击败凯尔特人,问鼎总冠军!今年的NBA总决赛吸引了众多关注,互联网各大平台的赛事直播气氛也异常热烈. 平台如何既能展现专业的赛事解说,又能与球迷观众深入互动 ...

  7. 打破虚拟边界的视频交互新方式,AR隔空书写的应用理念和探索实践

    AR隔空书写演示 随着技术的发展和超视频化的时代驱动,交互的形式日渐丰富.从屏幕点触,到语音交互,人脸.指纹.声纹,再到近年流行的AR和VR--人类早在语言出现之前便习惯使用肢体和手势这种近乎本能的沟 ...

  8. vue-cli3开启gzip压缩

    首先添加yarn add 插件 "compression-webpack-plugin" 然后在vue.config.js里引入 在configureWebpack里增加插件代码. ...

  9. java进阶(4)--抽象类与接口的区别

    1.抽象类是半抽象的,接口是全抽象的   2.抽象类中有构造方法,接口中没有构造方法   3.类与类之间不能多继承,接口与接口之间支持多继承   4.一个类可以同时实现多个接口,一个类只能继承一个抽象 ...

  10. 小白学正则表达式之 regexp

    1. 正则表达式介绍 正则表达式是程序文本处理常用的模板模式,按照解析正则表达式的引擎可将正则表达式分为 POSIX 基础正则表达式(Basic regular expression,BRE) 引擎和 ...