[GH-ISSUE #17] [Feature Request] Make snapshot interval configurable in monitor mode #15

Closed
opened 2026-05-05 03:21:54 -06:00 by gitea-mirror · 4 comments
Owner

Originally created by @uwydoc on GitHub (May 12, 2022).
Original GitHub issue: https://github.com/XuehaiPan/nvitop/issues/17

just a small feature request, it would be better to make the snapshot interval configurable in monitor mode. a quick grep shows that there are multiple snapshot intervals, some are defined as class members, others are plain constant value in time.sleep(xxx)

Originally created by @uwydoc on GitHub (May 12, 2022). Original GitHub issue: https://github.com/XuehaiPan/nvitop/issues/17 just a small feature request, it would be better to make the snapshot interval configurable in monitor mode. a quick grep shows that there are multiple snapshot intervals, some are defined as class members, others are plain constant value in `time.sleep(xxx)`
gitea-mirror 2026-05-05 03:21:54 -06:00
Author
Owner

@XuehaiPan commented on GitHub (May 12, 2022):

just a small feature request, it would be better to make the snapshot interval configurable in monitor mode.

Hi @uwydoc, thanks for the post. I arbitrarily hardcoded the snapshot intervals in nvitop for performance issues. Taking snapshots is I/O intensive, especially when there are many processes on GPUs. I think we should not do this so frequently. nvitop takes snapshots for GPU device status every 1 second, and every 2 seconds for GPU processes.

Opinions are welcome. Can you give some use cases?


a quick grep shows that there are multiple snapshot intervals, some are defined as class members, others are plain constant value in time.sleep(xxx)

The class members (0.7 here)

f73b7d84c5/nvitop/gui/screens/main/device.py (L16-L19)

are not actual snapshot intervals. They only account for syncing results between threads.

The effective intervals are defined by ttl_cache:

f73b7d84c5/nvitop/gui/screens/main/device.py (L98-L100)

f73b7d84c5/nvitop/gui/screens/main/process.py (L169-L172)

<!-- gh-comment-id:1124565341 --> @XuehaiPan commented on GitHub (May 12, 2022): > just a small feature request, it would be better to make the snapshot interval configurable in monitor mode. Hi @uwydoc, thanks for the post. I arbitrarily hardcoded the snapshot intervals in `nvitop` for performance issues. Taking snapshots is I/O intensive, especially when there are many processes on GPUs. I think we should not do this so frequently. `nvitop` takes snapshots for GPU device status every 1 second, and every 2 seconds for GPU processes. Opinions are welcome. Can you give some use cases? ------ > a quick grep shows that there are multiple snapshot intervals, some are defined as class members, others are plain constant value in time.sleep(xxx) The class members (`0.7` here) https://github.com/XuehaiPan/nvitop/blob/f73b7d84c59c03f6cd8402b01018ae4a6990a653/nvitop/gui/screens/main/device.py#L16-L19 are not actual snapshot intervals. They only account for syncing results between threads. The effective intervals are defined by `ttl_cache`: https://github.com/XuehaiPan/nvitop/blob/f73b7d84c59c03f6cd8402b01018ae4a6990a653/nvitop/gui/screens/main/device.py#L98-L100 https://github.com/XuehaiPan/nvitop/blob/f73b7d84c59c03f6cd8402b01018ae4a6990a653/nvitop/gui/screens/main/process.py#L169-L172
Author
Owner

@uwydoc commented on GitHub (May 12, 2022):

well, i was planning to make the interval longer, say 3 seconds for process snapshot and gui refresh, to make its cpu load lower (0.2~0.3 currently). the default settings are reasonable, though, it would be better if the user can configure it according to their specific need. btw, change the update interval is a common feature supported by many top-like monitor tools, for example: nvidia-smi/gpustat/dstat/htop/glances.

<!-- gh-comment-id:1124611761 --> @uwydoc commented on GitHub (May 12, 2022): well, i was planning to make the interval longer, say 3 seconds for process snapshot and gui refresh, to make its cpu load lower (0.2~0.3 currently). the default settings are reasonable, though, it would be better if the user can configure it according to their specific need. btw, change the update interval is a common feature supported by many top-like monitor tools, for example: nvidia-smi/gpustat/dstat/htop/glances.
Author
Owner

@XuehaiPan commented on GitHub (May 12, 2022):

I'm afraid we cannot set the snapshot interval longer for device status, because these snapshot results are used for the graph plots.

I can make the interval for process snapshots to be configurable though.

<!-- gh-comment-id:1124627540 --> @XuehaiPan commented on GitHub (May 12, 2022): I'm afraid we cannot set the snapshot interval longer for device status, because these snapshot results are used for the graph plots. I can make the interval for process snapshots to be configurable though.
Author
Owner

@uwydoc commented on GitHub (May 13, 2022):

they are related, but i do not think it is impossible or even hard to make the snapshot interval configurable while keep the graph plot right. ok, maybe i should dig deeper into the code first.

<!-- gh-comment-id:1125575874 --> @uwydoc commented on GitHub (May 13, 2022): they are related, but i do not think it is impossible or even hard to make the snapshot interval configurable while keep the graph plot right. ok, maybe i should dig deeper into the code first.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/nvitop#15
No description provided.