1484543d1Sopenharmony_ci#!/bin/bash
2484543d1Sopenharmony_ci# Copyright (c) 2023 Huawei Device Co., Ltd.
3484543d1Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
4484543d1Sopenharmony_ci# you may not use this file except in compliance with the License.
5484543d1Sopenharmony_ci# You may obtain a copy of the License at
6484543d1Sopenharmony_ci#
7484543d1Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
8484543d1Sopenharmony_ci#
9484543d1Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
10484543d1Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
11484543d1Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12484543d1Sopenharmony_ci# See the License for the specific language governing permissions and
13484543d1Sopenharmony_ci# limitations under the License.
14484543d1Sopenharmony_ci
15484543d1Sopenharmony_ciset -e
16484543d1Sopenharmony_ci
17484543d1Sopenharmony_cicd $(dirname $0)/../
18484543d1Sopenharmony_cibenchmark_dir=$(pwd)
19484543d1Sopenharmony_cimkdir -p output
20484543d1Sopenharmony_ci
21484543d1Sopenharmony_cicd ..
22484543d1Sopenharmony_cirm -rf build/
23484543d1Sopenharmony_cimkdir build && cd build
24484543d1Sopenharmony_ci
25484543d1Sopenharmony_ciexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.
26484543d1Sopenharmony_ci
27484543d1Sopenharmony_cicmake .. \
28484543d1Sopenharmony_ci    -DCMAKE_BUILD_TYPE=Release \
29484543d1Sopenharmony_ci    -DFFRT_BENCHMARKS=ON \
30484543d1Sopenharmony_ci    -DBENCHMARKS_SPEEDUP=ON \
31484543d1Sopenharmony_ci
32484543d1Sopenharmony_cimake -j ffrt
33484543d1Sopenharmony_cimake -j speedup_test
34484543d1Sopenharmony_ciFFRT_LOG_LEVEL=0 ./benchmarks/speedup/speedup_test |tee speedup_test.log
35484543d1Sopenharmony_ci
36484543d1Sopenharmony_cirm -f ${benchmark_dir}/output/speedup_test.csv
37484543d1Sopenharmony_ciecho duration speedup>> ${benchmark_dir}/output/speedup_test.csv
38484543d1Sopenharmony_ci# use spaces and ':' to split log lines
39484543d1Sopenharmony_ciawk -F '[ :]' '{print $2,$4}' speedup_test.log >>${benchmark_dir}/output/speedup_test.csv
40484543d1Sopenharmony_ci
41484543d1Sopenharmony_cicd ${benchmark_dir}/output
42484543d1Sopenharmony_ci${benchmark_dir}/speedup/plot.py ${benchmark_dir}/output/speedup_test.csv ${benchmark_dir}/speedup/base.csv
43