Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 159 additions & 0 deletions Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -7439,6 +7439,65 @@ genrule {
],
}

// GN: //protos/perfetto/protovm:compile_config_descriptor
genrule {
name: "perfetto_protos_perfetto_protovm_compile_config_descriptor",
srcs: [
"protos/perfetto/protovm/compile_config.proto",
],
tools: [
"aprotoc",
],
cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --descriptor_set_out=$(out) $(in)",
out: [
"perfetto_protos_perfetto_protovm_compile_config_descriptor.bin",
],
}

// GN: //protos/perfetto/protovm:compile_config_zero
filegroup {
name: "perfetto_protos_perfetto_protovm_compile_config_zero",
srcs: [
"protos/perfetto/protovm/compile_config.proto",
],
}

// GN: //protos/perfetto/protovm:compile_config_zero
genrule {
name: "perfetto_protos_perfetto_protovm_compile_config_zero_gen",
srcs: [
":perfetto_protos_perfetto_protovm_compile_config_zero",
],
tools: [
"aprotoc",
"protozero_plugin",
],
cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location protozero_plugin) --plugin_out=wrapper_namespace=pbzero:$(genDir)/external/perfetto/ $(locations :perfetto_protos_perfetto_protovm_compile_config_zero)",
out: [
"external/perfetto/protos/perfetto/protovm/compile_config.pbzero.cc",
],
}

// GN: //protos/perfetto/protovm:compile_config_zero
genrule {
name: "perfetto_protos_perfetto_protovm_compile_config_zero_gen_headers",
srcs: [
":perfetto_protos_perfetto_protovm_compile_config_zero",
],
tools: [
"aprotoc",
"protozero_plugin",
],
cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location protozero_plugin) --plugin_out=wrapper_namespace=pbzero:$(genDir)/external/perfetto/ $(locations :perfetto_protos_perfetto_protovm_compile_config_zero)",
out: [
"external/perfetto/protos/perfetto/protovm/compile_config.pbzero.h",
],
export_include_dirs: [
".",
"protos",
],
}

// GN: //protos/perfetto/protovm:cpp
filegroup {
name: "perfetto_protos_perfetto_protovm_cpp",
Expand Down Expand Up @@ -7483,6 +7542,21 @@ genrule {
],
}

// GN: //protos/perfetto/protovm:descriptor
genrule {
name: "perfetto_protos_perfetto_protovm_descriptor",
srcs: [
"protos/perfetto/protovm/vm_program.proto",
],
tools: [
"aprotoc",
],
cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --descriptor_set_out=$(out) $(in)",
out: [
"perfetto_protos_perfetto_protovm_descriptor.bin",
],
}

// GN: //protos/perfetto/protovm:lite
filegroup {
name: "perfetto_protos_perfetto_protovm_lite",
Expand Down Expand Up @@ -14625,6 +14699,83 @@ filegroup {
],
}

// GN: //src/protovm/compiler:compiler
filegroup {
name: "perfetto_src_protovm_compiler_compiler",
srcs: [
"src/protovm/compiler/compiler.cc",
"src/protovm/compiler/instruction_emitter.cc",
],
}

// GN: //src/protovm/compiler:gen_cc_compile_config_descriptor
genrule {
name: "perfetto_src_protovm_compiler_gen_cc_compile_config_descriptor",
srcs: [
":perfetto_protos_perfetto_protovm_compile_config_descriptor",
],
cmd: "$(location python/tools/cpp_blob_emitter.py) --output=$(out) --gen-dir=$(genDir) --namespace perfetto --symbol-suffix Descriptor $(in)",
out: [
"src/protovm/compiler/compile_config.descriptor.h",
],
tool_files: [
"python/tools/cpp_blob_emitter.py",
],
}

// GN: //src/protovm/compiler:gen_cc_trace_descriptor
genrule {
name: "perfetto_src_protovm_compiler_gen_cc_trace_descriptor",
srcs: [
":perfetto_protos_perfetto_trace_descriptor",
],
cmd: "$(location python/tools/cpp_blob_emitter.py) --output=$(out) --gen-dir=$(genDir) --namespace perfetto --symbol-suffix Descriptor $(in)",
out: [
"src/protovm/compiler/trace.descriptor.h",
],
tool_files: [
"python/tools/cpp_blob_emitter.py",
],
}

// GN: //src/protovm/compiler:gen_cc_vm_program_descriptor
genrule {
name: "perfetto_src_protovm_compiler_gen_cc_vm_program_descriptor",
srcs: [
":perfetto_protos_perfetto_protovm_descriptor",
],
cmd: "$(location python/tools/cpp_blob_emitter.py) --output=$(out) --gen-dir=$(genDir) --namespace perfetto --symbol-suffix Descriptor $(in)",
out: [
"src/protovm/compiler/vm_program.descriptor.h",
],
tool_files: [
"python/tools/cpp_blob_emitter.py",
],
}

