|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mentaaffinity.Affinity
public class Affinity
The main class to set and control many different affinity strategies.
| Constructor Summary | |
|---|---|
Affinity()
|
|
| Method Summary | |
|---|---|
static void |
bind()
This method actually makes the system call to set the thread affinity. |
static Core |
bindToAnyFreeCore(int chipId,
Thread t)
Same thing as bindToAnyFreeCore(Thread t) except that you provide the chip from where to get a core. |
static Core |
bindToAnyFreeCore(Thread t)
Looks for a core that has no threads running and bound this thread to it. |
static Processor |
bindToAnyFreeProcessor(int chipId,
Thread t)
Choose the first free logical processor available in that chip and bind the thread to it. |
static Processor |
bindToAnyFreeProcessor(Thread t)
Choose the first free logical processor available and bind to this thread. |
static void |
bindToDifferentChips(int chipId1,
Thread t1,
int chipId2,
Thread t2)
Bind the threads to the provided physical processors. |
static void |
bindToDifferentChips(Thread t1,
Thread t2)
Make sure that both threads are bound to separate physical processors. |
static void |
bindToDifferentCores(int chipId,
Thread t1,
Thread t2)
Same thing as bindToDifferentCores(Thread t1, Thread t2) except that you can provide the physical processor. |
static void |
bindToDifferentCores(Thread t1,
Thread t2)
Make sure both threads will NOT be bound to the same core. |
static void |
bindToProcessor(int procId,
Thread t)
Bind the thread to a single logical processor. |
static void |
bindToSameCore(int chipId,
Thread t1,
Thread t2)
Same thing as bindToSameCore(Thread t1, Thread t2) except that you can provide the physical processor. |
static void |
bindToSameCore(Thread t1,
Thread t2)
Finds a free core and bind both threads to both of its logical processors. |
static void |
init()
Init MentaAffinity by loading the /proc/cpuinfo file. |
static boolean |
isAvailable()
Checks if MentaAffinity is available for your JVM. |
static void |
printSituation()
Prints to System.out a nice outlook of the logical processors situation. |
static void |
setEnable(boolean flag)
By default affinity is enabled but you can turn it off if you want to, for example if you are running in a platform other than Linux. |
static void |
unbind()
This method must be called when the thread is about to die. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Affinity()
| Method Detail |
|---|
public static void setEnable(boolean flag)
flag - true to enablepublic static final boolean isAvailable()
public static void init()
public static void bindToProcessor(int procId,
Thread t)
procId - the id of the processor (starts at 0).t - the thread to bind
AffinityException - if cannot bind to this processorpublic static Processor bindToAnyFreeProcessor(Thread t)
t - the thread to bind
AffinityException - if no free processor was found or if there was a problem binding
public static Processor bindToAnyFreeProcessor(int chipId,
Thread t)
chipId - the physical processor we want to bind tot - the thread we want to bind
AffinityException - if it wasn't possible to bind by any reasonpublic static Core bindToAnyFreeCore(Thread t)
t - the thread to bind
AffinityException - if it wasn't possible to bind by any reason
public static Core bindToAnyFreeCore(int chipId,
Thread t)
chipId - the physical processort - the thread to bind
AffinityException - if it wasn't possible to bind by any reason
public static void bindToSameCore(Thread t1,
Thread t2)
t1 - the first thread to bindt2 - the seconds thread to bind
AffinityException - if it wasn't possible to bind by any reason
public static void bindToSameCore(int chipId,
Thread t1,
Thread t2)
chipId - the physical processort1 - the first thread to bindt2 - the second thread to bind
AffinityException - if it wasn't possible to bind by any reason
public static void bindToDifferentCores(Thread t1,
Thread t2)
t1 - the first threadt2 - the second thread
AffinityException - if it wasn't possible to bind by any reason
public static void bindToDifferentCores(int chipId,
Thread t1,
Thread t2)
chipId - the physical processort1 - the first threadt2 - the second thread
AffinityException - if it wasn't possible to bind by any reason
public static void bindToDifferentChips(Thread t1,
Thread t2)
t1 - the first threadt2 - the second thread
AffinityException - if it wasn't possible to bind by any reason
public static void bindToDifferentChips(int chipId1,
Thread t1,
int chipId2,
Thread t2)
chipId1 - the chip to bind the first threadt1 - the first threadchipId2 - the chip to bind the second threadt2 - the second thread
AffinityException - if it wasn't possible to bind by any reasonpublic static final void bind()
AffinityException - if it wasn't possible to bind by any reasonpublic static final void unbind()
public static void printSituation()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||