lotus/stats.go

36 lines
824 B
Go
Raw Normal View History

2020-03-23 14:56:22 +00:00
package sectorstorage
import "github.com/filecoin-project/sector-storage/storiface"
2020-03-23 14:56:22 +00:00
func (m *Manager) WorkerStats() map[uint64]storiface.WorkerStats {
m.sched.workersLk.Lock()
defer m.sched.workersLk.Unlock()
2020-03-23 14:56:22 +00:00
out := map[uint64]storiface.WorkerStats{}
2020-03-23 14:56:22 +00:00
for id, handle := range m.sched.workers {
out[uint64(id)] = storiface.WorkerStats{
2020-03-23 14:56:22 +00:00
Info: handle.info,
MemUsedMin: handle.active.memUsedMin,
MemUsedMax: handle.active.memUsedMax,
GpuUsed: handle.active.gpuUsed,
CpuUse: handle.active.cpuUse,
2020-03-23 14:56:22 +00:00
}
}
return out
}
2020-07-21 18:01:25 +00:00
func (m *Manager) WorkerJobs() map[uint64][]storiface.WorkerJob {
m.sched.workersLk.Lock()
defer m.sched.workersLk.Unlock()
out := map[uint64][]storiface.WorkerJob{}
for id, handle := range m.sched.workers {
out[uint64(id)] = handle.wt.Running()
}
return out
}