30 lines
672 B
C++
30 lines
672 B
C++
//
|
|
// Created by lydxh on 24-9-21.
|
|
//
|
|
|
|
#include <ctime>
|
|
#include <cstdio>
|
|
#include "sim_test.h"
|
|
|
|
void Test_RunTime(char *name, int (*pFunction)(void *)) {
|
|
clock_t start, end;
|
|
double cpu_time_used;
|
|
|
|
printf("\n------< %s TEST >------\n", name);
|
|
|
|
start = clock();
|
|
pFunction(NULL);
|
|
end = clock();
|
|
|
|
cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
|
|
|
|
printf("\n------< %s END >------\n", name);
|
|
|
|
printf("\nTime taken by %s: %f seconds\n", name, cpu_time_used);
|
|
}
|
|
|
|
SDL_Thread *Test_Run(char *name, int (*pFunction)(void *), void *arg) {
|
|
printf("\n------< %s TEST >------\n", name);
|
|
return ThreadCreat(pFunction, name, arg);
|
|
}
|