diff --git a/performance/Android.bp b/performance/Android.bp new file mode 100644 index 0000000..6eee7c4 --- /dev/null +++ b/performance/Android.bp @@ -0,0 +1,18 @@ +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_binary { + name: "dump_perf", + srcs: ["dump_perf.cpp"], + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + ], + shared_libs: [ + "libdump", + ], + vendor: true, + relative_install_path: "dump", +} diff --git a/performance/dump_perf.cpp b/performance/dump_perf.cpp new file mode 100644 index 0000000..aa742f1 --- /dev/null +++ b/performance/dump_perf.cpp @@ -0,0 +1,22 @@ +/* + * Copyright 2022 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. + */ + +#include + +int main() { + dumpFileContent("VENDOR PROC DUMP", "/proc/vendor_sched/dump_task"); + return 0; +} diff --git a/performance/perf.mk b/performance/perf.mk new file mode 100644 index 0000000..dfbdb5b --- /dev/null +++ b/performance/perf.mk @@ -0,0 +1,3 @@ +BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/performance/sepolicy + +PRODUCT_PACKAGES += dump_perf diff --git a/performance/sepolicy/dump_perf.te b/performance/sepolicy/dump_perf.te new file mode 100644 index 0000000..15c4f6e --- /dev/null +++ b/performance/sepolicy/dump_perf.te @@ -0,0 +1,3 @@ +pixel_bugreport(dump_perf) + +allow dump_perf proc_vendor_sched:file r_file_perms; diff --git a/performance/sepolicy/file_contexts b/performance/sepolicy/file_contexts new file mode 100644 index 0000000..171529e --- /dev/null +++ b/performance/sepolicy/file_contexts @@ -0,0 +1,2 @@ +/vendor/bin/dump/dump_perf u:object_r:dump_perf_exec:s0 +