fix(IOCountersWithContext): Fix the issue of not using names to filter devices in func IOCountersWithContext of the windows implementation

pull/1688/head
Mingyang Zheng 7 months ago
parent 6dfedba254
commit 16d7f3242c

@ -218,6 +218,8 @@ func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOC
if err != nil { if err != nil {
return drivemap, err return drivemap, err
} }
if len(names) == 0 || common.StringsHas(names, path) {
drivemap[path] = IOCountersStat{ drivemap[path] = IOCountersStat{
ReadBytes: uint64(diskPerformance.BytesRead), ReadBytes: uint64(diskPerformance.BytesRead),
WriteBytes: uint64(diskPerformance.BytesWritten), WriteBytes: uint64(diskPerformance.BytesWritten),
@ -229,6 +231,7 @@ func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOC
} }
} }
} }
}
return drivemap, nil return drivemap, nil
} }

Loading…
Cancel
Save