24
24
*/
25
25
package org .openjdk .jcstress .infra .runners ;
26
26
27
+ import org .openjdk .jcstress .os .AffinityMode ;
28
+
27
29
import java .io .DataInputStream ;
28
30
import java .io .DataOutputStream ;
29
31
import java .io .IOException ;
@@ -37,7 +39,8 @@ public class ForkedTestConfig {
37
39
public final int maxFootprintMB ;
38
40
public int minStride ;
39
41
public int maxStride ;
40
- public int [] actorMap ;
42
+ public boolean localAffinity ;
43
+ public int [] localAffinityMap ;
41
44
42
45
public ForkedTestConfig (TestConfig cfg ) {
43
46
spinLoopStyle = cfg .spinLoopStyle ;
@@ -47,7 +50,10 @@ public ForkedTestConfig(TestConfig cfg) {
47
50
maxFootprintMB = cfg .maxFootprintMB ;
48
51
minStride = cfg .minStride ;
49
52
maxStride = cfg .maxStride ;
50
- actorMap = cfg .cpuMap .actorMap ();
53
+ localAffinity = cfg .shClass .mode () == AffinityMode .LOCAL ;
54
+ if (localAffinity ) {
55
+ localAffinityMap = cfg .cpuMap .actorMap ();
56
+ }
51
57
}
52
58
53
59
public ForkedTestConfig (DataInputStream dis ) throws IOException {
@@ -58,10 +64,13 @@ public ForkedTestConfig(DataInputStream dis) throws IOException {
58
64
maxFootprintMB = dis .readInt ();
59
65
minStride = dis .readInt ();
60
66
maxStride = dis .readInt ();
61
- int len = dis .readInt ();
62
- actorMap = new int [len ];
63
- for (int c = 0 ; c < len ; c ++) {
64
- actorMap [c ] = dis .readInt ();
67
+ localAffinity = dis .readBoolean ();
68
+ if (localAffinity ) {
69
+ int len = dis .readInt ();
70
+ localAffinityMap = new int [len ];
71
+ for (int c = 0 ; c < len ; c ++) {
72
+ localAffinityMap [c ] = dis .readInt ();
73
+ }
65
74
}
66
75
}
67
76
@@ -73,9 +82,12 @@ public void write(DataOutputStream dos) throws IOException {
73
82
dos .writeInt (maxFootprintMB );
74
83
dos .writeInt (minStride );
75
84
dos .writeInt (maxStride );
76
- dos .writeInt (actorMap .length );
77
- for (int am : actorMap ) {
78
- dos .writeInt (am );
85
+ dos .writeBoolean (localAffinity );
86
+ if (localAffinity ) {
87
+ dos .writeInt (localAffinityMap .length );
88
+ for (int am : localAffinityMap ) {
89
+ dos .writeInt (am );
90
+ }
79
91
}
80
92
}
81
93
0 commit comments