1# Copyright (C) 2021 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. 13import("//build/ohos.gni") 14import("../../../build/ts.gni") 15ohos_source_set("htrace_pbreader_parser_src") { 16 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 17 part_name = "${OHOS_PROFILER_PART_NAME}" 18 sources = [ 19 "../parser_base.cpp", 20 "htrace_clock_detail_parser.cpp", 21 "htrace_cpu_data_parser.cpp", 22 "htrace_cpu_parser/htrace_cpu_detail_parser.cpp", 23 "htrace_disk_io_parser.cpp", 24 "htrace_event_parser/htrace_event_parser.cpp", 25 "htrace_hidump_parser.cpp", 26 "htrace_hilog_parser.cpp", 27 "htrace_hisysevent_parser.cpp", 28 "htrace_js_cpu_profiler_parser.cpp", 29 "htrace_js_memory_parser.cpp", 30 "htrace_mem_parser.cpp", 31 "htrace_native_hook_parser.cpp", 32 "htrace_network_parser.cpp", 33 "htrace_parser.cpp", 34 "htrace_process_parser.cpp", 35 "htrace_symbols_detail_parser.cpp", 36 ] 37 include_dirs = [ 38 "../../proto_reader/include", 39 ".", 40 "htrace_event_parser", 41 "htrace_cpu_parser", 42 "../../include", 43 "../../", 44 "../", 45 "../../trace_data", 46 "../../cfg", 47 "../../trace_streamer", 48 "../../metrics", 49 "${THIRD_PARTY}/bounds_checking_function/include", 50 "${THIRD_PARTY}/protobuf/src", 51 "${THIRD_PARTY}/sqlite/include", 52 "${THIRD_PARTY}/json/single_include/nlohmann", 53 "../../filter", 54 "../../base", 55 "../ebpf_parser", 56 ] 57 include_dirs += [ 58 "${THIRD_PARTY}/libunwind/include", 59 "${THIRD_PARTY}/libunwind/src", 60 "${PERF_DIR}/hiperf/include", 61 "${PERF_DIR}/hiperf/include/nonlinux/linux", 62 "${PERF_DIR}/hiperf/include/nonlinux", 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}/c_utils/base/include", 71 "${THIRD_PARTY}/sqlite", 72 ] 73 include_dirs += [ 74 "${THIRD_PARTY}/perf_include/hiviewdfx/hilog/include", 75 "${THIRD_PARTY}/perf_include/hiviewdfx/faultloggerd/common/cutil", 76 "${THIRD_PARTY}/perf_include/hiviewdfx/faultloggerd/common/dfxlog", 77 "${THIRD_PARTY}/perf_include/hiviewdfx/faultloggerd/common/dfxutil", 78 "${THIRD_PARTY}/perf_include/hiviewdfx/faultloggerd/interfaces/common", 79 "${THIRD_PARTY}/perf_include/hiviewdfx/faultloggerd/interfaces/nonlinux", 80 "${THIRD_PARTY}/perf_include/hiviewdfx/faultloggerd/interfaces/innerkits/unwinder/include", 81 ] 82 include_dirs += [ 83 "${SRC}/trace_data/trace_stdtype", 84 "${SRC}/trace_data/trace_stdtype/ftrace", 85 "${SRC}/trace_data/trace_stdtype/ftrace/template", 86 "${SRC}/trace_data/trace_stdtype/hilog", 87 "${SRC}/trace_data/trace_stdtype/hiperf", 88 "${SRC}/trace_data/trace_stdtype/hisysevent", 89 "${SRC}/trace_data/trace_stdtype/htrace", 90 "${SRC}/trace_data/trace_stdtype/measure", 91 ] 92 if (is_mingw || is_mac) { 93 include_dirs += [ 94 "${THIRD_PARTY}/elfutils/libelf", 95 "${THIRD_PARTY}/libbpf/include/uapi", 96 ] 97 } 98 99 if (!is_independent_compile) { 100 configs = [ "${TS_DIR}/gn:ts_config" ] 101 } 102 if (enable_ts_utest && !use_wasm) { 103 cflags = [ 104 "-fprofile-arcs", 105 "-ftest-coverage", 106 ] 107 ldflags = [ 108 "-fprofile-arcs", 109 "-ftest-coverage", 110 "--coverage", 111 ] 112 if (is_test) { 113 cflags += [ "-D IS_UT" ] 114 } 115 } 116 if (is_mingw) { 117 cflags = [ "-includeMingW64Fix.h" ] 118 } 119 120 public_deps = [] 121 deps = [ 122 "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/services:ts_all_type_cpp_standard", 123 "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/cpu_data:cpu_data_reader", 124 "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/diskio_data:diskio_data_reader", 125 "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/ftrace_data/${device_kernel_version}:ftrace_data_reader", 126 "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/hidump_data:hidump_data_reader", 127 "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/hilog_data:hilog_data_reader", 128 "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/hisysevent_data:hisysevent_data_reader", 129 "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/js_memory:js_memory_data_reader", 130 "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/memory_data:memory_data_reader", 131 "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/native_hook:native_hook_data_reader", 132 "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/network_data:network_data_reader", 133 "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/process_data:process_data_reader", 134 ] 135} 136group("htrace_pbreader_parser") { 137 deps = [ 138 ":htrace_pbreader_parser_src", 139 "${THIRD_PARTY}/protobuf:protobuf_lite_static", 140 "${THIRD_PARTY}/protobuf:protobuf_static", 141 "//third_party/perf_include/hiviewdfx:hiviewdfx", 142 ] 143 144 if (!use_wasm && !is_win && !is_mingw && !is_mac && !is_test) { 145 if (!is_independent_compile) { 146 if (target_cpu == "arm64") { 147 deps += [ "//third_party/libunwind:unwind_source_arm64_opt" ] 148 } else { 149 deps += [ "//third_party/libunwind:unwind_source_${target_cpu}" ] 150 } 151 } else { 152 deps += [ "${THIRD_PARTY}/libunwind:libunwind" ] 153 } 154 } 155} 156