Commit Graph

61 Commits

Author SHA1 Message Date
Maxime Schmitt
e82df1194d Fix plot for a maximum of 64 GPUs 2022-06-04 12:20:06 +02:00
Maxime Schmitt
e2451db875 C++ friendly header for testing 2022-05-29 11:37:15 +02:00
Maxime Schmitt
6a395ef311 Expose max lines in a plot as a macro 2022-05-26 15:46:32 +02:00
Maxime Schmitt
5c896c159b Enable CMake testing using GTest
Adding a unit test for bug report #147
2022-05-22 21:59:07 +02:00
Maxime Schmitt
5bf86b924e Merge branch 'reallocarrayFix' 2022-05-15 20:25:31 +02:00
Maxime Schmitt
51ed66332d Metrics reset cleanup
Reset all metrics with RESET_ALL. This makes the code cleaner and avoids
errors where some dynamic fields were not correctly reset.
2022-05-15 20:19:41 +02:00
Maxime Schmitt
29e0d6968b Alternative path to get GPU usage from process info
For some older AMG GPU, the total usage is not available from the DRM
interface.
If such case arise, and per-process usage is valid, compute the global
usage from per-process usage.

Fixes #146
2022-05-15 16:14:11 +02:00
Maxime Schmitt
fd174b46ec Linear realloc strategy
- Change from exponential to linear realloc strategy.

There are not too many processes running on the GPUs, incrementing the
process buffer by increments of 16 is more reasonable.

Similarly for DRM file descriptors, there are usually 2-4 of them open
at one time by one process. Increment of 8 should cover most cases.

- Share the PID buffer for DRM FDs while scanning processes to avoid
unnecessary allocations.

- Exit the program if reallocarray fails
2022-05-15 14:40:08 +02:00
Maxime Schmitt
dade5f7a4d Check for reallocarray availability 2022-05-15 13:05:50 +02:00
YiFei Zhu
3772d48170 Prepare mask for inclusion of multiple vendors
* Use shifts for mask and make it into ssize_t (so it gets arithmetic
  shift instead of logical)
* Remove hardcoded names of nvidia in variable names outside of nvidia
  file.
2022-04-04 19:59:30 +02:00
YiFei Zhu
ec6eced4e8 Make GPU vendors use a hooking mechanism
So we don't need to hardcode supported vendors in generic
extract_gpuinfo code.
2022-04-04 19:59:30 +02:00
YiFei Zhu
4dbe17f4c6 Make devices into a linked list and make use container_of
Since we are adding more vendors, having some sort of generic
simplifies the code a lot, instead of using unions.
2022-04-04 19:59:30 +02:00
YiFei Zhu
8d00c79b09 typedef struct foo -> struct foo
Using typedef struct aliases is makes it more difficult to understand
what exactly is being abstrated away [1], I need this change to
understand the code.

nvmlDevice_t in continue to use nvmlDevice_t to make consistent
with nvml headers.

[1] https://www.kernel.org/doc/html/latest/process/coding-style.html#typedefs
2022-04-04 19:59:30 +02:00
Maxime Schmitt
65ebed1dbb Line plot algorithm rewrite 2021-05-25 21:20:13 +02:00
Maxime Schmitt
c5c379e222 Merge process related options to process logic 2021-05-25 14:14:28 +02:00
Maxime Schmitt
d74655ea63 Separate the shortcut window logic from process and setup 2021-05-25 14:14:28 +02:00
Maxime Schmitt
9db18a2a27 end/dec: clear the windows only when needed 2021-05-25 14:13:54 +02:00
Maxime Schmitt
6ea3768f4f Integration of per process utilization to the interface 2021-05-20 13:42:49 +02:00
Maxime Schmitt
9395e511ff NVIDIA per process utilization info retrieval 2021-05-20 13:42:49 +02:00
Maxime Schmitt
7534e39283 Add the process list metric options to the setup window 2021-05-20 13:42:46 +02:00
Maxime Schmitt
37aa79d9f7 Add the GPU/MEM clock rates to the list of metrics that can be plotted 2021-05-18 20:50:50 +02:00
Maxime Schmitt
cb3f979e13 Add the fan speed to the list of metrics that can be plotted 2021-05-18 19:59:00 +02:00
Maxime Schmitt
0282792526 Add the power draw rate to the list of metrics that can be plotted 2021-05-18 19:50:05 +02:00
Maxime Schmitt
fae7d7f65d Update interface codebase
The interface layout selection has been updated to support the interface option.
The interface option stores which data that needs to be plotted for each
devices.

