Skip to content

Commit 5b3fa81

Browse files
committed
Allow use of descriptive core names for MicroJitterSampler affinity
1 parent 49f7b7a commit 5b3fa81

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

affinity/src/main/java/net/openhft/affinity/MicroJitterSampler.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class MicroJitterSampler {
3434
};
3535
private static final double UTIL = Double.parseDouble(System.getProperty("util", "50"));
3636
private static final boolean BUSYWAIT = Boolean.parseBoolean(System.getProperty("busywait", "false"));
37-
private static final int CPU = Integer.parseInt(System.getProperty("cpu", "-1"));
37+
private static final String CPU = System.getProperty("cpu", "none");
3838

3939
private final int[] count = new int[DELAY.length];
4040
private long totalTime = 0;
@@ -71,10 +71,7 @@ private void once() throws InterruptedException {
7171
}
7272

7373
public void run() {
74-
if (CPU != -1)
75-
Affinity.setAffinity(CPU);
76-
77-
try {
74+
try (final AffinityLock lock = AffinityLock.acquireLock(CPU)) {
7875
boolean first = true;
7976
System.out.println("Warming up...");
8077
while (!Thread.currentThread().isInterrupted()) {

0 commit comments

Comments
 (0)