1# Copyright (C) 2017 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15import("../../gn/perfetto.gni") 16import("../../gn/perfetto_host_executable.gni") 17import("../../gn/wasm.gni") 18 19perfetto_host_executable("trace_to_text") { 20 testonly = true 21 deps = [ 22 ":full", 23 "../../gn:default_deps", 24 ] 25} 26 27# This is just to check that we can build a version of trace_to_text against 28# libprotobuf-lite. This configuration is only used by WASM. Unfortunately, 29# however, the WASM linker is very permissive and failures show up only when 30# loading the executable in the browser. 31perfetto_host_executable("trace_to_text_lite") { 32 testonly = true 33 deps = [ 34 ":lite", 35 "../../gn:default_deps", 36 ] 37} 38 39source_set("utils") { 40 deps = [ 41 "../../gn:default_deps", 42 "../../include/perfetto/profiling:deobfuscator", 43 "../../include/perfetto/protozero", 44 "../../include/perfetto/trace_processor", 45 "../../protos/perfetto/trace:zero", 46 "../../protos/perfetto/trace/interned_data:zero", 47 "../../protos/perfetto/trace/profiling:zero", 48 "../../src/profiling:deobfuscator", 49 "../../src/profiling/symbolizer", 50 "../../src/profiling/symbolizer:symbolize_database", 51 ] 52 public_deps = [ 53 "../../include/perfetto/ext/base", 54 "../../include/perfetto/profiling:deobfuscator", 55 ] 56 if (enable_perfetto_zlib) { 57 public_deps += [ "../../gn:zlib" ] 58 } 59 sources = [ 60 "utils.cc", 61 "utils.h", 62 ] 63} 64 65source_set("pprofbuilder") { 66 public_deps = [ "../../include/perfetto/profiling:pprof_builder" ] 67 deps = [ 68 ":utils", 69 "../../gn:default_deps", 70 "../../include/perfetto/base", 71 "../../include/perfetto/protozero", 72 "../../include/perfetto/trace_processor", 73 "../../protos/perfetto/trace:zero", 74 "../../protos/perfetto/trace/profiling:zero", 75 "../../protos/third_party/pprof:zero", 76 "../../src/profiling/symbolizer", 77 "../../src/profiling/symbolizer:symbolize_database", 78 ] 79 sources = [ "pprof_builder.cc" ] 80} 81 82# Exposed in bazel builds. 83static_library("libpprofbuilder") { 84 complete_static_lib = true 85 deps = [ ":pprofbuilder" ] 86} 87 88# The core source files that are used both by the "full" version (the host 89# executable) and by the "lite" version (the WASM module for the UI). 90source_set("common") { 91 deps = [ 92 ":pprofbuilder", 93 ":utils", 94 "../../gn:default_deps", 95 "../../include/perfetto/base", 96 "../../include/perfetto/ext/traced:sys_stats_counters", 97 "../../include/perfetto/profiling:deobfuscator", 98 "../../include/perfetto/protozero", 99 "../../protos/perfetto/trace:zero", 100 "../../src/profiling/symbolizer", 101 "../../src/profiling/symbolizer:symbolize_database", 102 "../../src/trace_processor:lib", 103 ] 104 sources = [ 105 "deobfuscate_profile.cc", 106 "deobfuscate_profile.h", 107 "main.cc", 108 "symbolize_profile.cc", 109 "symbolize_profile.h", 110 "trace_to_json.cc", 111 "trace_to_json.h", 112 "trace_to_profile.cc", 113 "trace_to_profile.h", 114 "trace_to_systrace.cc", 115 "trace_to_systrace.h", 116 "trace_to_text.h", 117 ] 118 if (enable_perfetto_version_gen) { 119 deps += [ "//gn/standalone:gen_git_revision" ] 120 } 121} 122 123# Lite target for the WASM UI. Doesn't have any dependency on libprotobuf-full. 124source_set("lite") { 125 deps = [ 126 ":common", 127 "../../gn:default_deps", 128 "../../include/perfetto/base", 129 ] 130 sources = [ "lite_fallbacks.cc" ] 131} 132 133# Full target for the host. Depends on libprotobuf-full. 134source_set("full") { 135 testonly = true 136 deps = [ 137 ":common", 138 ":utils", 139 "../../gn:default_deps", 140 "../../gn:protobuf_full", 141 "../../protos/perfetto/trace:zero", 142 ] 143 if (enable_perfetto_zlib) { 144 deps += [ "../../gn:zlib" ] 145 } 146 sources = [ 147 "proto_full_utils.cc", 148 "proto_full_utils.h", 149 "trace_to_text.cc", 150 ] 151} 152 153wasm_lib("trace_to_text_wasm") { 154 name = "trace_to_text" 155 deps = [ 156 ":lite", 157 "../../gn:default_deps", 158 ] 159} 160