[process][windows] Use win32 API in process.NumThreads() instead of slow WMI call

pull/754/head
Lomanic 6 years ago
parent e4d2c2f87a
commit 9a445d5f6a

@ -520,11 +520,11 @@ func (p *Process) NumThreads() (int32, error) {
}
func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) {
dst, err := GetWin32ProcWithContext(ctx, p.Pid)
_, ret, _, err := getFromSnapProcess(p.Pid)
if err != nil {
return 0, fmt.Errorf("could not get ThreadCount: %s", err)
}
return int32(dst[0].ThreadCount), nil
return ret, nil
}
func (p *Process) Threads() (map[int32]*cpu.TimesStat, error) {
return p.ThreadsWithContext(context.Background())

Loading…
Cancel
Save