All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hyperic.sigar.Swap Maven / Gradle / Ivy

There is a newer version: 1.6.6-rev002
Show newest version
/*****************************************************
 * WARNING: this file was generated by -e
 * on Mon May 24 16:26:06 2010.
 * Any changes made here will be LOST.
 *****************************************************/
package org.hyperic.sigar;

import java.util.HashMap;
import java.util.Map;

/**
 * Swap sigar class.
 */
public class Swap implements java.io.Serializable {

    private static final long serialVersionUID = 4974L;

    public Swap() { }

    public native void gather(Sigar sigar) throws SigarException;

    /**
     * This method is not intended to be called directly.
     * use Sigar.getSwap() instead.
     * @exception SigarException on failure.
     * @see org.hyperic.sigar.Sigar#getSwap
     */
    static Swap fetch(Sigar sigar) throws SigarException {
        Swap swap = new Swap();
        swap.gather(sigar);
        return swap;
    }

    long total = 0;

    /**
     * Get the Total system swap.

* Supported Platforms: All. *

* System equivalent commands:

    *
  • AIX: lsps -s
    *
  • Darwin: sysctl vm.swapusage
    *
  • FreeBSD:
    *
  • HPUX:
    *
  • Linux: free
    *
  • Solaris: swap -s
    *
  • Win32:
    *
* @return Total system swap */ public long getTotal() { return total; } long used = 0; /** * Get the Total used system swap.

* Supported Platforms: All. *

* System equivalent commands:

    *
  • AIX: lsps -s
    *
  • Darwin:
    *
  • FreeBSD:
    *
  • HPUX:
    *
  • Linux: free
    *
  • Solaris: swap -s
    *
  • Win32:
    *
* @return Total used system swap */ public long getUsed() { return used; } long free = 0; /** * Get the Total free system swap.

* Supported Platforms: All. *

* System equivalent commands:

    *
  • AIX:
    *
  • Darwin:
    *
  • FreeBSD:
    *
  • HPUX:
    *
  • Linux: free
    *
  • Solaris: swap -s
    *
  • Win32:
    *
* @return Total free system swap */ public long getFree() { return free; } long pageIn = 0; /** * Get the Pages in.

* Supported Platforms: All. *

* System equivalent commands:

    *
  • AIX:
    *
  • Darwin:
    *
  • FreeBSD:
    *
  • HPUX:
    *
  • Linux: vmstat
    *
  • Solaris: vmstat
    *
  • Win32:
    *
* @return Pages in */ public long getPageIn() { return pageIn; } long pageOut = 0; /** * Get the Pages out.

* Supported Platforms: All. *

* System equivalent commands:

    *
  • AIX:
    *
  • Darwin:
    *
  • FreeBSD:
    *
  • HPUX:
    *
  • Linux: vmstat
    *
  • Solaris: vmstat
    *
  • Win32:
    *
* @return Pages out */ public long getPageOut() { return pageOut; } void copyTo(Swap copy) { copy.total = this.total; copy.used = this.used; copy.free = this.free; copy.pageIn = this.pageIn; copy.pageOut = this.pageOut; } public String toString() { return "Swap: " + (this.total / 1024) + "K av, " + (this.used / 1024) + "K used, " + (this.free / 1024) + "K free"; } public Map toMap() { Map map = new HashMap(); String strtotal = String.valueOf(this.total); if (!"-1".equals(strtotal)) map.put("Total", strtotal); String strused = String.valueOf(this.used); if (!"-1".equals(strused)) map.put("Used", strused); String strfree = String.valueOf(this.free); if (!"-1".equals(strfree)) map.put("Free", strfree); String strpageIn = String.valueOf(this.pageIn); if (!"-1".equals(strpageIn)) map.put("PageIn", strpageIn); String strpageOut = String.valueOf(this.pageOut); if (!"-1".equals(strpageOut)) map.put("PageOut", strpageOut); return map; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy