1#!/bin/bash
2# Copyright (c) 2023 Huawei Device Co., Ltd.
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15set -e
16
17cd $(dirname $0)/../
18benchmark_dir=$(pwd)
19mkdir -p output
20
21cd ..
22rm -rf build/
23mkdir build && cd build
24
25export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.
26
27cmake .. \
28    -DCMAKE_BUILD_TYPE=Release \
29    -DFFRT_BENCHMARKS=ON \
30    -DBENCHMARKS_SPEEDUP=ON \
31
32make -j ffrt
33make -j speedup_test
34FFRT_LOG_LEVEL=0 ./benchmarks/speedup/speedup_test |tee speedup_test.log
35
36rm -f ${benchmark_dir}/output/speedup_test.csv
37echo duration speedup>> ${benchmark_dir}/output/speedup_test.csv
38# use spaces and ':' to split log lines
39awk -F '[ :]' '{print $2,$4}' speedup_test.log >>${benchmark_dir}/output/speedup_test.csv
40
41cd ${benchmark_dir}/output
42${benchmark_dir}/speedup/plot.py ${benchmark_dir}/output/speedup_test.csv ${benchmark_dir}/speedup/base.csv
43