blob: 62145485b2f23ac3dc3c4af27f50272e3c9e9d8e [file] [log] [blame]
Hector Dearmanfcbafda2018-01-18 11:13:57 +00001# 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
Primiano Tucci02c11762019-08-30 00:57:59 +020015import("../gn/perfetto.gni")
Hector Dearmanfcbafda2018-01-18 11:13:57 +000016
Primiano Tucci02c11762019-08-30 00:57:59 +020017# 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") {
Hector Dearmanfcbafda2018-01-18 11:13:57 +000022 testonly = true
Hector Dearmanfcbafda2018-01-18 11:13:57 +000023 deps = [
Primiano Tucci098f0952019-09-03 10:21:20 +010024 ":copy_protoc",
Primiano Tucci02c11762019-08-30 00:57:59 +020025 ":idle_alloc",
Ryan Savitskieb65cc62019-09-24 16:39:08 +010026 "compact_reencode",
Primiano Tucci02c11762019-08-30 00:57:59 +020027 "ftrace_proto_gen",
Primiano Tucci02c11762019-08-30 00:57:59 +020028 "protoprofile",
Hector Dearmanfcbafda2018-01-18 11:13:57 +000029 ]
Primiano Tucci02c11762019-08-30 00:57:59 +020030 if (is_linux || is_android) {
31 deps += [
32 "busy_threads",
33 "cpu_utilization",
34 "dump_ftrace_stats",
35 "skippy",
36 ]
37 }
Eric Secklera7870e62019-11-01 10:11:58 +000038 if (enable_perfetto_tools_trace_to_text) {
39 deps += [
40 "trace_to_text",
41 "trace_to_text:trace_to_text_lite",
42 ]
43 }
Hector Dearmanfcbafda2018-01-18 11:13:57 +000044}
Florian Mayer75905df2018-05-08 17:44:08 +010045
Primiano Tucci02c11762019-08-30 00:57:59 +020046if (is_linux && enable_perfetto_heapprofd) {
Florian Mayerbb54f5e2018-10-22 12:13:03 +010047 executable("profiling_sample_distribution") {
48 sources = [
49 "profiling_sample_distribution.cc",
50 ]
51 deps = [
52 "../gn:default_deps",
53 "../src/base",
54 "../src/profiling/memory:client",
55 ]
56 }
Florian Mayer75905df2018-05-08 17:44:08 +010057}
Primiano Tucci02c11762019-08-30 00:57:59 +020058
Primiano Tucci02c11762019-08-30 00:57:59 +020059executable("idle_alloc") {
60 deps = [
61 "../gn:default_deps",
62 ]
63 sources = [
64 "idle_alloc.cc",
65 ]
66}
Primiano Tucci098f0952019-09-03 10:21:20 +010067
68# The protoc binary can end up in out/protoc or out/gcc_like_host/protoc
69# depending on whether this is a pure-host build vs a host+target (i.e. android)
70# build. This rule ensures that in both cases we end up with a host binary in
71# out/protoc, so tools can consistently refer to that one location.
72protoc_target = "../gn:protoc($host_toolchain)"
73if (current_toolchain != host_toolchain) {
74 copy("copy_protoc") {
75 testonly = true
76 deps = [
77 protoc_target,
78 ]
79 host_out_dir = get_label_info(protoc_target, "root_out_dir")
80 sources = [
81 "$host_out_dir/protoc",
82 ]
83 outputs = [
84 "$root_build_dir/protoc",
85 ]
86 }
87} else {
88 # Nothing to do, in this case protoc is already built in the root out dir.
89 group("copy_protoc") {
90 public_deps = [
91 protoc_target,
92 ]
93 }
94}