blob: 37584e8ce88fd43ecdcd8c195a5658c4818e419b [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",
Ryan Savitskieb65cc62019-09-24 16:39:08 +010025 "compact_reencode",
Primiano Tucci02c11762019-08-30 00:57:59 +020026 "ftrace_proto_gen",
Primiano Tucci3f003742021-05-14 19:25:14 +010027 "proto_filter",
Lalit Maganti19a720a2021-06-18 15:24:31 +010028 "proto_merger",
Primiano Tucci02c11762019-08-30 00:57:59 +020029 "protoprofile",
Hector Dearmanfcbafda2018-01-18 11:13:57 +000030 ]
Primiano Tucci02c11762019-08-30 00:57:59 +020031 if (is_linux || is_android) {
32 deps += [
Primiano Tuccib730b112020-12-01 14:56:11 +010033 ":idle_alloc",
Primiano Tucci02c11762019-08-30 00:57:59 +020034 "busy_threads",
35 "cpu_utilization",
36 "dump_ftrace_stats",
37 "skippy",
38 ]
39 }
Eric Secklera7870e62019-11-01 10:11:58 +000040 if (enable_perfetto_tools_trace_to_text) {
41 deps += [
42 "trace_to_text",
43 "trace_to_text:trace_to_text_lite",
44 ]
45 }
Hector Dearmanfcbafda2018-01-18 11:13:57 +000046}
Florian Mayer75905df2018-05-08 17:44:08 +010047
Primiano Tucci02c11762019-08-30 00:57:59 +020048if (is_linux && enable_perfetto_heapprofd) {
Florian Mayerbb54f5e2018-10-22 12:13:03 +010049 executable("profiling_sample_distribution") {
Primiano Tucci2925e9d2020-01-27 10:15:58 +000050 sources = [ "profiling_sample_distribution.cc" ]
Florian Mayerbb54f5e2018-10-22 12:13:03 +010051 deps = [
52 "../gn:default_deps",
53 "../src/base",
54 "../src/profiling/memory:client",
55 ]
56 }
Florian Mayerab86d6d2020-11-11 13:30:40 +000057
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 Mayer75905df2018-05-08 17:44:08 +010066}
Primiano Tucci02c11762019-08-30 00:57:59 +020067
Primiano Tuccib730b112020-12-01 14:56:11 +010068if (is_linux || is_android) {
69 executable("idle_alloc") {
70 deps = [ "../gn:default_deps" ]
71 sources = [ "idle_alloc.cc" ]
72 }
Primiano Tucci02c11762019-08-30 00:57:59 +020073}
Primiano Tucci098f0952019-09-03 10:21:20 +010074
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.
79protoc_target = "../gn:protoc($host_toolchain)"
80if (current_toolchain != host_toolchain) {
81 copy("copy_protoc") {
82 testonly = true
Primiano Tucci2925e9d2020-01-27 10:15:58 +000083 deps = [ protoc_target ]
Primiano Tucci098f0952019-09-03 10:21:20 +010084 host_out_dir = get_label_info(protoc_target, "root_out_dir")
Primiano Tucci2925e9d2020-01-27 10:15:58 +000085 sources = [ "$host_out_dir/protoc" ]
86 outputs = [ "$root_build_dir/protoc" ]
Primiano Tucci098f0952019-09-03 10:21:20 +010087 }
88} else {
89 # Nothing to do, in this case protoc is already built in the root out dir.
90 group("copy_protoc") {
Primiano Tucci2925e9d2020-01-27 10:15:58 +000091 public_deps = [ protoc_target ]
Primiano Tucci098f0952019-09-03 10:21:20 +010092 }
93}