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

org.hyperic.sigar.ThreadCpu 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;

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

    private static final long serialVersionUID = 2546L;

    public ThreadCpu() { }

    public native void gather(Sigar sigar, long pid) throws SigarException;

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

    long user = 0;

    /**
     * Get the Thread cpu user time.

* Supported Platforms: AIX, HPUX, Linux, Solaris, Win32. *

* @return Thread cpu user time */ public long getUser() { return user; } long sys = 0; /** * Get the Thread cpu kernel time.

* Supported Platforms: AIX, HPUX, Linux, Solaris, Win32. *

* @return Thread cpu kernel time */ public long getSys() { return sys; } long total = 0; /** * Get the Thread cpu time (sum of User and Sys).

* Supported Platforms: AIX, HPUX, Linux, Solaris, Win32. *

* @return Thread cpu time (sum of User and Sys) */ public long getTotal() { return total; } void copyTo(ThreadCpu copy) { copy.user = this.user; copy.sys = this.sys; copy.total = this.total; } public Map toMap() { Map map = new HashMap(); String struser = String.valueOf(this.user); if (!"-1".equals(struser)) map.put("User", struser); String strsys = String.valueOf(this.sys); if (!"-1".equals(strsys)) map.put("Sys", strsys); String strtotal = String.valueOf(this.total); if (!"-1".equals(strtotal)) map.put("Total", strtotal); return map; } public String toString() { return toMap().toString(); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy