Home
PerfUtil Java API: CpuInfo class
GetCpuArchitecture
//
// Queries processor architecture.
//
// ***** Runs on current processor *****
//
// Returns:
// - CPU_ARCHITECTURE_X86_INTEL Intel x86 processors
// - CPU_ARCHITECTURE_X86_AMD AMD x86 processors
// - CPU_ARCHITECTURE_IA64 Intel IA64 processors
// - CPU_ARCHITECTURE_AMD64 AMD x86-64 processors
// - CPU_ARCHITECTURE_PPC 32/64-bit PowerPC processors
// - CPU_ARCHITECTURE_S390 31/64-bit s390/zArchitecture processors
// - CPU_ARCHITECTURE_UNKNOWN Unknown architecture
//
static native int GetCpuArchitecture();
GetProcessorArchitectureString
//
// Returns processor architecture string
//
// ***** Runs on current processor *****
//
// Returns:
// - "x86 (P6)"
// - "x86 (Pentium M)"
// - "x86 (Core Solo/Duo)"
// - "x86 (Core 2)"
// - "x86 (P4)"
// - "x64 (P4/EM64T)"
// - "x64 (Core/EM64T)"
// - "x86 (AMD)"
// - "x64 (AMD64)"
//
static native String GetProcessorArchitectureString();
GetCpuType
//
// Returns processor type.
//
// Returns:
// * x86 Intel:
// - CPU_TYPE_P5 P5 (Pentium, Pentium MMX)
// - CPU_TYPE_P6 P6 (Pentium Pro/II/III, Celeron)
// - CPU_TYPE_P4 P4 (Pentium 4)
// - CPU_TYPE_UNKNOWN Unknown processor
// * x86 AMD:
// * IA64:
// * AMD64:
// * PPC:
// * S390:
//
static native int GetCpuType();
GetCpuByteOrdering
//
// Returns processor byte ordering (endianness).
//
// Returns:
// - CPU_LITTLE_ENDIAN Little endian byte ordering
// - CPU_BIG_ENDIAN Big endian byte ordering
//
static native int GetCpuByteOrdering();
GetCpuWordSize
//
// Returns processor word size.
//
// Returns:
// - CPU_32BITS 32-bit processor (31-bit for s390)
// - CPU_64BITS 64-bit processor
//
static native int GetCpuWordSize();
GetCpuSpeed
//
// Returns processor speed (in Hz)
//
static native long GetCpuSpeed();
GetActiveCpuCount
//
// Returns number of active (configured) processors.
//
// Notes:
// - On systems where HyperThreading is enabled the active processor
// will be larger than the physical processor count.
// - Systems with more than 1 active processor are considered to be SMP.
//
static native int GetActiveCpuCount();
GetPhysicalCpuCount
//
// Returns number of physical (installed) processors.
//
// Notes:
// - On systems where HyperThreading is enabled the physical processor
// will be smaller than the active processor count.
// - Systems with more than 1 physical processor are considered to be SMP.
//
static native int GetPhysicalCpuCount();
GetNumberOfPerfCounters
//
// Returns number of Hardware Performance Counters available.
//
static native int GetNumberOfPerfCounters();
GetNumberOfLogicalProcessors
//
// Returns number of Logical Processors per Physical Processor.
//
// Notes:
// - On systems that do not support HyperThreading the number of
// Logical processors per package is always 1.
//
static native int GetNumberOfLogicalProcessors();
GetNumberOfCores
//
// Returns number of Cores per Physical Processor.
//
// Notes:
// - On systems that do not support multi-core the number of
// cores per package is always 1.
//
static native int GetNumberOfCores();
GetCpuidEax
GetCpuidEbx
GetCpuidEcx
GetCpuidEdx
//
// Issue CPUID instruction and return raw data.
//
// ***** Runs on current processor *****
//
// Input:
// - index: Value of eax when issuing CPUID instruction
//
// Returns:
// - Contents of requested register (eax, ebx, ecx, edx) on
// x86 and AMD processors.
//
// Notes:
// - Supported on x86 (Intel and AMD) and AMD64 processors.
// - Results are undefined on any other processor architectures. It
// is recommended that zero (0) be returned.
//
static native int GetCpuidEax(int index);
static native int GetCpuidEbx(int index);
static native int GetCpuidEcx(int index);
static native int GetCpuidEdx(int index);
ReadCycles
//
// Read processor cycle counter.
//
// ***** Runs on current processor _OR_ the requested processor *****
//
// Returns:
// * x86 Intel and AMD
// - 64-bit value of the Time Stamp Counter (TSC) register
// * IA64:
// - 64-bit value of the Interval Time Counter (ITC) register
// * AMD64:
// - 64-bit value of the Time Stamp Counter (TSC) register
// * PPC:
// - 64-bit value of the Timebase (TB) register
// * S390:
// - 64-bit value of the Time Of Day (TOD) clock
//
static native long ReadCycles();
static native long ReadCycles(int cpu);
RdMsr
//
// Reads MSR number 'msr' in given processor and returns its value.
//
// Input:
// - cpu: Processor on which MSR should be read, or ALL_CPUS
// - msr: Number of MSR to read
// - MsrValues: Array that will contain value of MSR read, one element
// per processor.
//
// Sets:
// - MsrValues[]
//
// Returns:
// - 0: success
// - non-zero: values not read from 1 or more processors
//
// Notes:
// - To read MSR on all processors specify cpu as ALL_CPUS
// - A value of zero (0) is returned for invalid MSRs.
// - MsrValues[] is indexed by CPU number. The largest valid
// index is (CpuCnt - 1).
// - This method is very platform specific. Check the platform
// documentation for available MSRs.
//
static native int RdMsr(int cpu, int msr, long[] MsrValues);
IsCpuNumberValid
//
// Returns whether or not the given CPU number is valid.
//
static native boolean IsCpuNumberValid(int cpu_num);
IsPerfCounterNumberValid
//
// Returns whether or not the given Performance Counter number is valid.
//
static native boolean IsPerfCounterNumberValid(int ctr_num);
IsCpu32bits
//
// Returns whether or not this is a 32-bit processor.
//
static native boolean IsCpu32bits();
IsCpu64bits
//
// Returns whether or not this is a 64-bit processor.
//
static native boolean IsCpu64bits();
IsCpuLittleEndian
//
// Returns whether or not this is a little-endian processor.
//
static native boolean IsCpuLittleEndian();
IsCpuBigEndian
//
// Returns whether or not this is a big-endian processor.
//
static native boolean IsCpuBigEndian();
IsSystemSmp
//
// Returns whether or not this is an SMP system.
//
// Notes:
// - An SMP system is one in which there are more than 1 active processors.
// - A system that is not SMP is UNI by definition.
//
static native boolean IsSystemSmp();
IsSystemUni
//
// Returns whether or not this is a UP (UNI) system.
//
// Notes:
// - A UP system is one in which there is only 1 active processor.
// - A system that is not UP is SMP by definition.
//
static native boolean IsSystemUni();
IsHttSupported
//
// Returns whether or not the processors support HyperThreading.
//
// Notes:
// - Hyperthreading is only available on Intel Pentium-4 processors.
//
static native boolean IsHttSupported();
IsHttEnabled
//
// Returns whether or not HyperThreading is enabled.
//
// Notes:
// - Hyperthreading is only available on Intel Pentium-4 processors.
// - If Hyperthreading is enabled the number of physical processors
// will be less than the number of active processors.
//
static native boolean IsHttEnabled();
IsProcessorMultiCore
//
// Returns whether or not processor is multi-core.
//
static native boolean IsProcessorMultiCore();
IsProcessorIntel
//
// Returns whether or this is an Intel processor.
// Intel processors include:
// - P6-type: Pentium Pro/II/III, Celeron, Pentium-M, Core Solo/Duo, Core2
// - P4-type: Pentium 4, Pentium Xeon/Xeon MP
//
static native boolean IsProcessorIntel();
IsProcessorAmd
//
// Returns whether or not this is an AMD processor.
// AMD processors include:
// - Opteron, Athlon, Sempron, Turion
//
static native boolean IsProcessorAmd();
IsProcessorX86
//
// Returns whether or not this is an x86-type processor.
// - Could be Intel or AMD
//
static native boolean IsProcessorX86();
IsProcessorX64
//
// Returns whether or not this is an x64-type processor.
// - Could be Intel (EM64T) or AMD (AMD64)
//
static native boolean IsProcessorX64();
IsProcessorP4
//
// Returns whether or not this is an Intel P4-type (Netburst) processor.
// - Intel P4-type: Pentium 4, Pentium Xeon/Xeon MP
//
static native boolean IsProcessorP4();
IsProcessorP15
//
// Returns whether or not this is an AMD P15-type (AMD64) processor.
// - AMD P15-type: Opteron, Athlon, Sempron, Turion
//
static native boolean IsProcessorP15();
IsProcessorP6
//
// Returns whether or not this is an Intel P6-type processor.
// - Intel P6-type: Pentium Pro/II/III, Celeron, Pentium-M, Core Solo/Duo, Core2
//
static native boolean IsProcessorP6();
IsProcessorPentiumM
//
// Returns whether or not this is an Intel Pentium M processor.
//
static native boolean IsProcessorPentiumM();
IsProcessorCoreSD
//
// Returns whether or not this is an Intel Core Solo/Core Duo processor.
//
static native boolean IsProcessorCoreSD();
IsProcessorCore
//
// Returns whether or not this is an Intel Core2 processor.
//
static native boolean IsProcessorCore();
IsProcessorPPC64
//
// Returns whether or not this is a PowerPC 64 processor.
//
static native boolean IsProcessorPPC64();
IsProcessorOpteron
//
// Returns whether or not this is an AMD Opteron processor.
//
static native boolean IsProcessorOpteron();
IsProcessorAthlon
//
// Returns whether or not this is an AMD Athlon processor.
//
static native boolean IsProcessorAthlon();