org.hyperic.sigar.CpuInfo Maven / Gradle / Ivy
/*****************************************************
* 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;
/**
* CpuInfo sigar class.
*/
public class CpuInfo implements java.io.Serializable {
private static final long serialVersionUID = 9710L;
public CpuInfo() { }
public native void gather(Sigar sigar) throws SigarException;
/**
* This method is not intended to be called directly.
* use Sigar.getCpuInfo() instead.
* @exception SigarException on failure.
* @see org.hyperic.sigar.Sigar#getCpuInfo
*/
static CpuInfo fetch(Sigar sigar) throws SigarException {
CpuInfo cpuInfo = new CpuInfo();
cpuInfo.gather(sigar);
return cpuInfo;
}
String vendor = null;
/**
* Get the CPU vendor id.
* Supported Platforms: AIX, FreeBSD, Linux, HPUX, Solaris, Win32.
*
* System equivalent commands:
* - AIX:
lsattr -El proc0
* - Darwin:
* - FreeBSD:
* - HPUX:
* - Linux:
cat /proc/cpuinfo
* - Solaris:
psrinfo -v
* - Win32:
*
* @return CPU vendor id
*/
public String getVendor() { return vendor; }
String model = null;
/**
* Get the CPU model.
* Supported Platforms: AIX, FreeBSD, Linux, HPUX, Solaris, Win32.
*
* System equivalent commands:
* - AIX:
lsattr -El proc0
* - Darwin:
* - FreeBSD:
* - HPUX:
* - Linux:
cat /proc/cpuinfo
* - Solaris:
psrinfo -v
* - Win32:
*
* @return CPU model
*/
public String getModel() { return model; }
int mhz = 0;
/**
* Get the CPU speed.
* Supported Platforms: AIX, FreeBSD, HPUX, Linux, Solaris, Win32.
*
* System equivalent commands:
* - AIX:
lsattr -El proc0
* - Darwin:
* - FreeBSD:
* - HPUX:
* - Linux:
cat /proc/cpuinfo
* - Solaris:
psrinfo -v
* - Win32:
*
* @return CPU speed
*/
public int getMhz() { return mhz; }
long cacheSize = 0;
/**
* Get the CPU cache size.
* Supported Platforms: AIX, Linux.
*
* System equivalent commands:
* - AIX:
lsattr -El proc0
* - Darwin:
* - FreeBSD:
* - HPUX:
* - Linux:
cat /proc/cpuinfo
* - Solaris:
psrinfo -v
* - Win32:
*
* @return CPU cache size
*/
public long getCacheSize() { return cacheSize; }
int totalCores = 0;
/**
* Get the Total CPU cores (logical).
* Supported Platforms: Undocumented.
*
* System equivalent commands:
* - AIX:
lsattr -El proc0
* - Darwin:
* - FreeBSD:
* - HPUX:
* - Linux:
cat /proc/cpuinfo
* - Solaris:
psrinfo -v
* - Win32:
*
* @return Total CPU cores (logical)
*/
public int getTotalCores() { return totalCores; }
int totalSockets = 0;
/**
* Get the Total CPU sockets (physical).
* Supported Platforms: Undocumented.
*
* System equivalent commands:
* - AIX:
lsattr -El proc0
* - Darwin:
* - FreeBSD:
* - HPUX:
* - Linux:
cat /proc/cpuinfo
* - Solaris:
psrinfo -v
* - Win32:
*
* @return Total CPU sockets (physical)
*/
public int getTotalSockets() { return totalSockets; }
int coresPerSocket = 0;
/**
* Get the Number of CPU cores per CPU socket.
* Supported Platforms: Undocumented.
*
* System equivalent commands:
* - AIX:
lsattr -El proc0
* - Darwin:
* - FreeBSD:
* - HPUX:
* - Linux:
cat /proc/cpuinfo
* - Solaris:
psrinfo -v
* - Win32:
*
* @return Number of CPU cores per CPU socket
*/
public int getCoresPerSocket() { return coresPerSocket; }
void copyTo(CpuInfo copy) {
copy.vendor = this.vendor;
copy.model = this.model;
copy.mhz = this.mhz;
copy.cacheSize = this.cacheSize;
copy.totalCores = this.totalCores;
copy.totalSockets = this.totalSockets;
copy.coresPerSocket = this.coresPerSocket;
}
public Map toMap() {
Map map = new HashMap();
String strvendor =
String.valueOf(this.vendor);
if (!"-1".equals(strvendor))
map.put("Vendor", strvendor);
String strmodel =
String.valueOf(this.model);
if (!"-1".equals(strmodel))
map.put("Model", strmodel);
String strmhz =
String.valueOf(this.mhz);
if (!"-1".equals(strmhz))
map.put("Mhz", strmhz);
String strcacheSize =
String.valueOf(this.cacheSize);
if (!"-1".equals(strcacheSize))
map.put("CacheSize", strcacheSize);
String strtotalCores =
String.valueOf(this.totalCores);
if (!"-1".equals(strtotalCores))
map.put("TotalCores", strtotalCores);
String strtotalSockets =
String.valueOf(this.totalSockets);
if (!"-1".equals(strtotalSockets))
map.put("TotalSockets", strtotalSockets);
String strcoresPerSocket =
String.valueOf(this.coresPerSocket);
if (!"-1".equals(strcoresPerSocket))
map.put("CoresPerSocket", strcoresPerSocket);
return map;
}
public String toString() {
return toMap().toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy