Hector Dearman | fcbafda | 2018-01-18 11:13:57 +0000 | [diff] [blame] | 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 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 15 | import("../gn/perfetto.gni") |
Hector Dearman | fcbafda | 2018-01-18 11:13:57 +0000 | [diff] [blame] | 16 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 17 | # Prevent that this file is accidentally included in embedder builds. |
| 18 | assert(enable_perfetto_tools) |
| 19 | |
| 20 | # Lists all tools. The root "all" target depends on this. |
| 21 | group("tools") { |
Hector Dearman | fcbafda | 2018-01-18 11:13:57 +0000 | [diff] [blame] | 22 | testonly = true |
Hector Dearman | fcbafda | 2018-01-18 11:13:57 +0000 | [diff] [blame] | 23 | deps = [ |
Primiano Tucci | 098f095 | 2019-09-03 10:21:20 +0100 | [diff] [blame] | 24 | ":copy_protoc", |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 25 | ":idle_alloc", |
Ryan Savitski | eb65cc6 | 2019-09-24 16:39:08 +0100 | [diff] [blame] | 26 | "compact_reencode", |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 27 | "ftrace_proto_gen", |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 28 | "protoprofile", |
Hector Dearman | fcbafda | 2018-01-18 11:13:57 +0000 | [diff] [blame] | 29 | ] |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 30 | if (is_linux || is_android) { |
| 31 | deps += [ |
| 32 | "busy_threads", |
| 33 | "cpu_utilization", |
| 34 | "dump_ftrace_stats", |
| 35 | "skippy", |
| 36 | ] |
| 37 | } |
Eric Seckler | a7870e6 | 2019-11-01 10:11:58 +0000 | [diff] [blame^] | 38 | if (enable_perfetto_tools_trace_to_text) { |
| 39 | deps += [ |
| 40 | "trace_to_text", |
| 41 | "trace_to_text:trace_to_text_lite", |
| 42 | ] |
| 43 | } |
Hector Dearman | fcbafda | 2018-01-18 11:13:57 +0000 | [diff] [blame] | 44 | } |
Florian Mayer | 75905df | 2018-05-08 17:44:08 +0100 | [diff] [blame] | 45 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 46 | if (is_linux && enable_perfetto_heapprofd) { |
Florian Mayer | bb54f5e | 2018-10-22 12:13:03 +0100 | [diff] [blame] | 47 | 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 Mayer | 75905df | 2018-05-08 17:44:08 +0100 | [diff] [blame] | 57 | } |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 58 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 59 | executable("idle_alloc") { |
| 60 | deps = [ |
| 61 | "../gn:default_deps", |
| 62 | ] |
| 63 | sources = [ |
| 64 | "idle_alloc.cc", |
| 65 | ] |
| 66 | } |
Primiano Tucci | 098f095 | 2019-09-03 10:21:20 +0100 | [diff] [blame] | 67 | |
| 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. |
| 72 | protoc_target = "../gn:protoc($host_toolchain)" |
| 73 | if (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 | } |