HW_Lib/sim/Test/sim_test.cpp

35 lines
674 B
C++
Raw Normal View History

2024-09-21 08:07:31 +00:00
//
// 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);
}