From a8e987f4790fbd32005e97ac8b5f085bcb953843 Mon Sep 17 00:00:00 2001 From: netbenixcn Date: Wed, 3 Jun 2020 09:21:46 +0200 Subject: [PATCH] Added some things that should be logged --- commands/sql_test.c | 1 + main.c | 9 +++++---- utils/sys_info.c | 18 ++---------------- utils/sys_info.h | 1 - 4 files changed, 8 insertions(+), 21 deletions(-) diff --git a/commands/sql_test.c b/commands/sql_test.c index 015d525..a71728f 100644 --- a/commands/sql_test.c +++ b/commands/sql_test.c @@ -37,6 +37,7 @@ void testSQLConnection(){ mysql_close(sql); } else { printf("Successfully connected to: %s", hostname); + logger("SQL Test Successful."); } mysql_close(sql); diff --git a/main.c b/main.c index d847629..07826c9 100644 --- a/main.c +++ b/main.c @@ -40,20 +40,21 @@ int main(int argc, char *argv[]){ logger("Logo Displayed."); if(!strcmp(argv[1], "--help")){ - logger("Showing Help"); + logger("Showing Help."); outputHelp(); } else if (!strcmp(argv[1], "--gtk-test")){ - logger("Stating GTK Test"); + logger("Stating GTK Test."); createGTKTestWindow(); } else if (!strcmp(argv[1], "--sys-info")){ - logger("Showing System Information"); + logger("Showing System Information."); print_Specs(); } else if (!strcmp(argv[1], "--sql-test")){ - logger("Starting SQL Test"); + logger("Starting SQL Test."); testSQLConnection(); } else { printf("Argument unknown. Please use --help for more information.\n"); snprintf(buffer, sizeof(buffer), "[ERROR] Argument unknown. Given argument: %s", argv[1]); + logger(buffer); } printf("\n"); diff --git a/utils/sys_info.c b/utils/sys_info.c index 2b0d5fa..27e2ca2 100644 --- a/utils/sys_info.c +++ b/utils/sys_info.c @@ -11,10 +11,8 @@ static inline void native_cpuid(unsigned int *eax, unsigned int *ebx, - unsigned int *ecx, unsigned int *edx){ - #ifndef __GNUC__ - #define __asm__ asm - #endif + unsigned int *ecx, unsigned int *edx){ + asm volatile ("cpuid" : "=a" (*eax), "=b" (*ebx), @@ -67,17 +65,6 @@ char* getCPUType(){ return type; } -double getCPUClockSpeed(){ - clock_t start, end; - double tmp; - start = clock(); - for(int i = 0; i < 10000; i++){ - tmp = i * i /2; - } - end = clock(); - return ((double) (end-start)) / CLOCKS_PER_SEC; -} - char* getOS(){ char *os; os = malloc(sizeof (char) * 20); @@ -107,7 +94,6 @@ void print_Specs(){ printf("CPU Stepping: %u\n", getCPUStepping()); printf("CPU Family: %u\n", getCPUFamily()); printf("CPU Type: %s\n", getCPUType()); - printf("CPU Clock: %d\n", getCPUClockSpeed()); free(NULL); } diff --git a/utils/sys_info.h b/utils/sys_info.h index f289b6f..ff13def 100644 --- a/utils/sys_info.h +++ b/utils/sys_info.h @@ -4,7 +4,6 @@ static inline void native_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx); unsigned int getCPUStepping(); unsigned int getCPUFamily(); -double getCPUClockSpeed(); char* getCPUType(); char* getOS(); char* getArch();