1# Copyright (c) 2023 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//base/hiviewdfx/faultloggerd/faultloggerd.gni") 15 16libunwindstack_path = 17 "$faultloggerd_path/matrix-backtrace/src/main/cpp/external/libunwindstack" 18 19if (!defined(ohos_lite)) { 20 import("//build/config/features.gni") 21 import("//build/test.gni") 22 23 module_output_path = "faultloggerd/benchmarktest" 24 25 ohos_benchmarktest("UnwindStackBenchmarkTest") { 26 module_out_path = module_output_path 27 include_dirs = [ 28 "./", 29 "$faultloggerd_interfaces_path/innerkits/unwinder/include", 30 "$faultloggerd_path/test/utils", 31 "$libunwindstack_path/include", 32 ] 33 cflags = [ 34 "-O0", 35 "-Werror", 36 "-Wno-unused-variable", 37 "-Wno-reorder-init-list", 38 "-Wno-header-hygiene", 39 "-Wno-unused-function", 40 ] 41 42 cflags_cc = [ "-frtti" ] 43 defines = [ "LOCK_TO_CPU" ] 44 if (libunwinder_debug) { 45 defines += [ "DFX_LOG_UNWIND" ] 46 } 47 sources = [ 48 "$faultloggerd_test_path/benchmarktest/main/main_benchmark.cpp", 49 "pid_utils.cpp", 50 "unwind_local_benchmark.cpp", 51 "unwind_remote_benchmark.cpp", 52 ] 53 deps = [ 54 "$faultloggerd_common_path/dfxlog:dfx_hilog", 55 "$faultloggerd_common_path/dfxutil:dfx_util", 56 "$faultloggerd_path/libunwind-x/libbase:libabase", 57 "$faultloggerd_path/libunwind-x/libdemangle:libdemangle", 58 "$faultloggerd_path/libunwind-x/liblog:libalog", 59 "$faultloggerd_path/libunwind-x/liblzma/C:liblzma", 60 "$faultloggerd_path/libunwind-x/libprocinfo:libaprocinfo", 61 "$faultloggerd_path/test/utils:dfx_test_util", 62 "$libunwindstack_path:libwxunwindstack", 63 "$libunwindstack_path/deps/sys_compat:libwxcompat", 64 ] 65 66 external_deps = [ 67 "benchmark:benchmark", 68 "bounds_checking_function:libsec_shared", 69 "c_utils:utils", 70 "hilog:libhilog", 71 ] 72 } 73 74 group("benchmarktest") { 75 testonly = true 76 deps = [ ":UnwindStackBenchmarkTest" ] 77 } 78} 79