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/protozero", 43 "../../include/perfetto/trace_processor", 44 "../../protos/perfetto/trace:zero", 45 "../../protos/perfetto/trace/interned_data:zero", 46 "../../protos/perfetto/trace/profiling:zero", 47 "../../src/profiling:deobfuscator", 48 "../../src/profiling/symbolizer", 49 "../../src/profiling/symbolizer:symbolize_database", 50 ] 51 public_deps = [ "../../include/perfetto/ext/base" ] 52 if (enable_perfetto_zlib) { 53 public_deps += [ "../../gn:zlib" ] 54 } 55 sources = [ 56 "utils.cc", 57 "utils.h", 58 ] 59} 60 61source_set("pprofbuilder") { 62 public_deps = [ "../../include/perfetto/profiling:pprof_builder" ] 63 deps = [ 64 ":utils", 65 "../../gn:default_deps", 66 "../../include/perfetto/base", 67 "../../include/perfetto/protozero", 68 "../../include/perfetto/trace_processor", 69 "../../protos/perfetto/trace:zero", 70 "../../protos/perfetto/trace/profiling:zero", 71 "../../protos/third_party/pprof:zero", 72 "../../src/profiling/symbolizer", 73 "../../src/profiling/symbolizer:symbolize_database", 74 "../../src/trace_processor/containers:containers", 75 ] 76 sources = [ "pprof_builder.cc" ] 77} 78 79# Exposed in bazel builds. 80static_library("libpprofbuilder") { 81 complete_static_lib = true 82 public_deps = [ ":pprofbuilder" ] 83} 84 85# The core source files that are used both by the "full" version (the host 86# executable) and by the "lite" version (the WASM module for the UI). 87source_set("common") { 88 deps = [ 89 ":pprofbuilder", 90 ":utils", 91 "../../gn:default_deps", 92 "../../include/perfetto/base", 93 "../../include/perfetto/ext/traced:sys_stats_counters", 94 "../../include/perfetto/protozero", 95 "../../protos/perfetto/trace:zero", 96 "../../src/profiling:deobfuscator", 97 "../../src/profiling/symbolizer", 98 "../../src/profiling/symbolizer:symbolize_database", 99 "../../src/trace_processor:lib", 100 ] 101 sources = [ 102 "deobfuscate_profile.cc", 103 "deobfuscate_profile.h", 104 "main.cc", 105 "symbolize_profile.cc", 106 "symbolize_profile.h", 107 "trace_to_hprof.cc", 108 "trace_to_hprof.h", 109 "trace_to_json.cc", 110 "trace_to_json.h", 111 "trace_to_profile.cc", 112 "trace_to_profile.h", 113 "trace_to_systrace.cc", 114 "trace_to_systrace.h", 115 "trace_to_text.h", 116 ] 117} 118 119# Lite target for the WASM UI. Doesn't have any dependency on libprotobuf-full. 120source_set("lite") { 121 deps = [ 122 ":common", 123 "../../gn:default_deps", 124 "../../include/perfetto/base", 125 ] 126 sources = [ "lite_fallbacks.cc" ] 127} 128 129# Full target for the host. Depends on libprotobuf-full. 130source_set("full") { 131 testonly = true 132 deps = [ 133 ":common", 134 ":utils", 135 "../../gn:default_deps", 136 "../../gn:protobuf_full", 137 "../../protos/perfetto/trace:zero", 138 ] 139 if (enable_perfetto_zlib) { 140 deps += [ "../../gn:zlib" ] 141 } 142 sources = [ 143 "proto_full_utils.cc", 144 "proto_full_utils.h", 145 "trace_to_text.cc", 146 ] 147} 148 149if (enable_perfetto_ui) { 150 wasm_lib("trace_to_text_wasm") { 151 name = "trace_to_text" 152 deps = [ 153 ":lite", 154 "../../gn:default_deps", 155 ] 156 } 157} 158