mirror of
https://github.com/shirou/gopsutil.git
synced 2025-04-29 13:49:21 +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,14 +218,17 @@ func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOC
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return drivemap, err
|
return drivemap, err
|
||||||
}
|
}
|
||||||
drivemap[path] = IOCountersStat{
|
|
||||||
ReadBytes: uint64(diskPerformance.BytesRead),
|
if len(names) == 0 || common.StringsHas(names, path) {
|
||||||
WriteBytes: uint64(diskPerformance.BytesWritten),
|
drivemap[path] = IOCountersStat{
|
||||||
ReadCount: uint64(diskPerformance.ReadCount),
|
ReadBytes: uint64(diskPerformance.BytesRead),
|
||||||
WriteCount: uint64(diskPerformance.WriteCount),
|
WriteBytes: uint64(diskPerformance.BytesWritten),
|
||||||
ReadTime: uint64(diskPerformance.ReadTime / 10000 / 1000), // convert to ms: https://github.com/giampaolo/psutil/issues/1012
|
ReadCount: uint64(diskPerformance.ReadCount),
|
||||||
WriteTime: uint64(diskPerformance.WriteTime / 10000 / 1000),
|
WriteCount: uint64(diskPerformance.WriteCount),
|
||||||
Name: path,
|
ReadTime: uint64(diskPerformance.ReadTime / 10000 / 1000), // convert to ms: https://github.com/giampaolo/psutil/issues/1012
|
||||||
|
WriteTime: uint64(diskPerformance.WriteTime / 10000 / 1000),
|
||||||
|
Name: path,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user