Package org.wildfly.common.cpu
Class CacheInfo
- java.lang.Object
-
- org.wildfly.common.cpu.CacheInfo
-
public final class CacheInfo extends java.lang.Object
A class which exposes any available cache line information for the current CPU.- Author:
- David M. Lloyd
-
-
Constructor Summary
Constructors Constructor Description CacheInfo()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CacheLevelInfo
getCacheLevelInfo(int index)
Get the CPU cache level information for a cache level.static int
getLevelEntryCount()
Get the number of CPU cache level entries.static int
getSmallestDataCacheLineSize()
Get the smallest known data cache line size.static int
getSmallestInstructionCacheLineSize()
Get the smallest known instruction cache line size.static void
main(java.lang.String[] args)
-
-
-
Method Detail
-
getLevelEntryCount
public static int getLevelEntryCount()
Get the number of CPU cache level entries. If no cache information could be gathered, 0 is returned.- Returns:
- the number of CPU cache levels, or 0 if unknown
-
getCacheLevelInfo
public static CacheLevelInfo getCacheLevelInfo(int index)
Get the CPU cache level information for a cache level. Theindex
argument must be greater than zero and less than the number of levels returned bygetLevelEntryCount()
.- Parameters:
index
- the cache level index- Returns:
- the CPU cache level information
-
getSmallestDataCacheLineSize
public static int getSmallestDataCacheLineSize()
Get the smallest known data cache line size. If no cache line sizes are known, 0 is returned. Note that smaller cache lines may exist if one or more cache line sizes are unknown.- Returns:
- the smallest cache line size, or 0 if unknown
-
getSmallestInstructionCacheLineSize
public static int getSmallestInstructionCacheLineSize()
Get the smallest known instruction cache line size. If no cache line sizes are known, 0 is returned. Note that smaller cache lines may exist if one or more cache line sizes are unknown.- Returns:
- the smallest cache line size, or 0 if unknown
-
main
public static void main(java.lang.String[] args)
-
-