[转帖]2.20 Native Operating System Tools

native,operating,system,tools · 浏览次数 : 0

小编点评

**Native Operating System Tools for Troubleshooting and Monitoring** **DTrace Tool** * Provides dynamic tracing of the operating system kernel and user-level programs. * Supports scripting at various system-call entry and exit points. * Offers a command-line interface with routines to format and print traced data. **Java HotSpot VM Probe Providers** * Two built-in providers: `hotspot` and `hotspot_jni`. * Provide probes for VM performance, memory, and security. **pmap Tool** * Improved stack trace for Java methods since Oracle Solaris 10. * Prints both interpreted and compiled Java method names. **pstack Tool** * Deprecated tool prior to Oracle Solaris 10. * Supports mixed-mode stack traces (Java and C/C++). * Improved output format for Java method names. **Improvements to pstack Tool** * Prints mixed-mode stack traces from core files and live processes. * Supports Java method names for all code types.

正文

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相似的内容:

[转帖]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

[转帖]2.构建和安装Erlang / OTP | 2. Building and Installing Erlang/OTP

http://www.verydoc.net/erlang20/00002791.html 2.1简介 本文档介绍如何构建和安装Erlang/OTP-20。Erlang/OTP应该可以在任何Unix/Linux系统(包括OS X)上从源代码构建。建议您在尝试构建和安装Erlang/OTP之前阅读整个

[转帖]docker 镜像分层原理及容器写时复制

https://xie.infoq.cn/article/19c98e8b15ff9f610a2ee26bd 一、镜像分层与容器层 在进行docker pull 下载镜像的时候,通过下图可以看到镜像是分层下载并解压的。如 nginx:1.20.2 的镜像,其镜像是分为 6 层。 当我们运行一个新的容

[转帖]【技术剖析】2. JVM锁bug导致G1 GC挂起问题分析和解决

https://bbs.huaweicloud.com/forum/thread-144146-1-1.html 发表于 2021-07-29 20:07:087037查看 作者:宋尧飞 编者按:笔者在AArch64中遇到一个G1 GC挂起,CPU利用率高达300%的案例。经过分析发现问题是由JVM

[转帖]linux 查看CPU 内存的信息

https://bbs.huaweicloud.com/blogs/302929 【摘要】 ECS信息规格:2vCPUs | 4GiB | kc1.large.2镜像:openEuler 20.03 64bit with ARM | 公共镜像 linux 查看CPU 内存 硬盘的信息 查看CPU的信

[转帖]拯救关键业务上线:DBA 的惊魂24小时

一个电话,打破深夜的宁静 9月20日晚上10点 刚完成外地一个重点项目为期2周的现场支持,从机场回家的路上,一阵急促的铃声惊醒了出租车上昏昏欲睡的我,多年的工作经验告诉我这么晚来电一定是出事了,接起电话,是KS。 KS正在跟一个国内关键客户数据库国产化替代项目,该项目核心业务系统由Oracle替换为

[转帖]xfs_respair一点理解

xfs_respair一点理解 robot_test_boy IP属地: 江苏 0.276 2020.08.29 20:05:38 字数 2,449 阅读 2,485 上次学习了xfs文件系统,里边大致提了下xfs_respair怎么使用的,但是xfs_respair具体干嘛的并不清楚。 xfs_r

[转帖]探索惊群 ③ - nginx 惊群现象

https://wenfh2020.com/2021/09/29/nginx-thundering-herd/ nginx kernel 本文将通过测试,重现 nginx(1.20.1) 的惊群现象,并深入 Linux (5.0.1) 内核源码,剖析惊群原因。 1. nginx 惊群现象 2. 原因

[转帖]tcp_tw_reuse、tcp_tw_recycle和tcp_timestamps

https://www.cnblogs.com/zh-dream/p/12702522.html TCP报文格式 1、TCP报文:由TCP首部和TCP数据组成 2、TCP首部:由 20字节的固定长度 + 变长字段(选项)+ 填充 组成成 3、MSS(Maximum Segment Size):占4字

[转帖]手把手教你安装openGauss 3.1.0

手把手教你安装openGauss 3.1.0 目录 前言 一、安装包的下载 1、centos 7.6的下载 2、openEuler 20.03LTS的下载 3、openGauss安装包的下载 二、安装环境的准备 1、硬件环境要求 2、软件环境要求 3、软件依赖要求 4、关闭操作系统防火墙 6、设置操