35 lines
674 B
C++
35 lines
674 B
C++
|
//
|
||
|
// Created by lydxh on 24-9-21.
|
||
|
//
|
||
|
|
||
|
#include <ctime>
|
||
|
#include <cstdio>
|
||
|
#include <syncstream>
|
||
|
#include "sim_test.h"
|
||
|
|
||
|
void Test_RunTime(char *name, void (*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);
|
||
|
}
|
||
|
|
||
|
void Test_Run(char *name, void (*pFunction)(void *)) {
|
||
|
|
||
|
|
||
|
printf("\n------< %s TEST >------\n", name);
|
||
|
_beginthread(pFunction, 0, NULL);
|
||
|
|
||
|
|
||
|
}
|