deinit obj in benchmark

This commit is contained in:
lyon 2022-01-25 09:15:14 +08:00
parent 962086ddbd
commit 047c62ecf2
3 changed files with 8 additions and 3 deletions

View File

@ -18,6 +18,7 @@ static void for_loop_10000(benchmark::State& state) {
"for i in range(0, 10000):\n" "for i in range(0, 10000):\n"
" a = a + 1\n" " a = a + 1\n"
"\n"); "\n");
obj_deinit(pikaMain);
} }
} }
BENCHMARK(for_loop_10000)->Unit(benchmark::kMillisecond); BENCHMARK(for_loop_10000)->Unit(benchmark::kMillisecond);
@ -31,6 +32,7 @@ static void while_loop_10000(benchmark::State& state) {
"while i < 10000:\n" "while i < 10000:\n"
" i = i + 1\n" " i = i + 1\n"
"\n"); "\n");
obj_deinit(pikaMain);
} }
} }
BENCHMARK(while_loop_10000)->Unit(benchmark::kMillisecond); BENCHMARK(while_loop_10000)->Unit(benchmark::kMillisecond);
@ -57,11 +59,11 @@ static void prime_number_100(benchmark::State& state) {
if (1060 != num) { if (1060 != num) {
printf("[error]: prime_number_100\r\n"); printf("[error]: prime_number_100\r\n");
} }
obj_deinit(pikaMain);
} }
} }
BENCHMARK(prime_number_100)->Unit(benchmark::kMillisecond); BENCHMARK(prime_number_100)->Unit(benchmark::kMillisecond);
BENCHMARK_MAIN();
static void prime_number_100_c(benchmark::State& state) { static void prime_number_100_c(benchmark::State& state) {
int num = 0; int num = 0;
@ -86,3 +88,5 @@ static void prime_number_100_c(benchmark::State& state) {
} }
} }
BENCHMARK(prime_number_100_c)->Unit(benchmark::kMillisecond); BENCHMARK(prime_number_100_c)->Unit(benchmark::kMillisecond);
BENCHMARK_MAIN();

View File

@ -1,4 +1,4 @@
cd Release && make -j cd Release && make -j
cd .. cd ..
Release/benchmark/pikascript_benchmark --benchmark_format=json | tee benchmark_result.json bash ci_benchmark_run.sh
python3 ci_benchmark_calibration.py python3 ci_benchmark_calibration.py

1
port/linux/ci_benchmark_run.sh Executable file
View File

@ -0,0 +1 @@
Release/benchmark/pikascript_benchmark --benchmark_format=json | tee benchmark_result.json