SDL2
This commit is contained in:
34
sim/Test/sim_test.cpp
Normal file
34
sim/Test/sim_test.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// 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);
|
||||
|
||||
|
||||
}
|
19
sim/Test/sim_test.h
Normal file
19
sim/Test/sim_test.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// Created by lydxh on 24-9-21.
|
||||
//
|
||||
|
||||
#ifndef HW_LIB_SIM_TEST_H
|
||||
#define HW_LIB_SIM_TEST_H
|
||||
|
||||
/**
|
||||
* @brief 测试函数执行时间
|
||||
* @param name: [输入] 测试名称
|
||||
* @param pFunction: [输入] 指向待测试函数的指针
|
||||
* @return void
|
||||
* @example Test("FunctionName", functionName);
|
||||
**/
|
||||
void Test_RunTime(char *name, void (*pFunction)(void *));
|
||||
|
||||
void Test_Run(char *name, void (*pFunction)(void *));
|
||||
|
||||
#endif //HW_LIB_SIM_TEST_H
|
Reference in New Issue
Block a user