Top Description Inners Fields Constructors Methods
org.wildfly.common.cpu

public final Class CacheInfo

extends Object
Class Inheritance
Static Imports
java.security.AccessController.doPrivileged

A class which exposes any available cache line information for the current CPU.
Author
David M. Lloyd

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final CacheLevelInfo[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static CacheLevelInfo

Returns:

the CPU cache level information
getCacheLevelInfo
(int
the cache level index
index
)

Get the CPU cache level information for a cache level.

public static int

Returns:

the number of CPU cache levels, or 0 if unknown
getLevelEntryCount
()

Get the number of CPU cache level entries.

public static int

Returns:

the smallest cache line size, or 0 if unknown
getSmallestDataCacheLineSize
()

Get the smallest known data cache line size.

public static int

Returns:

the smallest cache line size, or 0 if unknown
getSmallestInstructionCacheLineSize
()

Get the smallest known instruction cache line size.

public static void
main(String[] args)

pack-priv static int
parseIntFile(final File file)

pack-priv static int
parseIntKBFile(final File file)

pack-priv static String
parseProcessOutput(final String... args)

pack-priv static String
parseStringFile(final File file)

pack-priv static String
pack-priv static int
safeParseInt(final String string)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheLevelsback to summary
private static final CacheLevelInfo[] cacheLevels

Constructor Detail

CacheInfoback to summary
public CacheInfo()

Method Detail

getCacheLevelInfoback to summary
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:int

the cache level index

Returns:CacheLevelInfo

the CPU cache level information

getLevelEntryCountback to summary
public static int getLevelEntryCount()

Get the number of CPU cache level entries. If no cache information could be gathered, 0 is returned.

Returns:int

the number of CPU cache levels, or 0 if unknown

getSmallestDataCacheLineSizeback to summary
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:int

the smallest cache line size, or 0 if unknown

getSmallestInstructionCacheLineSizeback to summary
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:int

the smallest cache line size, or 0 if unknown

mainback to summary
public static void main(String[] args)
parseIntFileback to summary
pack-priv static int parseIntFile(final File file)
parseIntKBFileback to summary
pack-priv static int parseIntKBFile(final File file)
parseProcessOutputback to summary
pack-priv static String parseProcessOutput(final String... args)
parseStringFileback to summary
pack-priv static String parseStringFile(final File file)
parseStringStreamback to summary
pack-priv static String parseStringStream(final InputStream is)
safeParseIntback to summary
pack-priv static int safeParseInt(final String string)
org.wildfly.common.cpu back to summary

pack-priv Class CacheInfo.StreamConsumer

extends Object
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable

Field Summary

Modifier and TypeField and Description
private final InputStream

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

streamback to summary
private final InputStream stream

Constructor Detail

StreamConsumerback to summary
pack-priv StreamConsumer(final InputStream stream)

Method Detail

runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.