Added some things that should be logged

This commit is contained in:
netbenixcn 2020-06-03 09:21:46 +02:00
parent b6dfb7c3c3
commit a8e987f479
4 changed files with 8 additions and 21 deletions

View file

@ -37,6 +37,7 @@ void testSQLConnection(){
mysql_close(sql); mysql_close(sql);
} else { } else {
printf("Successfully connected to: %s", hostname); printf("Successfully connected to: %s", hostname);
logger("SQL Test Successful.");
} }
mysql_close(sql); mysql_close(sql);

9
main.c
View file

@ -40,20 +40,21 @@ int main(int argc, char *argv[]){
logger("Logo Displayed."); logger("Logo Displayed.");
if(!strcmp(argv[1], "--help")){ if(!strcmp(argv[1], "--help")){
logger("Showing Help"); logger("Showing Help.");
outputHelp(); outputHelp();
} else if (!strcmp(argv[1], "--gtk-test")){ } else if (!strcmp(argv[1], "--gtk-test")){
logger("Stating GTK Test"); logger("Stating GTK Test.");
createGTKTestWindow(); createGTKTestWindow();
} else if (!strcmp(argv[1], "--sys-info")){ } else if (!strcmp(argv[1], "--sys-info")){
logger("Showing System Information"); logger("Showing System Information.");
print_Specs(); print_Specs();
} else if (!strcmp(argv[1], "--sql-test")){ } else if (!strcmp(argv[1], "--sql-test")){
logger("Starting SQL Test"); logger("Starting SQL Test.");
testSQLConnection(); testSQLConnection();
} else { } else {
printf("Argument unknown. Please use --help for more information.\n"); printf("Argument unknown. Please use --help for more information.\n");
snprintf(buffer, sizeof(buffer), "[ERROR] Argument unknown. Given argument: %s", argv[1]); snprintf(buffer, sizeof(buffer), "[ERROR] Argument unknown. Given argument: %s", argv[1]);
logger(buffer);
} }
printf("\n"); printf("\n");

View file

@ -12,9 +12,7 @@
static inline void native_cpuid(unsigned int *eax, unsigned int *ebx, static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
unsigned int *ecx, unsigned int *edx){ unsigned int *ecx, unsigned int *edx){
#ifndef __GNUC__
#define __asm__ asm
#endif
asm volatile ("cpuid" asm volatile ("cpuid"
: "=a" (*eax), : "=a" (*eax),
"=b" (*ebx), "=b" (*ebx),
@ -67,17 +65,6 @@ char* getCPUType(){
return type; 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* getOS(){
char *os; char *os;
os = malloc(sizeof (char) * 20); os = malloc(sizeof (char) * 20);
@ -107,7 +94,6 @@ void print_Specs(){
printf("CPU Stepping: %u\n", getCPUStepping()); printf("CPU Stepping: %u\n", getCPUStepping());
printf("CPU Family: %u\n", getCPUFamily()); printf("CPU Family: %u\n", getCPUFamily());
printf("CPU Type: %s\n", getCPUType()); printf("CPU Type: %s\n", getCPUType());
printf("CPU Clock: %d\n", getCPUClockSpeed());
free(NULL); free(NULL);
} }

View file

@ -4,7 +4,6 @@
static inline void native_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx); static inline void native_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx);
unsigned int getCPUStepping(); unsigned int getCPUStepping();
unsigned int getCPUFamily(); unsigned int getCPUFamily();
double getCPUClockSpeed();
char* getCPUType(); char* getCPUType();
char* getOS(); char* getOS();
char* getArch(); char* getArch();