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. 13 14import("//build/ohos.gni") 15import("../../src/ts.gni") 16OHOS_PROFILER_3RDPARTY_PROTOBUF_DIR = "//third_party/protobuf" 17proto_dir = "//third_party/protogen" 18services_dir = "$proto_dir/services" 19ftrace_data_dir = "$proto_dir/types/plugins/ftrace_data/${kernel_version}" 20memory_data_dir = "$proto_dir/types/plugins/memory_data" 21hilog_data_dir = "$proto_dir/types/plugins/hilog_data" 22native_hook_dir = "$proto_dir/types/plugins/native_hook" 23hidump_data_dir = "$proto_dir/types/plugins/hidump_data" 24network_data_dir = "$proto_dir/types/plugins/network_data" 25cpu_data_dir = "$proto_dir/types/plugins/cpu_data" 26diskio_data_dir = "$proto_dir/types/plugins/diskio_data" 27process_data_dir = "$proto_dir/types/plugins/process_data" 28hisysevent_data_dir = "$proto_dir/types/plugins/hisysevent_data" 29config("ts_proto_include_config") { 30 include_dirs = [ 31 "$ftrace_data_dir", 32 "$memory_data_dir", 33 "$hilog_data_dir", 34 "$native_hook_dir", 35 "$hidump_data_dir", 36 "$hisysevent_data_dir", 37 ] 38} 39source_set("ts_proto_data_cpp") { 40 public_deps = [ 41 "${OHOS_PROFILER_3RDPARTY_PROTOBUF_DIR}:protobuf", 42 "${OHOS_PROFILER_3RDPARTY_PROTOBUF_DIR}:protobuf_lite", 43 ] 44 cflags = [ 45 "-ftrapv", 46 "-D_FORTIFY_SOURCE=2 -O2", 47 "-Wno-zero-length-array", 48 "-std=c++17", 49 ] 50 51 if (!is_win) { 52 print("xxx") 53 cflags += [ 54 "-fPIE", 55 "-fPIC", 56 ] 57 } 58 if (!use_wasm) { 59 cflags += [ 60 "-fstack-protector-strong", # 61 "-fstack-protector-all", 62 ] 63 } 64 65 public_configs = [ ":ts_proto_include_config" ] 66 sources = [ 67 "$ftrace_data_dir/binder.pb.cc", 68 "$ftrace_data_dir/block.pb.cc", 69 "$ftrace_data_dir/cgroup.pb.cc", 70 "$ftrace_data_dir/clk.pb.cc", 71 "$ftrace_data_dir/compaction.pb.cc", 72 "$ftrace_data_dir/cpuhp.pb.cc", 73 "$ftrace_data_dir/dma_fence.pb.cc", 74 "$ftrace_data_dir/ext4.pb.cc", 75 "$ftrace_data_dir/filelock.pb.cc", 76 "$ftrace_data_dir/filemap.pb.cc", 77 "$ftrace_data_dir/ftrace.pb.cc", 78 "$ftrace_data_dir/ftrace_event.pb.cc", 79 "$ftrace_data_dir/gpio.pb.cc", 80 "$ftrace_data_dir/i2c.pb.cc", 81 "$ftrace_data_dir/ipi.pb.cc", 82 "$ftrace_data_dir/irq.pb.cc", 83 "$ftrace_data_dir/kmem.pb.cc", 84 "$ftrace_data_dir/net.pb.cc", 85 86 # "$ftrace_data_dir/mmc.pb.cc", 87 # "$ftrace_data_dir/f2fs.pb.cc", 88 # "$ftrace_data_dir/gpu_mem.pb.cc", 89 # "$ftrace_data_dir/regulator.pb.cc", 90 "$ftrace_data_dir/oom.pb.cc", 91 "$ftrace_data_dir/pagemap.pb.cc", 92 "$ftrace_data_dir/power.pb.cc", 93 "$ftrace_data_dir/printk.pb.cc", 94 "$ftrace_data_dir/raw_syscalls.pb.cc", 95 "$ftrace_data_dir/rcu.pb.cc", 96 "$ftrace_data_dir/sched.pb.cc", 97 "$ftrace_data_dir/signal.pb.cc", 98 "$ftrace_data_dir/sunrpc.pb.cc", 99 "$ftrace_data_dir/task.pb.cc", 100 "$ftrace_data_dir/timer.pb.cc", 101 "$ftrace_data_dir/trace_plugin_result.pb.cc", 102 "$ftrace_data_dir/v4l2.pb.cc", 103 "$ftrace_data_dir/vmscan.pb.cc", 104 "$ftrace_data_dir/workqueue.pb.cc", 105 "$ftrace_data_dir/writeback.pb.cc", 106 "$hidump_data_dir/hidump_plugin_result.pb.cc", 107 "$hilog_data_dir/hilog_plugin_result.pb.cc", 108 "$memory_data_dir/memory_plugin_common.pb.cc", 109 "$memory_data_dir/memory_plugin_config.pb.cc", 110 "$memory_data_dir/memory_plugin_result.pb.cc", 111 "$native_hook_dir/native_hook_config.pb.cc", 112 "$native_hook_dir/native_hook_result.pb.cc", 113 "${cpu_data_dir}/cpu_plugin_result.pb.cc", 114 "${diskio_data_dir}/diskio_plugin_result.pb.cc", 115 "${hisysevent_data_dir}/hisysevent_plugin_result.pb.cc", 116 "${network_data_dir}/network_plugin_result.pb.cc", 117 "${process_data_dir}/process_plugin_result.pb.cc", 118 "${services_dir}/common_types.pb.cc", 119 ] 120} 121