The plot drawing code now supports the reverse plotting option.

The interface uses the ring buffer, the updated version of
the layout computation and plots the data specified by the interface options.
2021-05-17 23:32:59 +02:00
Maxime Schmitt
2f20e3a753 Use a ring buffer to store the chart data 2021-05-17 22:42:28 +02:00
Maxime Schmitt
60f331d5d1 Add the update interval as an option
- Add a general option category.
- Moved the disable color option to the general category.
- Add the interface update interval to the general category.
2021-05-15 20:22:50 +02:00
Maxime Schmitt
41c7feaf16 Setup window implementation
The setup window allows the user to modify and save the options of NVTOP.
2021-05-15 17:43:43 +02:00
Maxime Schmitt
4e59a5c841 Configuration file support
This patch adds the loading and writing of the interface options as ini format.
2021-05-15 17:17:29 +02:00
Maxime Schmitt
08be9c0e8f Redisign of program option handling
This change is a precursor to a new option setup window.

The structure supports the command line options, the information to be plotted for each device, and the sorting order of the processes.
2021-05-12 20:26:20 +02:00
Maxime Schmitt
7ba34644ae Update interface and main compilation units to use the new gpuinfo functions 2021-05-11 22:09:24 +02:00
Maxime Schmitt
b1e19a6151 Processus info field rename and add missing header 2021-05-11 21:47:55 +02:00
Maxime Schmitt
3a64efd76f Per vendor GPU extraction
This refactors the GPU information extraction bit into a vendor specific
file.
This way the compilation will not rely on the presence of the nvml header and libnvidia-ml library anymore.
This way it will be easier to add the support for AMD GPU in the future.
2021-05-11 21:47:46 +02:00
Maxime Schmitt
0ef51c99ee Bump uthash version to 2.3.0 2021-05-11 21:47:46 +02:00
Maxime Schmitt
2fa112762c Interface: plot refresh rate respects the -d option
Fixes: #88
2021-01-12 15:33:41 +01:00
Maxime Schmitt
087a025301 Plot: reverse to march other monitoring programs behavior
Change the plot order to mimic the other monitoring programs behavior.
The consensus seems to be that the most recent point is displayed on the
right of the plot and oldest on the left.

Closes #69 as this is now the default.
The command line option "-r, --reverse-abs" is provided to reverse the
plot, getting the pre-commit behaviour if preferred.
2020-10-12 16:07:23 +02:00
Maxime Schmitt
cfa7d66c8b Descent code indentation 2019-01-01 17:51:49 +01:00
Maxime Schmitt
024788ff79 New interface placement algorithm. 2019-01-01 17:39:02 +01:00
Maxime Schmitt
a0eaedc2c5 CPU side memory and utilization in process interface 2018-12-24 18:13:18 +01:00
Maxime Schmitt
6991de1550 CPU side memory and utilization collection 2018-12-23 20:23:17 +01:00
Maxime Schmitt
8e0edef321 Per GPU plot 2018-11-29 17:41:21 +01:00
Maxime Schmitt
4785fe8435 CMake Update 2018-11-21 13:46:39 +01:00
Maxime Schmitt
03186401ba Plot legend 2018-11-21 13:46:39 +01:00
Maxime Schmitt
81e192360f Disable plot option 2018-11-21 13:46:39 +01:00
Maxime Schmitt
74ffeb4b2e Line plot 2018-11-21 13:46:39 +01:00
Maxime Schmitt
8baf504277 Plot 2018-11-21 13:46:39 +01:00
Maxime Schmitt
8b80a11faa Device: encode/decode auto-hide 2018-11-21 13:46:39 +01:00
Maxime Schmitt
e37815d0dc Separate interface update from gpu info query 2018-11-21 13:46:39 +01:00
Maxime Schmitt
e1cab30516 Interface: window placement redone 2018-11-21 13:46:39 +01:00
Maxime Schmitt
7affdc8236 Fahrenheit option 2018-10-20 11:29:42 +02:00
Maxime Schmitt
4377e9c0db Avoid using reserved C identifiers 2018-10-18 11:43:08 +02:00