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 @@ -172,6 +172,16 @@ func (s CPUSet) ToSlice() []int {
172
172
return result
173
173
}
174
174
175
+ // ToSliceNoSort returns a slice of integers that contains all elements from
176
+ // this set.
177
+ func (s CPUSet ) ToSliceNoSort () []int {
178
+ result := []int {}
179
+ for cpu := range s .elems {
180
+ result = append (result , cpu )
181
+ }
182
+ return result
183
+ }
184
+
175
185
// String returns a new string representation of the elements in this CPU set
176
186
// in canonical linux CPU list format.
177
187
//
You can’t perform that action at this time.
0 commit comments