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("parser_base_cfg") { 18 include_dirs = [ 19 "${THIRD_PARTY}/protobuf/src", 20 "${THIRD_PARTY}/sqlite/include", 21 "${SRC}/base", 22 "${SRC}/cfg", 23 "${SRC}/trace_streamer", 24 "${SRC}/trace_data", 25 "${SRC}/include", 26 "${SRC}/filter", 27 "${SRC}/filter/hi_sysevent_filter", 28 "${SRC}/filter/hook_filter", 29 "${SRC}/filter/perf_filter", 30 "${SRC}", 31 ".", 32 "ptreader_parser", 33 "pbreader_parser", 34 "pbreader_parser/htrace_parser", 35 "rawtrace_parser", 36 "ebpf_parser", 37 "../proto_reader/include", 38 "${THIRD_PARTY}/bounds_checking_function/include", 39 "${THIRD_PARTY}/json/single_include/nlohmann", 40 "${THIRD_PARTY}/profiler/device/plugins/ftrace_plugin/include", 41 ] 42 include_dirs += [ 43 "${SRC}/trace_data/trace_stdtype", 44 "${SRC}/trace_data/trace_stdtype/ftrace", 45 "${SRC}/trace_data/trace_stdtype/ftrace/template", 46 "${SRC}/trace_data/trace_stdtype/hilog", 47 "${SRC}/trace_data/trace_stdtype/hiperf", 48 "${SRC}/trace_data/trace_stdtype/hisysevent", 49 "${SRC}/trace_data/trace_stdtype/htrace", 50 "${SRC}/trace_data/trace_stdtype/measure", 51 ] 52 if (!is_independent_compile) { 53 configs = [ "${TS_DIR}/gn:ts_config" ] 54 } 55 if (enable_ts_utest && !use_wasm) { 56 cflags = [ 57 "-fprofile-arcs", 58 "-ftest-coverage", 59 ] 60 ldflags = [ 61 "-fprofile-arcs", 62 "-ftest-coverage", 63 "--coverage", 64 ] 65 if (is_test) { 66 cflags += [ "-D IS_UT" ] 67 } 68 } 69} 70 71config("hilog_parser_cfg") { 72 include_dirs = [ 73 "pbreader_parser", 74 "pbreader_parser/hilog_parser", 75 "ptreader_parser/hilog_parser", 76 ] 77} 78 79config("hisysevent_parser_cfg") { 80 include_dirs = [ 81 "pbreader_parser", 82 "pbreader_parser/hisysevent_parser", 83 "ptreader_parser/hisysevent_parser", 84 "${SRC}/filter/hi_sysevent_filter", 85 ] 86} 87 88ohos_source_set("parser") { 89 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 90 part_name = "${OHOS_PROFILER_PART_NAME}" 91 sources = [ 92 "event_parser_base.cpp", 93 "print_event_parser.cpp", 94 "thread_state_flag.cpp", 95 ] 96 97 public_deps = [] 98 public_deps += [ "pbreader_parser:pbreader_parser_src" ] 99 public_deps += [ "ptreader_parser:ptreader_parser_src" ] 100 if (enable_rawtrace) { 101 public_deps += [ "rawtrace_parser:rawtrace_parser" ] 102 } 103 if (enable_ebpf) { 104 public_deps += [ "ebpf_parser:ebpf_parser" ] 105 } 106 public_configs = [ ":parser_base_cfg" ] 107} 108