|
19 | 19 | * |
20 | 20 | */ |
21 | 21 |
|
22 | | -#include "nvtop/interface.h" |
23 | 22 | #include "nvtop/common.h" |
24 | 23 | #include "nvtop/extract_gpuinfo_common.h" |
| 24 | +#include "nvtop/interface.h" |
25 | 25 | #include "nvtop/interface_common.h" |
26 | 26 | #include "nvtop/interface_internal_common.h" |
27 | 27 | #include "nvtop/interface_layout_selection.h" |
@@ -1716,7 +1716,7 @@ static unsigned populate_plot_data_from_ring_buffer(const struct nvtop_interface |
1716 | 1716 | assert(total_to_draw > 0); |
1717 | 1717 | assert(size_data_buff % total_to_draw == 0); |
1718 | 1718 | unsigned max_data_to_copy = size_data_buff / total_to_draw; |
1719 | | - double(*data_split)[total_to_draw] = (double(*)[total_to_draw])data; |
| 1719 | + double (*data_split)[total_to_draw] = (double (*)[total_to_draw])data; |
1720 | 1720 |
|
1721 | 1721 | unsigned in_processing = 0; |
1722 | 1722 | for (unsigned i = 0; i < plot_win->num_devices_to_plot; ++i) { |
@@ -2074,6 +2074,9 @@ void print_snapshot(struct list_head *devices, bool use_fahrenheit_option) { |
2074 | 2074 | const char *power_field = "power_draw"; |
2075 | 2075 | const char *gpu_util_field = "gpu_util"; |
2076 | 2076 | const char *mem_util_field = "mem_util"; |
| 2077 | + const char *mem_total_field = "mem_total"; |
| 2078 | + const char *mem_used_field = "mem_used"; |
| 2079 | + const char *mem_free_field = "mem_free"; |
2077 | 2080 |
|
2078 | 2081 | printf("%s{\n", indent_level_two); |
2079 | 2082 |
|
@@ -2137,6 +2140,21 @@ void print_snapshot(struct list_head *devices, bool use_fahrenheit_option) { |
2137 | 2140 | printf("%s\"%s\": \"%u%%\"\n", indent_level_four, mem_util_field, device->dynamic_info.mem_util_rate); |
2138 | 2141 | else |
2139 | 2142 | printf("%s\"%s\": null\n", indent_level_four, mem_util_field); |
| 2143 | + // Memory Total |
| 2144 | + if (GPUINFO_DYNAMIC_FIELD_VALID(&device->dynamic_info, total_memory)) |
| 2145 | + printf("%s\"%s\": \"%llu\"\n", indent_level_four, mem_total_field, device->dynamic_info.total_memory); |
| 2146 | + else |
| 2147 | + printf("%s\"%s\": null\n", indent_level_four, mem_total_field); |
| 2148 | + // Memory Used |
| 2149 | + if (GPUINFO_DYNAMIC_FIELD_VALID(&device->dynamic_info, used_memory)) |
| 2150 | + printf("%s\"%s\": \"%llu\"\n", indent_level_four, mem_used_field, device->dynamic_info.used_memory); |
| 2151 | + else |
| 2152 | + printf("%s\"%s\": null\n", indent_level_four, mem_used_field); |
| 2153 | + // Memory Available |
| 2154 | + if (GPUINFO_DYNAMIC_FIELD_VALID(&device->dynamic_info, free_memory)) |
| 2155 | + printf("%s\"%s\": \"%llu\"\n", indent_level_four, mem_free_field, device->dynamic_info.free_memory); |
| 2156 | + else |
| 2157 | + printf("%s\"%s\": null\n", indent_level_four, mem_free_field); |
2140 | 2158 |
|
2141 | 2159 | if (device->list.next == devices) |
2142 | 2160 | printf("%s}\n", indent_level_two); |
|
0 commit comments