more docs
This commit is contained in:
parent
531c3c64e9
commit
a93bb09aef
|
@ -1,5 +1,9 @@
|
||||||
package net.hyperic.sigar;
|
package net.hyperic.sigar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides a summary of current process states.
|
||||||
|
* @see net.hyperic.sigar.cmd.Top
|
||||||
|
*/
|
||||||
public class CurrentProcessSummary {
|
public class CurrentProcessSummary {
|
||||||
private int total=0, sleeping=0, running=0, zombie=0, stopped=0;
|
private int total=0, sleeping=0, running=0, zombie=0, stopped=0;
|
||||||
|
|
||||||
|
|
|
@ -11,13 +11,22 @@ import net.hyperic.jni.ArchLoaderException;
|
||||||
import net.hyperic.jni.ArchNotSupportedException;
|
import net.hyperic.jni.ArchNotSupportedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry point for the Sigar - System Information GAtheRer
|
* The Sigar class provides access to the sigar objects containing
|
||||||
|
* system information. The Sigar object itself maintains internal
|
||||||
|
* state specific to each platform. It also implements the SigarProxy
|
||||||
|
* interface which provides caching at the Java level.
|
||||||
*/
|
*/
|
||||||
public class Sigar implements SigarProxy {
|
public class Sigar implements SigarProxy {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Sigar version in String form.
|
||||||
|
*/
|
||||||
public static final String VERSION_STRING =
|
public static final String VERSION_STRING =
|
||||||
SigarVersion.VERSION_STRING;
|
SigarVersion.VERSION_STRING;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The date on which the Sigar binaries were built.
|
||||||
|
*/
|
||||||
public static final String BUILD_DATE =
|
public static final String BUILD_DATE =
|
||||||
SigarVersion.BUILD_DATE;
|
SigarVersion.BUILD_DATE;
|
||||||
|
|
||||||
|
@ -67,7 +76,7 @@ public class Sigar implements SigarProxy {
|
||||||
public static native String formatSize(long size);
|
public static native String formatSize(long size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Allocate and initialize the native Sigar object.
|
||||||
*/
|
*/
|
||||||
public Sigar() {
|
public Sigar() {
|
||||||
try {
|
try {
|
||||||
|
@ -99,6 +108,8 @@ public class Sigar implements SigarProxy {
|
||||||
/**
|
/**
|
||||||
* Release any native resources associated with this sigar instance.
|
* Release any native resources associated with this sigar instance.
|
||||||
* The sigar object is no longer usable after it has been closed.
|
* The sigar object is no longer usable after it has been closed.
|
||||||
|
* If the close method is not called directly, the finalize method will
|
||||||
|
* call it if the Sigar object is garbage collected.
|
||||||
*/
|
*/
|
||||||
public void close() {
|
public void close() {
|
||||||
if (this.sigarWrapper != 0) {
|
if (this.sigarWrapper != 0) {
|
||||||
|
@ -115,7 +126,7 @@ public class Sigar implements SigarProxy {
|
||||||
public native long getPid();
|
public native long getPid();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send signal to a process.
|
* Send a signal to a process.
|
||||||
*
|
*
|
||||||
* @param pid The process id.
|
* @param pid The process id.
|
||||||
* @param signum The signal number.
|
* @param signum The signal number.
|
||||||
|
@ -395,7 +406,8 @@ public class Sigar implements SigarProxy {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get process loaded modules.
|
* Get process loaded modules.<p>
|
||||||
|
* Supported Platforms: Linux, Solaris and Windows.
|
||||||
* @param pid The process id.
|
* @param pid The process id.
|
||||||
* @return List of loaded modules.
|
* @return List of loaded modules.
|
||||||
* @exception SigarException on failure.
|
* @exception SigarException on failure.
|
||||||
|
@ -410,6 +422,13 @@ public class Sigar implements SigarProxy {
|
||||||
return getProcModules(convertPid(pid));
|
return getProcModules(convertPid(pid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the pid of the process which is listening on the given port.<p>
|
||||||
|
* Supported Platforms: Linux and Windows XP only.
|
||||||
|
* @param port The port number.
|
||||||
|
* @return pid of the process.
|
||||||
|
* @exception SigarException on failure.
|
||||||
|
*/
|
||||||
public native long getProcPort(long port) throws SigarException;
|
public native long getProcPort(long port) throws SigarException;
|
||||||
|
|
||||||
public long getProcPort(String port) throws SigarException {
|
public long getProcPort(String port) throws SigarException {
|
||||||
|
@ -580,6 +599,13 @@ public class Sigar implements SigarProxy {
|
||||||
*/
|
*/
|
||||||
public native String getFQDN() throws SigarException;
|
public native String getFQDN() throws SigarException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enabling logging in the native Sigar code.
|
||||||
|
* This method will hook log4j into the Sigar
|
||||||
|
* native logging methods. Note that the majority
|
||||||
|
* of logging in the native code is only at the DEBUG
|
||||||
|
* level.
|
||||||
|
*/
|
||||||
public void enableLogging(boolean value) {
|
public void enableLogging(boolean value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
SigarLog.enable(this);
|
SigarLog.enable(this);
|
||||||
|
|
|
@ -8,7 +8,7 @@ import java.lang.reflect.Method;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class provides a string-ish interface to sigar.
|
* This class provides a string-ish interface to sigar.
|
||||||
* It is intended for use via JMX and Covalent CAM measurement
|
* It is intended for use via JMX and Hyperic HQ measurement
|
||||||
* plugins. Method lookups are cached and the like for better
|
* plugins. Method lookups are cached and the like for better
|
||||||
* performance.
|
* performance.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -9,6 +9,11 @@ import java.lang.reflect.Method;
|
||||||
|
|
||||||
import net.hyperic.sigar.util.ReferenceMap;
|
import net.hyperic.sigar.util.ReferenceMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class implements a caching mechanism to avoid system calls
|
||||||
|
* with heavy Sigar usage in a short period of time. It is intended
|
||||||
|
* for use in applications such as Top.
|
||||||
|
*/
|
||||||
public class SigarProxyCache
|
public class SigarProxyCache
|
||||||
implements InvocationHandler {
|
implements InvocationHandler {
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,10 @@ import net.hyperic.sigar.shell.ShellCommandUsageException;
|
||||||
|
|
||||||
import net.hyperic.sigar.test.SigarTestRunner;
|
import net.hyperic.sigar.test.SigarTestRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Sigar Shell provides a command shell for running the example
|
||||||
|
* commands and Sigar tests.
|
||||||
|
*/
|
||||||
public class Shell extends ShellBase {
|
public class Shell extends ShellBase {
|
||||||
|
|
||||||
public static final String RCFILE_NAME = ".sigar_shellrc";
|
public static final String RCFILE_NAME = ".sigar_shellrc";
|
||||||
|
@ -64,6 +68,8 @@ public class Shell extends ShellBase {
|
||||||
try {
|
try {
|
||||||
//requires junit.jar
|
//requires junit.jar
|
||||||
registerCommandHandler("test", new SigarTestRunner(this));
|
registerCommandHandler("test", new SigarTestRunner(this));
|
||||||
|
} catch (NoClassDefFoundError e) { }
|
||||||
|
try {
|
||||||
//requires bcel-5.1.jar
|
//requires bcel-5.1.jar
|
||||||
registerCommandHandler("ptql", new PTQL(this));
|
registerCommandHandler("ptql", new PTQL(this));
|
||||||
} catch (NoClassDefFoundError e) { }
|
} catch (NoClassDefFoundError e) { }
|
||||||
|
|
|
@ -4,6 +4,13 @@ import java.io.IOException;
|
||||||
import java.io.EOFException;
|
import java.io.EOFException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides Emacs style key bindings, history and tab completion
|
||||||
|
* for command shell applications.
|
||||||
|
*
|
||||||
|
* This class is a Java interface to the getline.c package:
|
||||||
|
* Copyright (C) 1991, 1992 by Chris Thewalt (thewalt@ce.berkeley.edu)
|
||||||
|
*/
|
||||||
public class Getline {
|
public class Getline {
|
||||||
|
|
||||||
private String prompt = "> ";
|
private String prompt = "> ";
|
||||||
|
|
|
@ -427,7 +427,7 @@ import java.text.DecimalFormatSymbols;
|
||||||
* <p>
|
* <p>
|
||||||
* Most of this specification is quoted from the Unix
|
* Most of this specification is quoted from the Unix
|
||||||
* man page for the sprintf utility.</p>
|
* man page for the sprintf utility.</p>
|
||||||
*
|
* (c) 2000 Sun Microsystems, Inc.
|
||||||
* @author Allan Jacobs
|
* @author Allan Jacobs
|
||||||
* @version 1
|
* @version 1
|
||||||
* Release 1: Initial release.
|
* Release 1: Initial release.
|
||||||
|
|
Loading…
Reference in New Issue