[v0.04] Small fixes to presentation

This commit is contained in:
Dr-Noob
2021-08-16 12:27:23 +02:00
parent 9a5bc9f3ed
commit eecc040e98
3 changed files with 8 additions and 7 deletions

View File

@@ -3,6 +3,7 @@
#include <cstdio> #include <cstdio>
#include <cassert> #include <cassert>
#include <cerrno> #include <cerrno>
#include <cmath>
#include "../common/global.hpp" #include "../common/global.hpp"
#include "gpu.hpp" #include "gpu.hpp"
@@ -37,11 +38,11 @@ int32_t get_value_as_smallest_unit(char ** str, uint64_t value) {
*str = (char *) emalloc(sizeof(char)* (max_len + 1)); *str = (char *) emalloc(sizeof(char)* (max_len + 1));
if(value/1024 >= (1 << 20)) if(value/1024 >= (1 << 20))
ret = snprintf(*str, max_len, "%.4g" STRING_GIGABYTES, (double)value/(1<<30)); ret = snprintf(*str, max_len, "%.2f " STRING_GIGABYTES, (double)value/(1<<30) - 0.005);
else if(value/1024 >= (1 << 10)) else if(value/1024 >= (1 << 10))
ret = snprintf(*str, max_len, "%.4g" STRING_MEGABYTES, (double)value/(1<<20)); ret = snprintf(*str, max_len, "%.2f " STRING_MEGABYTES, (double)value/(1<<20) - 0.005);
else else
ret = snprintf(*str, max_len, "%.4g" STRING_KILOBYTES, (double)value/(1<<10)); ret = snprintf(*str, max_len, "%.2f " STRING_KILOBYTES, (double)value/(1<<10) - 0.005);
return ret; return ret;
} }

View File

@@ -52,9 +52,9 @@ int main(int argc, char* argv[]) {
set_log_level(true); set_log_level(true);
printWarn("gpufetch is in beta. The provided information may be incomplete or wrong.\n\ 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\ 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\ 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"); any inconsistencies to https://github.com/Dr-Noob/gpufetch/issues");
struct gpu_info* gpu = get_gpu_info(); struct gpu_info* gpu = get_gpu_info();
if(gpu == NULL) if(gpu == NULL)

View File

@@ -74,7 +74,7 @@ struct gpu_info* get_gpu_info() {
cudaSetDevice(dev); cudaSetDevice(dev);
cudaDeviceProp deviceProp; cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, dev); cudaGetDeviceProperties(&deviceProp, dev);
printf("\r"); printf("\r ");
gpu->freq = deviceProp.clockRate * 1e-3f; gpu->freq = deviceProp.clockRate * 1e-3f;
gpu->vendor = GPU_VENDOR_NVIDIA; gpu->vendor = GPU_VENDOR_NVIDIA;