File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ func (a *cpuAccumulator) freeSockets() []int {
69
69
// - socket ID, ascending
70
70
// - core ID, ascending
71
71
func (a * cpuAccumulator ) freeCores () []int {
72
- socketIDs := a .details .Sockets ().ToSlice ()
72
+ socketIDs := a .details .Sockets ().ToSliceNoSort ()
73
73
sort .Slice (socketIDs ,
74
74
func (i , j int ) bool {
75
75
iCores := a .details .CoresInSocket (socketIDs [i ]).Filter (a .isCoreFree )
Original file line number Diff line number Diff line change @@ -188,6 +188,16 @@ func (s CPUSet) ToSlice() []int {
188
188
return result
189
189
}
190
190
191
+ // ToSliceNoSort returns a slice of integers that contains all elements from
192
+ // this set.
193
+ func (s CPUSet ) ToSliceNoSort () []int {
194
+ result := []int {}
195
+ for cpu := range s .elems {
196
+ result = append (result , cpu )
197
+ }
198
+ return result
199
+ }
200
+
191
201
// String returns a new string representation of the elements in this CPU set
192
202
// in canonical linux CPU list format.
193
203
//
You can’t perform that action at this time.
0 commit comments