Skip to content

Commit

Permalink
better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Safonov committed Aug 1, 2024
1 parent 0921bf5 commit b191896
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,9 @@ func (x *PinState) PinLoad(ctx *Context) error {

assignedCount := node.assignCores(ctx, procInfo)
if assignedCount != cpuCount {
log.Warningf("PinState PinLoad, node.assignCores failed, assignedCount = %d need cpuCount = %d", assignedCount, cpuCount)
vmName, _ := parseVmName(procInfo.ProcInfo.Cmd)
nodeState := node.StateString()
log.Warningf("PinState PinLoad, node.assignCores failed, assignedCount = %d need cpuCount = %d, vmName = %s, %s", assignedCount, cpuCount, vmName, nodeState)
}
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/pool.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package pkg

import (
"fmt"
"github.com/pnsafonov/pind/pkg/config"
"github.com/pnsafonov/pind/pkg/http_api"
"github.com/pnsafonov/pind/pkg/numa"
Expand Down Expand Up @@ -193,6 +194,13 @@ func getAvailableCoresCount(map0 map[int]*PoolCore) int {
return count
}

func (x *PoolNodeInfo) StateString() string {
l0 := len(x.LoadFree)
l1 := len(x.LoadUsed)
l2 := l0 + l1
return fmt.Sprintf("node %d, free = %d, load = %d, total = %d", x.Index, l0, l1, l2)
}

func (x *PoolNodeInfo) assignCores(ctx *Context, proc *PinProc) int {
node := x
noSelected := ctx.Config.Service.PinCoresAlgo.NotSelected
Expand Down

0 comments on commit b191896

Please sign in to comment.