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);
} else {
printf("Successfully connected to: %s", hostname);
logger("SQL Test Successful.");
}
mysql_close(sql);

9
main.c
View file

@ -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");

View file

@ -12,9 +12,7 @@
static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
unsigned int *ecx, unsigned int *edx){
#ifndef __GNUC__
#define __asm__ asm
#endif
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);
}

View file

@ -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();