UP
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// Created by lydxh on 2024/5/9.
|
||||
//
|
||||
#include <stdio.h>
|
||||
#include <ctime>
|
||||
#include "tool.h"
|
||||
|
||||
float Mapping(float val, float I_Min, float I_Max, float O_Min, float O_Max) {
|
||||
@@ -71,3 +72,20 @@ float Str2Float(char *str) {
|
||||
decimal /= decimalWeight;
|
||||
return float(sign * (integer + decimal));
|
||||
}
|
||||
|
||||
void Test_RunTime(char *name, void (*pFunction)()) {
|
||||
clock_t start, end;
|
||||
double cpu_time_used;
|
||||
|
||||
printf("\n------< %s TEST >------\n", name);
|
||||
|
||||
start = clock();
|
||||
pFunction();
|
||||
end = clock();
|
||||
|
||||
cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
|
||||
|
||||
printf("\nTime taken by %s: %f seconds\n", name, cpu_time_used);
|
||||
|
||||
printf("\n------< %s END >------\n", name);
|
||||
}
|
Reference in New Issue
Block a user