Fix bug in CPUManager map.Keys() and map.Values() implementations
Previously these would return lists that were too long because we appended to pre-initialized lists with a specific size. Since the primary place these functions are used is in the mean and standard deviation calculations for the NUMA distribution algorithm, it meant that the results of these calculations were often incorrect. As a result, some of the unit tests we have are actually incorrect (because the results we expect do not actually produce the best balanced distribution of CPUs across all NUMA nodes for the input provided). These tests will be patched up in subsequent commits. Signed-off-by: Kevin Klues <kklues@nvidia.com>
This commit is contained in:
@@ -45,7 +45,7 @@ func (m mapIntInt) Clone() mapIntInt {
|
||||
}
|
||||
|
||||
func (m mapIntInt) Keys() []int {
|
||||
keys := make([]int, len(m))
|
||||
var keys []int
|
||||
for k := range m {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
@@ -53,7 +53,7 @@ func (m mapIntInt) Keys() []int {
|
||||
}
|
||||
|
||||
func (m mapIntInt) Values() []int {
|
||||
values := make([]int, len(m))
|
||||
var values []int
|
||||
for _, v := range m {
|
||||
values = append(values, v)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user