// GN: //src/protovm/compiler:gen_cc_winscope_descriptor
genrule {
name: "perfetto_src_protovm_compiler_gen_cc_winscope_descriptor",
srcs: [
":perfetto_protos_perfetto_trace_android_winscope_descriptor",
],
cmd: "$(location python/tools/cpp_blob_emitter.py) --output=$(out) --gen-dir=$(genDir) --namespace perfetto --symbol-suffix Descriptor $(in)",
out: [
"src/protovm/compiler/winscope.descriptor.h",
],
tool_files: [
"python/tools/cpp_blob_emitter.py",
],
}

// GN: //src/protovm/compiler:unittests
filegroup {
name: "perfetto_src_protovm_compiler_unittests",
srcs: [
"src/protovm/compiler/compiler_unittest.cc",
],
}

// GN: //src/protovm:protovm
filegroup {
name: "perfetto_src_protovm_protovm",
Expand Down Expand Up @@ -20178,6 +20329,7 @@ cc_test {
":perfetto_protos_perfetto_perfetto_sql_cpp_gen",
":perfetto_protos_perfetto_perfetto_sql_zero_gen",
":perfetto_protos_perfetto_proto_filtering_lite_gen",
":perfetto_protos_perfetto_protovm_compile_config_zero_gen",
":perfetto_protos_perfetto_protovm_cpp_gen",
":perfetto_protos_perfetto_protovm_lite_gen",
":perfetto_protos_perfetto_protovm_zero_gen",
Expand Down Expand Up @@ -20317,6 +20469,8 @@ cc_test {
":perfetto_src_proto_utils_pb_to_txt",
":perfetto_src_proto_utils_txt_to_pb",
":perfetto_src_proto_utils_unittests",
":perfetto_src_protovm_compiler_compiler",
":perfetto_src_protovm_compiler_unittests",
":perfetto_src_protovm_protovm",
":perfetto_src_protovm_test_messages_lite_gen",
":perfetto_src_protovm_unittests",
Expand Down Expand Up @@ -20659,6 +20813,7 @@ cc_test {
"perfetto_protos_perfetto_perfetto_sql_cpp_gen_headers",
"perfetto_protos_perfetto_perfetto_sql_zero_gen_headers",
"perfetto_protos_perfetto_proto_filtering_lite_gen_headers",
"perfetto_protos_perfetto_protovm_compile_config_zero_gen_headers",
"perfetto_protos_perfetto_protovm_cpp_gen_headers",
"perfetto_protos_perfetto_protovm_lite_gen_headers",
"perfetto_protos_perfetto_protovm_zero_gen_headers",
Expand Down Expand Up @@ -20744,6 +20899,10 @@ cc_test {
"perfetto_src_perfetto_cmd_protos_cpp_gen_headers",
"perfetto_src_proto_utils_gen_cc_config_descriptor",
"perfetto_src_proto_utils_gen_cc_trace_summary_descriptor",
"perfetto_src_protovm_compiler_gen_cc_compile_config_descriptor",
"perfetto_src_protovm_compiler_gen_cc_trace_descriptor",
"perfetto_src_protovm_compiler_gen_cc_vm_program_descriptor",
"perfetto_src_protovm_compiler_gen_cc_winscope_descriptor",
"perfetto_src_protovm_test_messages_lite_gen_headers",
"perfetto_src_protozero_filtering_gen_cc_filter_util_test_descriptor",
"perfetto_src_protozero_testing_messages_cpp_gen_headers",
Expand Down
4 changes: 4 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ if (enable_perfetto_traceconv) {
}
}

if (enable_perfetto_protovm_compiler) {
all_targets += [ "src/protovm/compiler:protovm_compiler" ]
}

if (enable_perfetto_heapprofd) {
all_targets += [ "src/profiling/memory:heapprofd" ]

Expand Down
1 change: 1 addition & 0 deletions gn/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ protobuf_full_deps_allowlist = [
"../src/protozero/filtering:filter_util",
"../src/trace_processor:trace_processor_shell_lib",
"../src/trace_processor/shell:*",
"../src/protovm/compiler:*",
"../tools/*",
"../src/tools/*",
"../contrib/rust-sdk/tools/*",
Expand Down
3 changes: 3 additions & 0 deletions gn/perfetto.gni
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,9 @@ declare_args() {
}

declare_args() {
# Enables the protovm_compiler tool.
enable_perfetto_protovm_compiler = enable_perfetto_tools

# Enables the traceconv tool.
enable_perfetto_traceconv =
enable_perfetto_tools && enable_perfetto_trace_processor_sqlite
Expand Down
4 changes: 4 additions & 0 deletions gn/perfetto_unittests.gni
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ if (enable_perfetto_tools) {
_misc_unittests_targets += [ "src/tools:unittests" ]
}

if (enable_perfetto_protovm_compiler) {
_misc_unittests_targets += [ "src/protovm/compiler:unittests" ]
}

if (enable_perfetto_ipc) {
_base_unittests_targets += [ "src/ipc:unittests" ]
_tracing_unittests_targets += [ "src/tracing/ipc:unittests" ]
Expand Down
8 changes: 8 additions & 0 deletions protos/perfetto/protovm/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ import("../../../gn/proto_library.gni")

perfetto_proto_library("@TYPE@") {
sources = [ "vm_program.proto" ]
generate_descriptor = "vm_program.descriptor"
descriptor_root_source = "vm_program.proto"
}

perfetto_proto_library("compile_config_@TYPE@") {
sources = [ "compile_config.proto" ]
generate_descriptor = "compile_config.descriptor"
descriptor_root_source = "compile_config.proto"
}
67 changes: 67 additions & 0 deletions protos/perfetto/protovm/compile_config.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright (C) 2026 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

syntax = "proto2";

package perfetto.protos;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add some comments to explain what this is about?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a comment / explain what these protos are for? and how they are different from vm_program.proto?

message CompileConfig {
repeated Command commands = 1;
}

message Command {
oneof command {
DelCommand del = 1;
EnterScopeCommand enter_scope = 2;
SetCommand set = 3;
MergeCommand merge = 4;
}

enum AbortLevel {
// Skip current command but execute following ones
SKIP_CURRENT_COMMAND = 1;
// Skip current command as well as following ones (default)
SKIP_CURRENT_COMMAND_AND_BREAK_OUTER = 2;
// Abort whole program
ABORT = 3;
};
optional AbortLevel abort_level = 5;
}

message DelCommand {
repeated string src = 1;
repeated string dst = 2;
optional bool if_src_present = 3;
optional string dst_key_field = 4;
}

message EnterScopeCommand {
repeated string src = 1;
repeated string dst = 2;
repeated Command commands = 3;
}

message SetCommand {
repeated string src = 1;
repeated string dst = 2;
}

message MergeCommand {
repeated string src = 1;
repeated string dst = 2;
optional bool recursive = 3;
optional string key_field = 4;
}
15 changes: 13 additions & 2 deletions protos/perfetto/trace/perfetto_trace.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18166,15 +18166,26 @@ message TestEvent {
}
optional TestPayload payload = 5;

// Simple ProtoVm patch and incremental state formats used for integration
// testing
// Simple ProtoVm patch and incremental state formats used for testing
message ProtoVmMessage {
message ProtoVmSubmessage {
optional uint32 single_int = 1;
}
optional uint32 id = 1;
optional ProtoVmSubmessage submessage = 2;
}
message ProtoVmPatch {
optional string string_to_merge = 1;
optional int32 int_to_merge = 2;
optional ProtoVmMessage single_message = 3;
repeated ProtoVmMessage messages = 4;
repeated uint32 delete_message_ids = 5;
}
message ProtoVmIncrementalState {
optional string string_merged = 1;
optional int32 int_merged = 2;
optional ProtoVmMessage single_message = 3;
repeated ProtoVmMessage messages = 4;
}
optional ProtoVmPatch protovm_patch = 6;
optional ProtoVmIncrementalState protovm_incremental_state = 7;
Expand Down
15 changes: 13 additions & 2 deletions protos/perfetto/trace/test_event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,26 @@ message TestEvent {
}
optional TestPayload payload = 5;

// Simple ProtoVm patch and incremental state formats used for integration
// testing
// Simple ProtoVm patch and incremental state formats used for testing
message ProtoVmMessage {
message ProtoVmSubmessage {
optional uint32 single_int = 1;
}
optional uint32 id = 1;
optional ProtoVmSubmessage submessage = 2;
}
message ProtoVmPatch {
optional string string_to_merge = 1;
optional int32 int_to_merge = 2;
optional ProtoVmMessage single_message = 3;
repeated ProtoVmMessage messages = 4;
repeated uint32 delete_message_ids = 5;
}
message ProtoVmIncrementalState {
optional string string_merged = 1;
optional int32 int_merged = 2;
optional ProtoVmMessage single_message = 3;
repeated ProtoVmMessage messages = 4;
}
optional ProtoVmPatch protovm_patch = 6;
optional ProtoVmIncrementalState protovm_incremental_state = 7;
Expand Down
Loading
Loading