1# Copyright (C) 2018 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") 16 17# Prevent that this file is accidentally included in embedder builds. 18assert(enable_perfetto_tools) 19 20# Lists all tools. The root "all" target depends on this. 21group("tools") { 22 testonly = true 23 deps = [ 24 ":copy_protoc", 25 ":idle_alloc", 26 "compact_reencode", 27 "ftrace_proto_gen", 28 "protoprofile", 29 ] 30 if (is_linux || is_android) { 31 deps += [ 32 "busy_threads", 33 "cpu_utilization", 34 "dump_ftrace_stats", 35 "skippy", 36 ] 37 } 38 if (enable_perfetto_tools_trace_to_text) { 39 deps += [ 40 "trace_to_text", 41 "trace_to_text:trace_to_text_lite", 42 ] 43 } 44} 45 46if (is_linux && enable_perfetto_heapprofd) { 47 executable("profiling_sample_distribution") { 48 sources = [ "profiling_sample_distribution.cc" ] 49 deps = [ 50 "../gn:default_deps", 51 "../src/base", 52 "../src/profiling/memory:client", 53 ] 54 } 55 56 executable("multithreaded_alloc") { 57 sources = [ "multithreaded_alloc.cc" ] 58 deps = [ 59 "../gn:default_deps", 60 "../src/base", 61 "../src/profiling/memory:client_api_standalone", 62 ] 63 } 64} 65 66executable("idle_alloc") { 67 deps = [ "../gn:default_deps" ] 68 sources = [ "idle_alloc.cc" ] 69} 70 71# The protoc binary can end up in out/protoc or out/gcc_like_host/protoc 72# depending on whether this is a pure-host build vs a host+target (i.e. android) 73# build. This rule ensures that in both cases we end up with a host binary in 74# out/protoc, so tools can consistently refer to that one location. 75protoc_target = "../gn:protoc($host_toolchain)" 76if (current_toolchain != host_toolchain) { 77 copy("copy_protoc") { 78 testonly = true 79 deps = [ protoc_target ] 80 host_out_dir = get_label_info(protoc_target, "root_out_dir") 81 sources = [ "$host_out_dir/protoc" ] 82 outputs = [ "$root_build_dir/protoc" ] 83 } 84} else { 85 # Nothing to do, in this case protoc is already built in the root out dir. 86 group("copy_protoc") { 87 public_deps = [ protoc_target ] 88 } 89} 90