[v0.02] Add warning message. Hide the waiting message when CUDA initialization is done. Fix compiler warnings

This commit is contained in:
Dr-Noob
2021-08-15 21:56:51 +02:00
parent 2687fa5016
commit 8386052b10
4 changed files with 23 additions and 12 deletions

View File

@@ -33,11 +33,11 @@ int32_t get_value_as_smallest_unit(char ** str, uint64_t value) {
*str = (char *) emalloc(sizeof(char)* (max_len + 1));
if(value/1024 >= (1 << 20))
ret = snprintf(*str, max_len, "%.4g"STRING_GIGABYTES, (double)value/(1<<30));
ret = snprintf(*str, max_len, "%.4g" STRING_GIGABYTES, (double)value/(1<<30));
else if(value/1024 >= (1 << 10))
ret = snprintf(*str, max_len, "%.4g"STRING_MEGABYTES, (double)value/(1<<20));
ret = snprintf(*str, max_len, "%.4g" STRING_MEGABYTES, (double)value/(1<<20));
else
ret = snprintf(*str, max_len, "%.4g"STRING_KILOBYTES, (double)value/(1<<10));
ret = snprintf(*str, max_len, "%.4g" STRING_KILOBYTES, (double)value/(1<<10));
return ret;
}
@@ -55,9 +55,9 @@ char* get_str_freq(struct gpu_info* gpu) {
if(gpu->freq == UNKNOWN_FREQ || gpu->freq < 0)
snprintf(string,strlen(STRING_UNKNOWN)+1, STRING_UNKNOWN);
else if(gpu->freq >= 1000)
snprintf(string,size,"%.3f "STRING_GIGAHERZ, (float)(gpu->freq)/1000);
snprintf(string,size,"%.3f " STRING_GIGAHERZ, (float)(gpu->freq)/1000);
else
snprintf(string,size,"%.3f "STRING_MEGAHERZ, (float)gpu->freq);
snprintf(string,size,"%.3f " STRING_MEGAHERZ, (float)gpu->freq);
return string;
}
@@ -100,7 +100,7 @@ char* get_str_memory_clock(struct gpu_info* gpu) {
if(gpu->mem->freq == UNKNOWN_FREQ || gpu->mem->freq < 0)
snprintf(string,strlen(STRING_UNKNOWN)+1, STRING_UNKNOWN);
else
snprintf(string,size,"%d "STRING_MEGAHERZ, gpu->mem->freq);
snprintf(string,size,"%d " STRING_MEGAHERZ, gpu->mem->freq);
return string;
}

View File

@@ -49,6 +49,13 @@ int main(int argc, char* argv[]) {
return EXIT_SUCCESS;
}
set_log_level(true);
printWarn("gpufetch is in beta. The provided information may be incomplete or wrong.\n\
If you want to help to improve gpufetch, please compare the output of the program\n\
with a reliable source which you know is right (e.g, techpowerup.com) and report\n\
any inconsistencies to https://github.com/Dr-Noob/gpufetch/issues");
struct gpu_info* gpu = get_gpu_info();
if(gpu == NULL)
return EXIT_FAILURE;