formatted files
This commit is contained in:
parent
8bc408dea1
commit
3a9db01fa0
2 changed files with 6 additions and 6 deletions
|
@ -1,13 +1,13 @@
|
|||
package def
|
||||
|
||||
// the sortBy function that takes a task reference and returns the resource to consider when sorting.
|
||||
type sortBy func (task *Task) float64
|
||||
type sortBy func(task *Task) float64
|
||||
|
||||
// Possible Sorting Criteria
|
||||
// Each holds a closure that fetches the required resource from the
|
||||
// given task reference.
|
||||
var (
|
||||
SortByCPU = func (task *Task) float64 {return task.CPU}
|
||||
SortByRAM = func (task *Task) float64 {return task.RAM}
|
||||
SortByWatts = func (task *Task) float64 {return task.Watts}
|
||||
SortByCPU = func(task *Task) float64 { return task.CPU }
|
||||
SortByRAM = func(task *Task) float64 { return task.RAM }
|
||||
SortByWatts = func(task *Task) float64 { return task.Watts }
|
||||
)
|
||||
|
|
|
@ -2,8 +2,8 @@ package def
|
|||
|
||||
import (
|
||||
"github.com/mdesenfants/gokmeans"
|
||||
"sort"
|
||||
"log"
|
||||
"sort"
|
||||
)
|
||||
|
||||
// Information about a cluster of tasks
|
||||
|
@ -118,7 +118,7 @@ func labelAndOrder(clusters map[int][]Task, numberOfClusters int, taskObservatio
|
|||
// Generic Task Sorter.
|
||||
// Be able to sort an array of tasks based on any of the tasks' resources.
|
||||
func SortTasks(ts []Task, sb sortBy) {
|
||||
sort.SliceStable(ts, func (i, j int) bool {
|
||||
sort.SliceStable(ts, func(i, j int) bool {
|
||||
return sb(&ts[i]) <= sb(&ts[j])
|
||||
})
|
||||
}
|
||||
|
|
Reference in a new issue