diff --git a/pcie/dump_pcie.sh b/pcie/dump_pcie.sh index 0d543d6..4546207 100644 --- a/pcie/dump_pcie.sh +++ b/pcie/dump_pcie.sh @@ -3,3 +3,9 @@ echo "--- pcie0 dump ---" cat /dev/logbuffer_pcie0 echo "--- pcie1 dump ---" cat /dev/logbuffer_pcie1 + +echo "--- pcie link statistics ---" +for f in /sys/devices/platform/*.pcie/link_stats/* +do + echo "$f: `cat $f`" +done diff --git a/pcie/sepolicy/device.te b/pcie/sepolicy/device.te index 8a471b0..934cdb4 100644 --- a/pcie/sepolicy/device.te +++ b/pcie/sepolicy/device.te @@ -1 +1,2 @@ type pcie_log_device, dev_type; +type sysfs_pcie, sysfs_type, fs_type; diff --git a/pcie/sepolicy/dump_pcie.te b/pcie/sepolicy/dump_pcie.te index 6d490bc..30b2241 100644 --- a/pcie/sepolicy/dump_pcie.te +++ b/pcie/sepolicy/dump_pcie.te @@ -2,3 +2,6 @@ pixel_bugreport(dump_pcie) allow dump_pcie pcie_log_device:chr_file r_file_perms; allow dump_pcie vendor_toolbox_exec:file execute_no_trans; + +allow dump_pcie sysfs:dir r_dir_perms; +allow dump_pcie sysfs_pcie:file r_file_perms; 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 +