This commit is contained in:
JiXieShi
2024-06-20 21:58:30 +08:00
parent 6ddfc4b320
commit 60e82d529a
4 changed files with 44 additions and 38 deletions

View File

@@ -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);
}