mirror of
https://github.com/shirou/gopsutil.git
synced 2025-04-28 13:48:49 +08:00
Merge pull request #1688 from zmyzheng/zmyzheng/fix-IOCountersWithContext
fix(IOCountersWithContext): Fix the issue of not using names to fil ter devices in func IOCountersWithContext of the windows implementation
This commit is contained in:
commit
edff3add94
@ -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…
x
Reference in New Issue
Block a user