mirror of
https://github.com/XuehaiPan/nvitop.git
synced 2026-05-21 06:45:24 -06:00
fix(api/device): add extra 0.25s timestamp margin for GPU process utilization
This commit is contained in:
parent
b99d90544d
commit
27d22cae37
1 changed files with 4 additions and 1 deletions
|
|
@ -1700,7 +1700,10 @@ class Device: # pylint: disable=too-many-instance-attributes,too-many-public-me
|
|||
samples = libnvml.nvmlQuery(
|
||||
'nvmlDeviceGetProcessUtilization',
|
||||
self.handle,
|
||||
time.time_ns() // 1000,
|
||||
# Only utilization samples that were recorded after this timestamp will be returned.
|
||||
# The CPU timestamp, i.e. absolute Unix epoch timestamp (in microseconds), is used.
|
||||
# Here we use the timestamp 1/4 second ago to ensure the record buffer is not empty.
|
||||
time.time_ns() // 1000 - 250_000,
|
||||
default=(),
|
||||
)
|
||||
for s in sorted(samples, key=lambda s: s.timeStamp):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue