• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved.
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("//build/ohos.gni")
15import("../../../build/ts.gni")
16
17config("hiperf_parser_cfg") {
18  if (!is_independent_compile) {
19    configs = [ "${TS_DIR}/gn:ts_config" ]
20  }
21  if (enable_ts_utest && !use_wasm) {
22    cflags = [
23      "-fprofile-arcs",
24      "-ftest-coverage",
25    ]
26    ldflags = [
27      "-fprofile-arcs",
28      "-ftest-coverage",
29      "--coverage",
30    ]
31    if (is_test) {
32      cflags += [ "-D IS_UT" ]
33    }
34  }
35  include_dirs = [
36    ".",
37    "../../base",
38    "../../cfg",
39    "../../include",
40    "../../",
41    "../../filter",
42    "../../trace_data",
43    "..",
44    "../../trace_streamer",
45    "../../proto_reader/include",
46    "${THIRD_PARTY}/bounds_checking_function/include",
47    "${THIRD_PARTY}/sqlite/include",
48    "${THIRD_PARTY}/protobuf/src",
49    "${COMMON_LIBRARY}/base/include",
50    "${THIRD_PARTY}/googletest/googletest/include",
51  ]
52  include_dirs += [
53    "${SRC}/trace_data/trace_stdtype",
54    "${SRC}/trace_data/trace_stdtype/ftrace",
55    "${SRC}/trace_data/trace_stdtype/ftrace/template",
56    "${SRC}/trace_data/trace_stdtype/hilog",
57    "${SRC}/trace_data/trace_stdtype/hiperf",
58    "${SRC}/trace_data/trace_stdtype/hisysevent",
59    "${SRC}/trace_data/trace_stdtype/htrace",
60    "${SRC}/trace_data/trace_stdtype/measure",
61    "${SRC}/trace_data/trace_stdtype/xpower",
62  ]
63  include_dirs += [
64    "${THIRD_PARTY}/googletest/googletest/include",
65    "${THIRD_PARTY}/perf_include/libbpf",
66    "${THIRD_PARTY}/perf_include/include",
67    "${THIRD_PARTY}/perf_include",
68    "${THIRD_PARTY}/perf_include/linux",
69    "../hiperf_parser",
70    "../hiperf_parser/include",
71    "${COMMON_LIBRARY}/base/include",
72    "${THIRD_PARTY}/sqlite",
73  ]
74  if (enable_addr2line) {
75    include_dirs += [
76      "${LLVM_ROOT}/include",
77      "$root_gen_dir/llvm/include",
78    ]
79  }
80  if (is_mingw || is_mac) {
81    include_dirs += [ "${THIRD_PARTY}/libbpf/include/uapi" ]
82  }
83}
84
85ohos_static_library("hiperf_parser") {
86  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
87  part_name = "${OHOS_PROFILER_PART_NAME}"
88  sources = [ "perf_data_parser.cpp" ]
89  public_configs = [
90    ":hiperf_parser_cfg",
91    "../../filter/perf_filter:hiperf_filter_cfg",
92  ]
93  public_deps = [
94    "${PERF_DIR}/hiperf:hiperf_src",
95    "${THIRD_PARTY}/protobuf:protobuf_lite_static",
96    "${THIRD_PARTY}/protobuf:protobuf_static",
97    "//third_party/perf_include/hiviewdfx:libfaultloggerd",
98  ]
99  if (enable_addr2line) {
100    public_deps += [
101      "${LLVM_ROOT}/lib/DebugInfo/DWARF",
102      "${LLVM_ROOT}/lib/DebugInfo/PDB",
103      "${LLVM_ROOT}/lib/DebugInfo/Symbolize",
104      "${LLVM_ROOT}/lib/Demangle",
105      "${LLVM_ROOT}/lib/Object",
106      "${LLVM_ROOT}/lib/Support",
107    ]
108  }
109}
110