public final class Hardware extends BasicMachine implements Comparable<Hardware>
processors
, cores
and units
may be
incorrectly calculated if you fail to specify the caches. Known issue: If you have more than one processor,
nut no L3 cache; the processors
attribute will be incorrectly set 1. A workaround that
currently works is to define an L3 cache anyway and set the memory/size of that cache to 0bytes. This
workoround may stop working in the future.new MemoryThreads[] { SYSTEM, L3, L2, L1 }
or
new MemoryThreads[] { SYSTEM, L2, L1 }
or new MemoryThreads[] { SYSTEM, L1 }
Modifier and Type | Field and Description |
---|---|
String |
architecture |
long |
cache
The size of one top level (L3 or L2) cache unit in bytes.
|
int |
cores
The total number of processor cores.
|
static long |
CPU_CACHE_LINE_SIZE
Cache-line size is (typically) 64 bytes
|
static long |
OS_MEMORY_PAGE_SIZE
Practically all architectures/OS:s have a page size of 4k (one notable exception is Solaris/SPARC that
have 8k)
|
static Set<Hardware> |
PREDEFINED
Should contain all available hardware in ascending "power" order.
|
int |
units
The number of top level (L3 or L2) cache units.
|
memory, threads
Constructor and Description |
---|
Hardware(String architecture,
BasicMachine[] levels)
new BasicMachine[] { SYSTEM, L3, L2, L1 } or
new BasicMachine[] { SYSTEM, L2, L1 } or in worst case
new BasicMachine[] { SYSTEM, L1 } |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Hardware other) |
IntCount |
countCores() |
IntCount |
countThreads() |
IntCount |
countUnits() |
boolean |
equals(Object obj) |
long |
getCacheElements(long elementSize) |
long |
getMemoryElements(long elementSize) |
int |
hashCode() |
boolean |
isL2Specified() |
boolean |
isL3Specified() |
boolean |
isMultiCore() |
boolean |
isMultiThread() |
boolean |
isMultiUnit() |
static Hardware |
makeSimple() |
static Hardware |
makeSimple(String systemArchitecture,
long systemMemory,
int systemThreads) |
String |
toString() |
VirtualMachine |
virtualise() |
public static final long CPU_CACHE_LINE_SIZE
public static final long OS_MEMORY_PAGE_SIZE
public static final Set<Hardware> PREDEFINED
public final String architecture
public final long cache
public final int cores
public final int units
public Hardware(String architecture, BasicMachine[] levels)
new BasicMachine[] { SYSTEM, L3, L2, L1 }
or
new BasicMachine[] { SYSTEM, L2, L1 }
or in worst case
new BasicMachine[] { SYSTEM, L1 }
public static Hardware makeSimple()
public static Hardware makeSimple(String systemArchitecture, long systemMemory, int systemThreads)
public int compareTo(Hardware other)
compareTo
in interface Comparable<Hardware>
public boolean equals(Object obj)
public int hashCode()
public boolean isL2Specified()
public boolean isL3Specified()
public String toString()
toString
in class BasicMachine
public VirtualMachine virtualise()
public IntCount countCores()
public IntCount countThreads()
public IntCount countUnits()
public long getCacheElements(long elementSize)
public long getMemoryElements(long elementSize)
public boolean isMultiCore()
public boolean isMultiThread()
public boolean isMultiUnit()
Copyright © 2019 Optimatika. All rights reserved.