From 047c62ecf275e958bd4ca20e5a97d2270d9d0761 Mon Sep 17 00:00:00 2001 From: lyon Date: Tue, 25 Jan 2022 09:15:14 +0800 Subject: [PATCH] deinit obj in benchmark --- port/linux/benchmark/main.cpp | 8 ++++++-- port/linux/ci_benchmark.sh | 2 +- port/linux/ci_benchmark_run.sh | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100755 port/linux/ci_benchmark_run.sh diff --git a/port/linux/benchmark/main.cpp b/port/linux/benchmark/main.cpp index bc69867a3..7739092ef 100644 --- a/port/linux/benchmark/main.cpp +++ b/port/linux/benchmark/main.cpp @@ -18,6 +18,7 @@ static void for_loop_10000(benchmark::State& state) { "for i in range(0, 10000):\n" " a = a + 1\n" "\n"); + obj_deinit(pikaMain); } } BENCHMARK(for_loop_10000)->Unit(benchmark::kMillisecond); @@ -31,6 +32,7 @@ static void while_loop_10000(benchmark::State& state) { "while i < 10000:\n" " i = i + 1\n" "\n"); + obj_deinit(pikaMain); } } BENCHMARK(while_loop_10000)->Unit(benchmark::kMillisecond); @@ -57,11 +59,11 @@ static void prime_number_100(benchmark::State& state) { if (1060 != num) { printf("[error]: prime_number_100\r\n"); } + obj_deinit(pikaMain); } } BENCHMARK(prime_number_100)->Unit(benchmark::kMillisecond); -BENCHMARK_MAIN(); static void prime_number_100_c(benchmark::State& state) { int num = 0; @@ -85,4 +87,6 @@ static void prime_number_100_c(benchmark::State& state) { } } } -BENCHMARK(prime_number_100_c)->Unit(benchmark::kMillisecond); \ No newline at end of file +BENCHMARK(prime_number_100_c)->Unit(benchmark::kMillisecond); + +BENCHMARK_MAIN(); \ No newline at end of file diff --git a/port/linux/ci_benchmark.sh b/port/linux/ci_benchmark.sh index 100ec0605..74ef97b63 100755 --- a/port/linux/ci_benchmark.sh +++ b/port/linux/ci_benchmark.sh @@ -1,4 +1,4 @@ cd Release && make -j cd .. -Release/benchmark/pikascript_benchmark --benchmark_format=json | tee benchmark_result.json +bash ci_benchmark_run.sh python3 ci_benchmark_calibration.py diff --git a/port/linux/ci_benchmark_run.sh b/port/linux/ci_benchmark_run.sh new file mode 100755 index 000000000..df48e9b16 --- /dev/null +++ b/port/linux/ci_benchmark_run.sh @@ -0,0 +1 @@ +Release/benchmark/pikascript_benchmark --benchmark_format=json | tee benchmark_result.json