Compare commits

..

No commits in common. "master" and "v2.1.2" have entirely different histories.

2 changed files with 9 additions and 18 deletions

View File

@ -55,7 +55,6 @@ Available options:
--watch N : Keep printing output every N seconds --watch N : Keep printing output every N seconds
--overwrite : Overwrite previously displayed info with --watch and --compact instead of continuously logging new lines --overwrite : Overwrite previously displayed info with --watch and --compact instead of continuously logging new lines
--color : Print headers in color in --compact mode for better readability --color : Print headers in color in --compact mode for better readability
--no-reasons : Do not query NVML for clocks reasons (can cause stuttering)
``` ```
### Examples: ### Examples:

View File

@ -37,10 +37,9 @@ static const char helpstring[] = "Available options:\n"
"--compact : Print sensor reading in a compact one-line per card format\n" "--compact : Print sensor reading in a compact one-line per card format\n"
"--watch N : Keep printing output every N seconds\n" "--watch N : Keep printing output every N seconds\n"
"--overwrite : Overwrite previously displayed info with --watch and --compact instead of continuously logging\n" "--overwrite : Overwrite previously displayed info with --watch and --compact instead of continuously logging\n"
"--color : Print headers in color in --compact mode for better readability\n" "--color : Print headers in color in --compact mode for better readability\n";
"--no-reasons : Do not query NVML for clocks reasons (can cause stuttering)\n";
void print_gpu_info(int gpu_num, struct card_info gpus[], int compact, int no_reasons); void print_gpu_info(int gpu_num, struct card_info gpus[], int compact);
int main (int argc, char **argv) int main (int argc, char **argv)
{ {
@ -51,7 +50,6 @@ int main (int argc, char **argv)
int gpu_num = -1; /* Card to control */ int gpu_num = -1; /* Card to control */
int i2c_bus = -1; int i2c_bus = -1;
int overwrite = 0; int overwrite = 0;
int no_reasons = 0;
unsigned int watch = 0; unsigned int watch = 0;
char *fan_speed[ICX3_MAX_FANS] = {NULL}; char *fan_speed[ICX3_MAX_FANS] = {NULL};
@ -112,8 +110,6 @@ int main (int argc, char **argv)
} else if (strcmp(argv[i], "--color") == 0) { } else if (strcmp(argv[i], "--color") == 0) {
header_start = HEADER_COLOR_START; header_start = HEADER_COLOR_START;
header_end = HEADER_COLOR_END; header_end = HEADER_COLOR_END;
} else if (strcmp(argv[i], "--no-reasons") == 0) {
no_reasons = 1;
} else { } else {
printf(helpstring); printf(helpstring);
return 0; return 0;
@ -188,10 +184,10 @@ int main (int argc, char **argv)
for (int i = 0; i < gpu_count; i++){ for (int i = 0; i < gpu_count; i++){
if (i > 0) if (i > 0)
printf("\n"); printf("\n");
print_gpu_info(i, &gpus[i], compact, no_reasons); print_gpu_info(i, &gpus[i], compact);
} }
} else if (gpu_num <= gpu_count - 1) { } else if (gpu_num <= gpu_count - 1) {
print_gpu_info(gpu_num, &gpus[gpu_num], compact, no_reasons); print_gpu_info(gpu_num, &gpus[gpu_num], compact);
} }
if (!overwrite) if (!overwrite)
@ -213,7 +209,7 @@ int main (int argc, char **argv)
#endif #endif
} }
void print_gpu_info(int gpu_num, struct card_info *gpu, int compact, int no_reasons) { void print_gpu_info(int gpu_num, struct card_info *gpu, int compact) {
if (compact) { if (compact) {
/* One line per GPU */ /* One line per GPU */
printf("%s#%d FAN%s", header_start, gpu_num, header_end); printf("%s#%d FAN%s", header_start, gpu_num, header_end);
@ -245,10 +241,8 @@ void print_gpu_info(int gpu_num, struct card_info *gpu, int compact, int no_reas
#ifdef USE_NVML #ifdef USE_NVML
printf("%s MEM %s", header_start, header_end); printf("%s MEM %s", header_start, header_end);
printf("%3d%%", get_nvml_mem_util(gpu)); printf("%3d%%", get_nvml_mem_util(gpu));
if (!no_reasons) { printf("%s CLK %s", header_start, header_end);
printf("%s CLK %s", header_start, header_end); print_nvml_clock_reason(1, gpu);
print_nvml_clock_reason(1, gpu);
}
#endif #endif
@ -278,10 +272,8 @@ void print_gpu_info(int gpu_num, struct card_info *gpu, int compact, int no_reas
#ifdef USE_NVML #ifdef USE_NVML
printf("Mem util: %d%%\n", get_nvml_mem_util(gpu)); printf("Mem util: %d%%\n", get_nvml_mem_util(gpu));
if (!no_reasons) { printf("Clock reasons: ");
printf("Clock reasons: "); print_nvml_clock_reason(0, gpu);
print_nvml_clock_reason(0, gpu);
}
printf("\n"); printf("\n");
#endif #endif
} }