Class 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 Detail

      • CacheInfo

        public CacheInfo()
    • 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. The index argument must be greater than zero and less than the number of levels returned by getLevelEntryCount().
        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)