2020-03-23 14:56:22 +00:00
|
|
|
package sectorstorage
|
|
|
|
|
2020-03-27 20:08:06 +00:00
|
|
|
type WorkerStats struct {
|
|
|
|
Info WorkerInfo
|
2020-03-23 14:56:22 +00:00
|
|
|
|
2020-03-27 20:08:06 +00:00
|
|
|
MemUsedMin uint64
|
|
|
|
MemUsedMax uint64
|
|
|
|
GpuUsed bool
|
|
|
|
CpuUse int
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Manager) WorkerStats() map[uint64]WorkerStats {
|
2020-03-23 14:56:22 +00:00
|
|
|
m.workersLk.Lock()
|
|
|
|
defer m.workersLk.Unlock()
|
|
|
|
|
2020-03-27 20:08:06 +00:00
|
|
|
out := map[uint64]WorkerStats{}
|
2020-03-23 14:56:22 +00:00
|
|
|
|
|
|
|
for id, handle := range m.workers {
|
2020-03-27 20:08:06 +00:00
|
|
|
out[uint64(id)] = WorkerStats{
|
2020-03-23 14:56:22 +00:00
|
|
|
Info: handle.info,
|
|
|
|
MemUsedMin: handle.memUsedMin,
|
|
|
|
MemUsedMax: handle.memUsedMax,
|
|
|
|
GpuUsed: handle.gpuUsed,
|
|
|
|
CpuUse: handle.cpuUse,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return out
|
|
|
|
}
|