1# Copyright (C) 2022 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 15load("@perfetto_cfg//:perfetto_cfg.bzl", "PERFETTO_CONFIG") 16load( 17 "@perfetto//bazel:rules.bzl", 18 "perfetto_py_binary", 19 "perfetto_py_library", 20) 21 22licenses(["notice"]) 23 24package(default_visibility = ["//visibility:private"]) 25 26perfetto_py_binary( 27 name = "trace_processor_py_example", 28 srcs = ["example.py"], 29 deps = [":trace_processor_py"] + PERFETTO_CONFIG.deps.pandas_py, 30 main = "example.py", 31 python_version = "PY3", 32) 33 34perfetto_py_library( 35 name = "trace_processor_py", 36 srcs = glob(["perfetto/trace_processor/*.py"]), 37 data = [ 38 ":trace_uri_resolver", 39 "perfetto/trace_processor/trace_processor.descriptor", 40 "perfetto/trace_processor/metrics.descriptor", 41 PERFETTO_CONFIG.root + ":trace_processor_shell", 42 ], 43 deps = PERFETTO_CONFIG.deps.tp_vendor_py + 44 PERFETTO_CONFIG.deps.protobuf_py + 45 PERFETTO_CONFIG.deps.pandas_py, 46 imports = [ 47 ".", 48 ], 49 visibility = PERFETTO_CONFIG.public_visibility, 50) 51 52perfetto_py_library( 53 name = "trace_uri_resolver", 54 srcs = glob(["perfetto/trace_uri_resolver/*.py"]), 55 imports = [ 56 ".", 57 ], 58) 59 60perfetto_py_library( 61 name = "experimental_slice_breakdown_lib", 62 srcs = glob(["perfetto/experimental/slice_breakdown/*.py"]), 63 deps = [ 64 ":trace_processor_py", 65 ], 66 imports = [ 67 "tools/slice_breakdown", 68 ], 69) 70 71perfetto_py_binary( 72 name = "experimental_slice_breakdown_bin", 73 srcs = ["tools/slice_breakdown.py"], 74 main = "tools/slice_breakdown.py", 75 deps = [ 76 ":experimental_slice_breakdown_lib", 77 ":trace_processor_py", 78 ] + PERFETTO_CONFIG.deps.pandas_py, 79 python_version = "PY3", 80 legacy_create_init = 0, 81) 82 83perfetto_py_library( 84 name = "batch_trace_processor", 85 srcs = glob([ 86 "perfetto/batch_trace_processor/*.py" 87 ]), 88 deps = [ 89 ":trace_processor_py", 90 ] + PERFETTO_CONFIG.deps.pandas_py + 91 PERFETTO_CONFIG.deps.tp_vendor_py, 92 imports = [ 93 ".", 94 ], 95) 96 97perfetto_py_binary( 98 name = "batch_trace_processor_shell", 99 srcs = ["tools/batch_trace_processor_shell.py"], 100 main = "tools/batch_trace_processor_shell.py", 101 deps = [ 102 ":trace_processor_py", 103 ":batch_trace_processor", 104 ] + PERFETTO_CONFIG.deps.pandas_py, 105 python_version = "PY3", 106 legacy_create_init = 0, 107) 108