Added compact sensor display option
This commit is contained in:
+21
-9
@@ -19,15 +19,17 @@ static const char helpstring[] = "Available options:\n"
|
||||
" N to set the fan to that manual % speed\n"
|
||||
" [+/-]N to set that fan to an RPM offset from the GPU-controlled speed\n"
|
||||
"--reset : Reset all fans to their default mode\n"
|
||||
"--sensors : Print sensor readings even if setting a fan speed \n";
|
||||
"--sensors : Print sensor readings even if setting a fan speed \n"
|
||||
"--compact : Print sensor reading in a compact one-line per card format\n";
|
||||
|
||||
void print_gpu_info(int gpu_num, struct card_info gpus[]);
|
||||
void print_gpu_info(int gpu_num, struct card_info gpus[], int compact);
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
struct card_info gpus[MAX_GPUS];
|
||||
int gpu_count;
|
||||
int print_info = 0;
|
||||
int compact = 0;
|
||||
int gpu_num = -1; /* Card to control */
|
||||
char *fan_speed[ICX3_MAX_FANS] = {NULL};
|
||||
|
||||
@@ -65,6 +67,8 @@ int main (int argc, char **argv)
|
||||
fan_speed[j] = "auto";
|
||||
} else if (strcmp(argv[i], "--sensors") == 0) {
|
||||
print_info = 1;
|
||||
} else if (strcmp(argv[i], "--compact") == 0) {
|
||||
compact = 1;
|
||||
} else {
|
||||
printf(helpstring);
|
||||
return 0;
|
||||
@@ -117,19 +121,27 @@ int main (int argc, char **argv)
|
||||
if (print_info) {
|
||||
if (gpu_num == -1) {
|
||||
for (int i = 0; i < gpu_count; i++){
|
||||
print_gpu_info(i, gpus);
|
||||
print_gpu_info(i, gpus, compact);
|
||||
}
|
||||
} else if (gpu_num <= gpu_count - 1) {
|
||||
print_gpu_info(gpu_num, gpus);
|
||||
print_gpu_info(gpu_num, gpus, compact);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void print_gpu_info(int gpu_num, struct card_info gpus[]) {
|
||||
printf("#%d: %s (%s) @ %s\n", gpu_num, gpus[gpu_num].card_name, gpus[gpu_num].i2c_dev_path, gpus[gpu_num].pci_id);
|
||||
print_icx3_fans(gpus[gpu_num].i2c_dev_path);
|
||||
print_icx3_temps(gpus[gpu_num].i2c_dev_path);
|
||||
printf("\n");
|
||||
void print_gpu_info(int gpu_num, struct card_info gpus[], int compact) {
|
||||
if (compact) {
|
||||
printf("#%d ", gpu_num);
|
||||
print_icx3_fans_oneline(gpus[gpu_num].i2c_dev_path);
|
||||
print_icx3_temps_oneline(gpus[gpu_num].i2c_dev_path);
|
||||
printf("\n");
|
||||
} else {
|
||||
printf("#%d: %s (%s) @ %s\n", gpu_num, gpus[gpu_num].card_name, gpus[gpu_num].i2c_dev_path, gpus[gpu_num].pci_id);
|
||||
print_icx3_fans(gpus[gpu_num].i2c_dev_path);
|
||||
print_icx3_temps(gpus[gpu_num].i2c_dev_path);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user