| # Copyright (C) 2022 The Android Open Source Project |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| import("../../gn/perfetto.gni") |
| |
| # Prevent that this file is accidentally included in embedder builds. |
| assert(enable_perfetto_tools) |
| |
| # Lists all tools. The root "all" target depends on this. |
| group("tools") { |
| testonly = true |
| deps = [ |
| ":copy_protoc", |
| "ftrace_proto_gen", |
| "proto_filter", |
| "proto_merger", |
| "protoprofile", |
| ] |
| if (is_linux || is_android) { |
| deps += [ |
| ":idle_alloc", |
| "busy_threads", |
| "cpu_utilization", |
| "dump_ftrace_stats", |
| "skippy", |
| ] |
| } |
| } |
| |
| if (is_linux && enable_perfetto_heapprofd) { |
| executable("profiling_sample_distribution") { |
| sources = [ "profiling_sample_distribution.cc" ] |
| deps = [ |
| "../../gn:default_deps", |
| "../base", |
| "../profiling/memory:client", |
| ] |
| } |
| |
| executable("multithreaded_alloc") { |
| sources = [ "multithreaded_alloc.cc" ] |
| deps = [ |
| "../../gn:default_deps", |
| "../base", |
| "../profiling/memory:client_api_standalone", |
| ] |
| } |
| } |
| |
| if (is_linux || is_android) { |
| executable("idle_alloc") { |
| deps = [ "../../gn:default_deps" ] |
| sources = [ "idle_alloc.cc" ] |
| } |
| } |
| |
| group("unittests") { |
| testonly = true |
| deps = [] |
| |
| if (current_toolchain == host_toolchain) { |
| deps += [ "ftrace_proto_gen:unittests" ] |
| } |
| } |
| |
| # The protoc binary can end up in out/protoc or out/gcc_like_host/protoc |
| # depending on whether this is a pure-host build vs a host+target (i.e. android) |
| # build. This rule ensures that in both cases we end up with a host binary in |
| # out/protoc, so tools can consistently refer to that one location. |
| protoc_target = "../../gn:protoc($host_toolchain)" |
| if (current_toolchain != host_toolchain) { |
| copy("copy_protoc") { |
| testonly = true |
| deps = [ protoc_target ] |
| host_out_dir = get_label_info(protoc_target, "root_out_dir") |
| sources = [ "$host_out_dir/protoc" ] |
| outputs = [ "$root_build_dir/protoc" ] |
| } |
| } else { |
| # Nothing to do, in this case protoc is already built in the root out dir. |
| group("copy_protoc") { |
| public_deps = [ protoc_target ] |
| } |
| } |