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", |
Ryan Savitski | eb65cc6 | 2019-09-24 16:39:08 +0100 | [diff] [blame] | 25 | "compact_reencode", |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 26 | "ftrace_proto_gen", |
Primiano Tucci | 3f00374 | 2021-05-14 19:25:14 +0100 | [diff] [blame] | 27 | "proto_filter", |
Lalit Maganti | 19a720a | 2021-06-18 15:24:31 +0100 | [diff] [blame] | 28 | "proto_merger", |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 29 | "protoprofile", |
Hector Dearman | fcbafda | 2018-01-18 11:13:57 +0000 | [diff] [blame] | 30 | ] |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 31 | if (is_linux || is_android) { |
| 32 | deps += [ |
Primiano Tucci | b730b11 | 2020-12-01 14:56:11 +0100 | [diff] [blame] | 33 | ":idle_alloc", |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 34 | "busy_threads", |
| 35 | "cpu_utilization", |
| 36 | "dump_ftrace_stats", |
| 37 | "skippy", |
| 38 | ] |
| 39 | } |
Eric Seckler | a7870e6 | 2019-11-01 10:11:58 +0000 | [diff] [blame] | 40 | if (enable_perfetto_tools_trace_to_text) { |
| 41 | deps += [ |
| 42 | "trace_to_text", |
| 43 | "trace_to_text:trace_to_text_lite", |
| 44 | ] |
| 45 | } |
Hector Dearman | fcbafda | 2018-01-18 11:13:57 +0000 | [diff] [blame] | 46 | } |
Florian Mayer | 75905df | 2018-05-08 17:44:08 +0100 | [diff] [blame] | 47 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 48 | if (is_linux && enable_perfetto_heapprofd) { |
Florian Mayer | bb54f5e | 2018-10-22 12:13:03 +0100 | [diff] [blame] | 49 | executable("profiling_sample_distribution") { |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 50 | sources = [ "profiling_sample_distribution.cc" ] |
Florian Mayer | bb54f5e | 2018-10-22 12:13:03 +0100 | [diff] [blame] | 51 | deps = [ |
| 52 | "../gn:default_deps", |
| 53 | "../src/base", |
| 54 | "../src/profiling/memory:client", |
| 55 | ] |
| 56 | } |
Florian Mayer | ab86d6d | 2020-11-11 13:30:40 +0000 | [diff] [blame] | 57 | |
| 58 | executable("multithreaded_alloc") { |
| 59 | sources = [ "multithreaded_alloc.cc" ] |
| 60 | deps = [ |
| 61 | "../gn:default_deps", |
| 62 | "../src/base", |
| 63 | "../src/profiling/memory:client_api_standalone", |
| 64 | ] |
| 65 | } |
Florian Mayer | 75905df | 2018-05-08 17:44:08 +0100 | [diff] [blame] | 66 | } |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 67 | |
Primiano Tucci | b730b11 | 2020-12-01 14:56:11 +0100 | [diff] [blame] | 68 | if (is_linux || is_android) { |
| 69 | executable("idle_alloc") { |
| 70 | deps = [ "../gn:default_deps" ] |
| 71 | sources = [ "idle_alloc.cc" ] |
| 72 | } |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 73 | } |
Primiano Tucci | 098f095 | 2019-09-03 10:21:20 +0100 | [diff] [blame] | 74 | |
| 75 | # The protoc binary can end up in out/protoc or out/gcc_like_host/protoc |
| 76 | # depending on whether this is a pure-host build vs a host+target (i.e. android) |
| 77 | # build. This rule ensures that in both cases we end up with a host binary in |
| 78 | # out/protoc, so tools can consistently refer to that one location. |
| 79 | protoc_target = "../gn:protoc($host_toolchain)" |
| 80 | if (current_toolchain != host_toolchain) { |
| 81 | copy("copy_protoc") { |
| 82 | testonly = true |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 83 | deps = [ protoc_target ] |
Primiano Tucci | 098f095 | 2019-09-03 10:21:20 +0100 | [diff] [blame] | 84 | host_out_dir = get_label_info(protoc_target, "root_out_dir") |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 85 | sources = [ "$host_out_dir/protoc" ] |
| 86 | outputs = [ "$root_build_dir/protoc" ] |
Primiano Tucci | 098f095 | 2019-09-03 10:21:20 +0100 | [diff] [blame] | 87 | } |
| 88 | } else { |
| 89 | # Nothing to do, in this case protoc is already built in the root out dir. |
| 90 | group("copy_protoc") { |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 91 | public_deps = [ protoc_target ] |
Primiano Tucci | 098f095 | 2019-09-03 10:21:20 +0100 | [diff] [blame] | 92 | } |
| 93 | } |