# JVMinfo.ctl: Collects Generic Oracle Java Virtual Machine Information # $Id: JVMinfo.ctl,v 1.6 2015/05/29 07:48:00 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/OFM/JVMinfo.ctl,v 1.6 2015/05/29 07:48:00 RDA Exp $ # # Change History # 20150527 KRA Improve the documentation. =head1 NAME OFM:JVMinfo - Collects Generic Oracle Java Virtual Machine Information =head1 DESCRIPTION This module collects generic Oracle Java Virtual Machine (JVM)-related information. =cut # Initialization var ($lvl,$pid) = @arg import $JAVA_HOME,$PMAP,$PSTACK,$TOC,$TOP var $MOD = cond(isUnix(),'fx','fr') var $det = $lvl incr $det =for stopwords jinfo =head1 JVM Process Information =head2 jinfo - Java Information (jinfo) Collects JVM information using F. =cut pretoc $lvl,':JVM Process Information' if ?testFile($MOD,catFile($JAVA_HOME,'bin',${AS.EXE:'jinfo'})) {debug ' - Gathering Java Virtual Machine information' var $cmd = concat(lastTestCommand(),' ',$pid) output F,jinfo prefix {write '---+ Java Virtual Machine Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if isCreated(true) {write $TOP toc $det,':[[',getFile(),'][rda_report][Java Information (jinfo)]]' } } =for stopwords jmap histo =head2 jmap_histo - Java Histogram (jmap) Collects JVM histogram information using F. =cut if ?testFile($MOD,catFile($JAVA_HOME,'bin',${AS.EXE:'jmap'})) {debug ' - Gathering Java Virtual Machine histogram information' var $pgm = lastTestCommand() var $cmd = concat($pgm,' -histo ',$pid) output F,jmap_histo prefix {write '---+ Java Virtual Machine Histogram' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if isCreated(true) {write $TOP toc $det,':[[',getFile(),'][rda_report][Java Histogram (jmap)]]' } =for stopwords Finalizer finalizer =head2 jmap_finalizer - JVM Finalizer Information (jmap) Collects JVM finalizer information using F. =cut debug ' - Gathering Java Virtual Machine finalizer information' var $cmd = concat($pgm,' -finalizerinfo ',$pid) output F,jmap_finalizer prefix {write '---+ Java Virtual Machine Finalizer Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if isCreated(true) {write $TOP toc $det,':[[',getFile(),'][rda_report][JVM Finalizer Information (jmap)]]' } =head2 jmap_heap - JVM Heap Summary (jmap) Collects JVM heap summary information using F. =cut debug ' - Gathering Java Virtual Machine heap summary information' var $cmd = concat($pgm,' -heap ',$pid) output F,jmap_heap prefix {write '---+ Java Virtual Machine Heap Summary' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if isCreated(true) {write $TOP toc $det,':[[',getFile(),'][rda_report][JVM Heap Summary (jmap)]]' } } =for stopwords jstack =head2 jstack - JVM Thread Stack (jstack) Collects JVM thread stack information using F. =cut if ?testFile($MOD,catFile($JAVA_HOME,'bin',${AS.EXE:'jstack'})) {debug ' - Gathering Java Virtual Machine thread stack information' var $pgm = lastTestCommand() output F,jstack title '---+!! Java Virtual Machine Thread Stack' title $TOC var $cmd = concat($pgm,' ',$pid) prefix write '---+ Using: ',encode($cmd) call writeCommand($cmd) if hasOutput(true) write $TOP var $cmd = concat($pgm,' -l ',$pid) prefix write '---+ Using: ',encode($cmd) call writeCommand($cmd) if hasOutput(true) write $TOP var $cmd = concat($pgm,' -m ',$pid) prefix write '---+ Using: ',encode($cmd) call writeCommand($cmd) if hasOutput(true) write $TOP if isCreated() toc $det,':[[',getFile(),'][rda_report][JVM Thread Stack (jstack)]]' } unpretoc =for stopwords cmdline =head1 OS Process Information =head2 cmdline - Process Command Line (cmdline) Collects process command line information when available. =cut if isUnix() {pretoc $lvl,':OS Process Information' if ?$fil = testFile('fr',catFile('/proc',$pid,'cmdline')) {debug ' - Gathering process command line information' output F,cmdline prefix {write '---+ Process Command Line Information' write '---## Information Taken from ',encode($fil) } call writeFile($fil) if isCreated(true) toc $det,':[[',getFile(),'][rda_report][Process Command Line (cmdline)]]' } =head2 maps - Process Map (maps) Collects process map information when available. =cut if ?$fil = testFile('fr',catFile('/proc',$pid,'maps')) {debug ' - Gathering process map information' output F,maps prefix {write '---+ Process Map Information' write '---## Information Taken from ',encode($fil) } call writeFile($fil) if isCreated(true) toc $det,':[[',getFile(),'][rda_report][Process Map (maps)]]' } =for stopwords fd =head2 fd - Process File Directory Contents (fd) Lists process file directory contents when available. =cut if ?$dir = testDir('d',catDir('/proc',$pid,'fd')) {debug ' - Gathering file directory contents' output F,fd prefix {write '---+ Process File Directory Contents' write '---## Information Taken from ',encode($dir) } call statDir('n',$dir) if isCreated(true) toc $det,':[[',getFile(),\ '][rda_report][Process File Directory Contents (fd)]]' } =for stopwords pmap =head2 pmap - Address Space (pmap) Collects address space information when available. =cut if ?$PMAP {debug ' - Gathering address space information' var $cmd = concat(last,' ',$pid) output F,pmap prefix {write '---+ Address Space Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if isCreated(true) toc $det,':[[',getFile(),'][rda_report][Address Space (pmap)]]' } =for stopwords pstack =head2 pstack - Native Thread Stack (pstack) Collects native thread stack information when available. =cut if ?$PSTACK {debug ' - Gathering native thread stack information' var $cmd = concat(last,' ',$pid) output F,pstack prefix {write '---+ Native Thread Stack Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if isCreated(true) toc $det,':[[',getFile(),'][rda_report][Native Thread Stack (pstack)]]' } unpretoc } =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. =head1 TRADEMARK NOTICE Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. =cut