diff --git a/src/common/ascii.h b/src/common/ascii.h index 2dd9fbc..3a0e32b 100644 --- a/src/common/ascii.h +++ b/src/common/ascii.h @@ -287,29 +287,6 @@ $C1 ################@@@@@@##@@@@@@################ \ $C1 ####################@@@@@@#################### \ $C1 ############################################## " -#define ASCII_SIFIVE_L \ -"$C1 ################################################### \ -$C1 ###########@@@@@@@@@@@@@@@@@@@@@@@@@@@@############ \ -$C1 ##########@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@########### \ -$C1 #########@@@@@#######################@@@@########## \ -$C1 ########@@@@@#########################@@@@######### \ -$C1 #######@@@@@###########################@@@@######## \ -$C1 ######@@@@@########@@@@@@@@@@@@@@@@@@@@@@@@@####### \ -$C1 #####@@@@@########@@@@@@@@@@@@@@@@@@@@@@@@@@@###### \ -$C1 ####@@@@@################################@@@@@##### \ -$C1 ###@@@@@##################################@@@@@#### \ -$C1 ##@@@@@####################################@@@@@### \ -$C1 ##@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#########@@@@### \ -$C1 ##@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@############@@@@### \ -$C1 ####@@@@@#############@@@@@@@############@@@@@##### \ -$C1 #######@@@@@@############@############@@@@@@####### \ -$C1 ##########@@@@@@###################@@@@@@########## \ -$C1 ##############@@@@@@###########@@@@@@############## \ -$C1 #################@@@@@@#####@@@@@@################# \ -$C1 ####################@@@@@@@@@@@#################### \ -$C1 ########################@@@######################## \ -$C1 ################################################### " - #define ASCII_STARFIVE \ "$C1 # \ $C1 ########## \ @@ -329,31 +306,6 @@ $C1 ######## ######## \ $C1 ######### \ $C1 # " -#define ASCII_STARFIVE_L \ -"$C1 ####### \ -$C1 ################. \ -$C1 ############ ########### \ -$C1 ############ ##########. \ -$C1 ############ # ###### \ -$C1 ########### ##### ## \ -$C1 #######. ########## \ -$C1 ###### ### *########### \ -$C1 ###### #######. ########## \ -$C1 ######### ############ ###### \ -$C1 ###########. ###########* # \ -$C1 ############ ############ \ -$C1 # ############. .########### \ -$C1 ###### ########### ######### \ -$C1 ########## .######, ##### \ -$C1 ############ ##. #####. \ -$C1 ######### ######## \ -$C1 ## ##### ##########. \ -$C1 ####### # ############ \ -$C1 ########### ###########. \ -$C1 ###########. ############ \ -$C1 ################ \ -$C1 ####### " - // --------------------- LONG LOGOS ------------------------- // #define ASCII_AMD_L \ "$C1 \ @@ -438,11 +390,59 @@ $C1 ############ ################## ######### #### ######### \ $C1 \ $C1 ############ ################ ######### ## ######### " +#define ASCII_SIFIVE_L \ +"$C1 ################################################### \ +$C1 ###########@@@@@@@@@@@@@@@@@@@@@@@@@@@@############ \ +$C1 ##########@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@########### \ +$C1 #########@@@@@#######################@@@@########## \ +$C1 ########@@@@@#########################@@@@######### \ +$C1 #######@@@@@###########################@@@@######## \ +$C1 ######@@@@@########@@@@@@@@@@@@@@@@@@@@@@@@@####### \ +$C1 #####@@@@@########@@@@@@@@@@@@@@@@@@@@@@@@@@@###### \ +$C1 ####@@@@@################################@@@@@##### \ +$C1 ###@@@@@##################################@@@@@#### \ +$C1 ##@@@@@####################################@@@@@### \ +$C1 ##@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#########@@@@### \ +$C1 ##@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@############@@@@### \ +$C1 ####@@@@@#############@@@@@@@############@@@@@##### \ +$C1 #######@@@@@@############@############@@@@@@####### \ +$C1 ##########@@@@@@###################@@@@@@########## \ +$C1 ##############@@@@@@###########@@@@@@############## \ +$C1 #################@@@@@@#####@@@@@@################# \ +$C1 ####################@@@@@@@@@@@#################### \ +$C1 ########################@@@######################## \ +$C1 ################################################### " + +#define ASCII_STARFIVE_L \ +"$C1 ####### \ +$C1 ################. \ +$C1 ############ ########### \ +$C1 ############ ##########. \ +$C1 ############ # ###### \ +$C1 ########### ##### ## \ +$C1 #######. ########## \ +$C1 ###### ### *########### \ +$C1 ###### #######. ########## \ +$C1 ######### ############ ###### \ +$C1 ###########. ###########* # \ +$C1 ############ ############ \ +$C1 # ############. .########### \ +$C1 ###### ########### ######### \ +$C1 ########## .######, ##### \ +$C1 ############ ##. #####. \ +$C1 ######### ######## \ +$C1 ## ##### ##########. \ +$C1 ####### # ############ \ +$C1 ########### ###########. \ +$C1 ###########. ############ \ +$C1 ################ \ +$C1 ####### " + typedef struct ascii_logo asciiL; -// ------------------------------------------------------------------------------------------------------+ +// +-----------------------------------------------------------------------------------------------------+ // | LOGO | W | H | REPLACE | COLORS LOGO (>0 && <10) | COLORS TEXT (=2) | -// ------------------------------------------------------------------------------------------------------+ +// +-----------------------------------------------------------------------------------------------------+ asciiL logo_amd = { ASCII_AMD, 39, 15, false, {C_FG_WHITE, C_FG_GREEN}, {C_FG_WHITE, C_FG_GREEN} }; asciiL logo_intel = { ASCII_INTEL, 48, 14, false, {C_FG_CYAN}, {C_FG_CYAN, C_FG_WHITE} }; asciiL logo_intel_new = { ASCII_INTEL_NEW, 51, 9, false, {C_FG_CYAN}, {C_FG_CYAN, C_FG_WHITE} }; @@ -466,8 +466,8 @@ asciiL logo_intel_l = { ASCII_INTEL_L, 62, 19, true, {C_BG_CYAN, C_BG_W asciiL logo_intel_l_new = { ASCII_INTEL_L_NEW, 57, 14, true, {C_BG_CYAN, C_BG_WHITE, C_BG_BLUE}, {C_FG_CYAN, C_FG_WHITE} }; asciiL logo_arm_l = { ASCII_ARM_L, 60, 8, true, {C_BG_CYAN}, {C_FG_WHITE, C_FG_CYAN} }; asciiL logo_ibm_l = { ASCII_IBM_L, 62, 13, true, {C_BG_CYAN, C_FG_WHITE}, {C_FG_CYAN, C_FG_WHITE} }; -asciiL logo_starfive_l = { ASCII_STARFIVE_L, 50, 22, false, {C_FG_WHITE}, {C_FG_WHITE, C_FG_BLUE} }; -asciiL logo_sifive_l = { ASCII_SIFIVE_L, 53, 21, true, {C_BG_WHITE, C_BG_BLACK}, {C_FG_WHITE, C_FG_CYAN} }; +asciiL logo_starfive_l = { ASCII_STARFIVE_L, 50, 22, false, {C_FG_WHITE}, {C_FG_WHITE, C_FG_BLUE} }; +asciiL logo_sifive_l = { ASCII_SIFIVE_L, 53, 21, true, {C_BG_WHITE, C_BG_BLACK}, {C_FG_WHITE, C_FG_CYAN} }; asciiL logo_unknown = { NULL, 0, 0, false, {COLOR_NONE}, {COLOR_NONE, COLOR_NONE} }; #endif diff --git a/src/common/main.c b/src/common/main.c index 6371e9b..e0141ec 100644 --- a/src/common/main.c +++ b/src/common/main.c @@ -40,11 +40,13 @@ void print_help(char *argv[]) { printf(" -%c, --%s %*s Print cpufetch version and exit\n", c[ARG_VERSION], t[ARG_VERSION], (int) (max_len-strlen(t[ARG_VERSION])), ""); printf("\nCOLORS: \n"); - printf(" * \"intel\": Use Intel default color scheme \n"); - printf(" * \"amd\": Use AMD default color scheme \n"); - printf(" * \"ibm\", Use IBM default color scheme \n"); - printf(" * \"arm\": Use ARM default color scheme \n"); - printf(" * \"sifive\": Use SiFive default color scheme \n"); + printf(" * \"intel\": Use Intel color scheme \n"); + printf(" * \"intel-new\": Use Intel (new logo) color scheme \n"); + printf(" * \"amd\": Use AMD color scheme \n"); + printf(" * \"ibm\", Use IBM color scheme \n"); + printf(" * \"arm\": Use ARM color scheme \n"); + printf(" * \"rockchip\": Use ARM color scheme \n"); + printf(" * \"sifive\": Use SiFive color scheme \n"); printf(" * custom: If the argument of --color does not match any of the previous strings, a custom scheme can be specified.\n"); printf(" 5 colors must be given in RGB with the format: R,G,B:R,G,B:...\n"); printf(" The first 3 colors are the CPU art color and the next 2 colors are the text colors\n"); @@ -74,8 +76,10 @@ void print_help(char *argv[]) { printf("\nNOTE: \n"); printf(" Peak performance information is NOT accurate. cpufetch computes peak performance using the max\n"); printf(" frequency of the CPU. However, to compute the peak performance, you need to know the frequency of the\n"); - printf(" CPU running AVX code. This value is not be fetched by cpufetch since it depends on each specific CPU.\n"); - printf(" To correctly measure peak performance, see: https://github.com/Dr-Noob/peakperf\n"); + printf(" CPU running AVX code. By default, this value is not fetched by cpufetch, but you can use the\n"); + printf(" --accurate-pp option, which will measure the AVX frequency and show a more precise estimation\n"); + printf(" (this option is only available in x86 architectures).\n"); + printf(" To precisely measure peak performance, see: https://github.com/Dr-Noob/peakperf\n"); } int main(int argc, char* argv[]) { @@ -116,8 +120,10 @@ int main(int argc, char* argv[]) { #endif } - if(print_cpufetch(cpu, get_style(), get_colors(), show_full_cpu_name())) + if(print_cpufetch(cpu, get_style(), get_colors(), show_full_cpu_name())) { return EXIT_SUCCESS; - else + } + else { return EXIT_FAILURE; + } } diff --git a/src/common/printer.c b/src/common/printer.c index 9216fb7..998ccb4 100644 --- a/src/common/printer.c +++ b/src/common/printer.c @@ -677,11 +677,11 @@ bool print_cpufetch_ppc(struct cpuInfo* cpu, STYLE s, struct color** cs, struct // Step 2. Set attributes if(cpu_name != NULL) { - setAttribute(art,ATTRIBUTE_NAME,cpu_name); + setAttribute(art, ATTRIBUTE_NAME, cpu_name); } - setAttribute(art,ATTRIBUTE_UARCH,uarch); - setAttribute(art,ATTRIBUTE_TECHNOLOGY,manufacturing_process); - setAttribute(art,ATTRIBUTE_FREQUENCY,max_frequency); + setAttribute(art, ATTRIBUTE_UARCH, uarch); + setAttribute(art, ATTRIBUTE_TECHNOLOGY, manufacturing_process); + setAttribute(art, ATTRIBUTE_FREQUENCY, max_frequency); uint32_t socket_num = get_nsockets(cpu->topo); if (socket_num > 1) { setAttribute(art, ATTRIBUTE_SOCKETS, sockets); @@ -689,16 +689,16 @@ bool print_cpufetch_ppc(struct cpuInfo* cpu, STYLE s, struct color** cs, struct setAttribute(art, ATTRIBUTE_NCORES_DUAL, n_cores_dual); } else { - setAttribute(art,ATTRIBUTE_NCORES, n_cores); + setAttribute(art, ATTRIBUTE_NCORES, n_cores); } - setAttribute(art,ATTRIBUTE_ALTIVEC, altivec); - setAttribute(art,ATTRIBUTE_L1i,l1i); - setAttribute(art,ATTRIBUTE_L1d,l1d); - setAttribute(art,ATTRIBUTE_L2,l2); + setAttribute(art, ATTRIBUTE_ALTIVEC, altivec); + setAttribute(art, ATTRIBUTE_L1i, l1i); + setAttribute(art, ATTRIBUTE_L1d, l1d); + setAttribute(art, ATTRIBUTE_L2, l2); if(l3 != NULL) { - setAttribute(art,ATTRIBUTE_L3,l3); + setAttribute(art, ATTRIBUTE_L3, l3); } - setAttribute(art,ATTRIBUTE_PEAK,pp); + setAttribute(art, ATTRIBUTE_PEAK, pp); // Step 3. Print output const char** attribute_fields = ATTRIBUTE_FIELDS; @@ -839,26 +839,17 @@ bool print_cpufetch_arm(struct cpuInfo* cpu, STYLE s, struct color** cs, struct char* manufacturing_process = get_str_process(cpu->soc); char* soc_name = get_soc_name(cpu->soc); char* features = get_str_features(cpu); - setAttribute(art,ATTRIBUTE_SOC,soc_name); - setAttribute(art,ATTRIBUTE_TECHNOLOGY,manufacturing_process); + setAttribute(art, ATTRIBUTE_SOC, soc_name); + setAttribute(art, ATTRIBUTE_TECHNOLOGY, manufacturing_process); if(cpu->num_cpus == 1) { char* uarch = get_str_uarch(cpu); char* max_frequency = get_str_freq(cpu->freq); char* n_cores = get_str_topology(cpu, cpu->topo, false); - /* - * char* l1i = get_str_l1i(cpu->cach); - * char* l1d = get_str_l1d(cpu->cach); - * char* l2 = get_str_l2(cpu->cach); - * char* l3 = get_str_l3(cpu->cach); - * Do not setAttribute for caches. - * Cache functionality may be implemented - * in the future - */ - setAttribute(art,ATTRIBUTE_UARCH,uarch); - setAttribute(art,ATTRIBUTE_FREQUENCY,max_frequency); - setAttribute(art,ATTRIBUTE_NCORES,n_cores); + setAttribute(art, ATTRIBUTE_UARCH, uarch); + setAttribute(art, ATTRIBUTE_FREQUENCY, max_frequency); + setAttribute(art, ATTRIBUTE_NCORES, n_cores); if(features != NULL) { setAttribute(art, ATTRIBUTE_FEATURES, features); } @@ -869,17 +860,8 @@ bool print_cpufetch_arm(struct cpuInfo* cpu, STYLE s, struct color** cs, struct char* uarch = get_str_uarch(ptr); char* max_frequency = get_str_freq(ptr->freq); char* n_cores = get_str_topology(ptr, ptr->topo, false); - /* - * char* l1i = get_str_l1i(cpu->cach); - * char* l1d = get_str_l1d(cpu->cach); - * char* l2 = get_str_l2(cpu->cach); - * char* l3 = get_str_l3(cpu->cach); - * Do not setAttribute for caches. - * Cache functionality may be implemented - * in the future - */ - char* cpu_num = emalloc(sizeof(char) * 9); + sprintf(cpu_num, "CPU %d:", i+1); setAttribute(art, ATTRIBUTE_CPU_NUM, cpu_num); setAttribute(art, ATTRIBUTE_UARCH, uarch); @@ -891,7 +873,7 @@ bool print_cpufetch_arm(struct cpuInfo* cpu, STYLE s, struct color** cs, struct } } char* pp = get_str_peak_performance(cpu->peak_performance); - setAttribute(art,ATTRIBUTE_PEAK,pp); + setAttribute(art, ATTRIBUTE_PEAK, pp); if(cpu->hv->present) { setAttribute(art, ATTRIBUTE_HYPERVISOR, cpu->hv->hv_name); } @@ -1035,29 +1017,18 @@ bool print_cpufetch_riscv(struct cpuInfo* cpu, STYLE s, struct color** cs, struc char* extensions = get_str_extensions(cpu); char* max_frequency = get_str_freq(cpu->freq); char* n_cores = get_str_topology(cpu, cpu->topo); - - /*char* l1i = get_str_l1i(cpu->cach); - char* l1d = get_str_l1d(cpu->cach); - char* l2 = get_str_l2(cpu->cach); - char* l3 = get_str_l3(cpu->cach);*/ char* pp = get_str_peak_performance(cpu->peak_performance); // Step 2. Set attributes - setAttribute(art,ATTRIBUTE_SOC,soc_name); - setAttribute(art,ATTRIBUTE_TECHNOLOGY,manufacturing_process); - setAttribute(art,ATTRIBUTE_UARCH,uarch); - setAttribute(art,ATTRIBUTE_NCORES, n_cores); - setAttribute(art,ATTRIBUTE_FREQUENCY,max_frequency); + setAttribute(art, ATTRIBUTE_SOC, soc_name); + setAttribute(art, ATTRIBUTE_TECHNOLOGY, manufacturing_process); + setAttribute(art, ATTRIBUTE_UARCH, uarch); + setAttribute(art, ATTRIBUTE_NCORES, n_cores); + setAttribute(art, ATTRIBUTE_FREQUENCY, max_frequency); if(extensions != NULL) { - setAttribute(art,ATTRIBUTE_EXTENSIONS,extensions); + setAttribute(art, ATTRIBUTE_EXTENSIONS, extensions); } - /*setAttribute(art,ATTRIBUTE_L1i,l1i); - setAttribute(art,ATTRIBUTE_L1d,l1d); - setAttribute(art,ATTRIBUTE_L2,l2); - if(l3 != NULL) { - setAttribute(art,ATTRIBUTE_L3,l3); - }*/ - setAttribute(art,ATTRIBUTE_PEAK,pp); + setAttribute(art, ATTRIBUTE_PEAK, pp); // Step 3. Print output const char** attribute_fields = ATTRIBUTE_FIELDS;