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 ] 62 include_dirs += [ 63 "${THIRD_PARTY}/googletest/googletest/include", 64 "${THIRD_PARTY}/perf_include/libbpf", 65 "${THIRD_PARTY}/perf_include/include", 66 "${THIRD_PARTY}/perf_include", 67 "${THIRD_PARTY}/perf_include/linux", 68 "../hiperf_parser", 69 "../hiperf_parser/include", 70 "${COMMON_LIBRARY}/base/include", 71 "${THIRD_PARTY}/sqlite", 72 ] 73 if (is_mingw || is_mac) { 74 include_dirs += [ "${THIRD_PARTY}/libbpf/include/uapi" ] 75 } 76} 77 78ohos_static_library("hiperf_parser") { 79 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 80 part_name = "${OHOS_PROFILER_PART_NAME}" 81 sources = [ "perf_data_parser.cpp" ] 82 public_configs = [ 83 ":hiperf_parser_cfg", 84 "../../filter/perf_filter:hiperf_filter_cfg", 85 ] 86 public_deps = [ 87 "${PERF_DIR}/hiperf:hiperf_src", 88 "${THIRD_PARTY}/protobuf:protobuf_lite_static", 89 "${THIRD_PARTY}/protobuf:protobuf_static", 90 "//third_party/perf_include/hiviewdfx:libfaultloggerd", 91 ] 92} 93