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
16if (!defined(ohos_lite)) {
17  import("//build/config/features.gni")
18  import("//build/test.gni")
19
20  module_output_path = "faultloggerd/benchmarktest"
21
22  ohos_benchmarktest("UnwinderBenchmarkTest") {
23    module_out_path = module_output_path
24    include_dirs = [
25      "./",
26      "$faultloggerd_interfaces_path/common",
27      "$faultloggerd_path/test/utils",
28    ]
29    cflags = [
30      "-O0",
31      "-Werror",
32      "-Wno-reorder-init-list",
33      "-Wno-header-hygiene",
34    ]
35    ldflags = [ "-rdynamic" ]
36    defines = [ "LOCK_TO_CPU" ]
37    if (libunwinder_debug) {
38      defines += [
39        "DFX_LOG_UNWIND",
40        "DFX_UNWIND_ERROR",
41      ]
42    }
43    sources = [
44      "$faultloggerd_test_path/benchmarktest/main/main_benchmark.cpp",
45      "elf_benchmark.cpp",
46      "maps_benchmark.cpp",
47      "unwind_local_benchmark.cpp",
48      "unwind_local_tid_benchmark.cpp",
49      "unwind_remote_benchmark.cpp",
50    ]
51    deps = [
52      "$faultloggerd_common_path/dfxlog:dfx_hilog",
53      "$faultloggerd_common_path/dfxutil:dfx_util",
54      "$faultloggerd_interfaces_path/innerkits/unwinder:libunwinder_static",
55      "$faultloggerd_path/test/utils:dfx_test_util",
56    ]
57
58    external_deps = [
59      "benchmark:benchmark",
60      "c_utils:utils",
61      "hilog:libhilog",
62    ]
63  }
64
65  group("benchmarktest") {
66    testonly = true
67    deps = [ ":UnwinderBenchmarkTest" ]
68  }
69}
70