@@ -90,13 +90,15 @@ func (d CPUDetails) NUMANodes() cpuset.CPUSet {
90
90
return b .Result ()
91
91
}
92
92
93
- // NUMANodesInSocket returns all of the logical NUMANode IDs associated with
94
- // the given Socket ID in this CPUDetails.
95
- func (d CPUDetails ) NUMANodesInSocket ( id int ) cpuset.CPUSet {
93
+ // NUMANodesInSockets returns all of the logical NUMANode IDs associated with
94
+ // the given socket IDs in this CPUDetails.
95
+ func (d CPUDetails ) NUMANodesInSockets ( ids ... int ) cpuset.CPUSet {
96
96
b := cpuset .NewBuilder ()
97
- for _ , info := range d {
98
- if info .SocketID == id {
99
- b .Add (info .NUMANodeID )
97
+ for _ , id := range ids {
98
+ for _ , info := range d {
99
+ if info .SocketID == id {
100
+ b .Add (info .NUMANodeID )
101
+ }
100
102
}
101
103
}
102
104
return b .Result ()
@@ -112,25 +114,29 @@ func (d CPUDetails) Sockets() cpuset.CPUSet {
112
114
return b .Result ()
113
115
}
114
116
115
- // CPUsInSocket returns all of the logical CPU IDs associated with the
116
- // given socket ID in this CPUDetails.
117
- func (d CPUDetails ) CPUsInSocket ( id int ) cpuset.CPUSet {
117
+ // CPUsInSockets returns all of the logical CPU IDs associated with the given
118
+ // socket IDs in this CPUDetails.
119
+ func (d CPUDetails ) CPUsInSockets ( ids ... int ) cpuset.CPUSet {
118
120
b := cpuset .NewBuilder ()
119
- for cpu , info := range d {
120
- if info .SocketID == id {
121
- b .Add (cpu )
121
+ for _ , id := range ids {
122
+ for cpu , info := range d {
123
+ if info .SocketID == id {
124
+ b .Add (cpu )
125
+ }
122
126
}
123
127
}
124
128
return b .Result ()
125
129
}
126
130
127
- // SocketsInNUMANode returns all of the logical Socket IDs associated with the
128
- // given NUMANode ID in this CPUDetails.
129
- func (d CPUDetails ) SocketsInNUMANode ( id int ) cpuset.CPUSet {
131
+ // SocketsInNUMANodes returns all of the logical Socket IDs associated with the
132
+ // given NUMANode IDs in this CPUDetails.
133
+ func (d CPUDetails ) SocketsInNUMANodes ( ids ... int ) cpuset.CPUSet {
130
134
b := cpuset .NewBuilder ()
131
- for _ , info := range d {
132
- if info .NUMANodeID == id {
133
- b .Add (info .SocketID )
135
+ for _ , id := range ids {
136
+ for _ , info := range d {
137
+ if info .NUMANodeID == id {
138
+ b .Add (info .SocketID )
139
+ }
134
140
}
135
141
}
136
142
return b .Result ()
@@ -146,25 +152,29 @@ func (d CPUDetails) Cores() cpuset.CPUSet {
146
152
return b .Result ()
147
153
}
148
154
149
- // CoresInNUMANode returns all of the core IDs associated with the given
150
- // NUMA ID in this CPUDetails.
151
- func (d CPUDetails ) CoresInNUMANode ( id int ) cpuset.CPUSet {
155
+ // CoresInNUMANodes returns all of the core IDs associated with the given
156
+ // NUMANode IDs in this CPUDetails.
157
+ func (d CPUDetails ) CoresInNUMANodes ( ids ... int ) cpuset.CPUSet {
152
158
b := cpuset .NewBuilder ()
153
- for _ , info := range d {
154
- if info .NUMANodeID == id {
155
- b .Add (info .CoreID )
159
+ for _ , id := range ids {
160
+ for _ , info := range d {
161
+ if info .NUMANodeID == id {
162
+ b .Add (info .CoreID )
163
+ }
156
164
}
157
165
}
158
166
return b .Result ()
159
167
}
160
168
161
- // CoresInSocket returns all of the core IDs associated with the given
162
- // socket ID in this CPUDetails.
163
- func (d CPUDetails ) CoresInSocket ( id int ) cpuset.CPUSet {
169
+ // CoresInSockets returns all of the core IDs associated with the given socket
170
+ // IDs in this CPUDetails.
171
+ func (d CPUDetails ) CoresInSockets ( ids ... int ) cpuset.CPUSet {
164
172
b := cpuset .NewBuilder ()
165
- for _ , info := range d {
166
- if info .SocketID == id {
167
- b .Add (info .CoreID )
173
+ for _ , id := range ids {
174
+ for _ , info := range d {
175
+ if info .SocketID == id {
176
+ b .Add (info .CoreID )
177
+ }
168
178
}
169
179
}
170
180
return b .Result ()
@@ -179,25 +189,29 @@ func (d CPUDetails) CPUs() cpuset.CPUSet {
179
189
return b .Result ()
180
190
}
181
191
182
- // CPUsInNUMANode returns all of the logical CPU IDs associated with the given
183
- // NUMANode ID in this CPUDetails.
184
- func (d CPUDetails ) CPUsInNUMANode ( id int ) cpuset.CPUSet {
192
+ // CPUsInNUMANodes returns all of the logical CPU IDs associated with the given
193
+ // NUMANode IDs in this CPUDetails.
194
+ func (d CPUDetails ) CPUsInNUMANodes ( ids ... int ) cpuset.CPUSet {
185
195
b := cpuset .NewBuilder ()
186
- for cpu , info := range d {
187
- if info .NUMANodeID == id {
188
- b .Add (cpu )
196
+ for _ , id := range ids {
197
+ for cpu , info := range d {
198
+ if info .NUMANodeID == id {
199
+ b .Add (cpu )
200
+ }
189
201
}
190
202
}
191
203
return b .Result ()
192
204
}
193
205
194
- // CPUsInCore returns all of the logical CPU IDs associated with the
195
- // given core ID in this CPUDetails.
196
- func (d CPUDetails ) CPUsInCore ( id int ) cpuset.CPUSet {
206
+ // CPUsInCores returns all of the logical CPU IDs associated with the given
207
+ // core IDs in this CPUDetails.
208
+ func (d CPUDetails ) CPUsInCores ( ids ... int ) cpuset.CPUSet {
197
209
b := cpuset .NewBuilder ()
198
- for cpu , info := range d {
199
- if info .CoreID == id {
200
- b .Add (cpu )
210
+ for _ , id := range ids {
211
+ for cpu , info := range d {
212
+ if info .CoreID == id {
213
+ b .Add (cpu )
214
+ }
201
215
}
202
216
}
203
217
return b .Result ()
0 commit comments