From 4a96ebedbfe9256259e9a3a46f0f9bc42df95577 Mon Sep 17 00:00:00 2001 From: Ziyi Cui Date: Fri, 18 Nov 2022 22:17:06 +0000 Subject: [PATCH] gs-common:dumpstate: Dump Temperature Residency at bugreport At the bugreport, capture Temperature Residency metrics Bug: 246799997 Test: Test: "adb bugreport" includes temp residency metrics capture. Change-Id: I1cb1c9e53890f3175812e15a15f09bcb7fd9d6af --- thermal/dump_thermal.sh | 2 ++ thermal/sepolicy/device.te | 2 ++ thermal/sepolicy/dump_thermal.te | 4 ++++ thermal/sepolicy/genfs_contexts | 2 ++ 4 files changed, 10 insertions(+) create mode 100644 thermal/sepolicy/device.te diff --git a/thermal/dump_thermal.sh b/thermal/dump_thermal.sh index 2b87da9..748753c 100644 --- a/thermal/dump_thermal.sh +++ b/thermal/dump_thermal.sh @@ -44,3 +44,5 @@ echo "TMU_SUB rise thresholds:" cat /sys/module/gs_thermal/parameters/tmu_sub_reg_dump_rise_thres echo "TMU_SUB fall thresholds:" cat /sys/module/gs_thermal/parameters/tmu_sub_reg_dump_fall_thres +echo "Temperature Residency Metrics:" +cat /sys/kernel/metrics/temp_residency/temp_residency_all/stats diff --git a/thermal/sepolicy/device.te b/thermal/sepolicy/device.te new file mode 100644 index 0000000..63640e3 --- /dev/null +++ b/thermal/sepolicy/device.te @@ -0,0 +1,2 @@ +#vendor-metrics +type sysfs_vendor_metrics, fs_type, sysfs_type; diff --git a/thermal/sepolicy/dump_thermal.te b/thermal/sepolicy/dump_thermal.te index 2dd6ba4..930b4dd 100644 --- a/thermal/sepolicy/dump_thermal.te +++ b/thermal/sepolicy/dump_thermal.te @@ -4,3 +4,7 @@ allow dump_thermal sysfs_thermal:dir r_dir_perms; allow dump_thermal sysfs_thermal:file r_file_perms; allow dump_thermal sysfs_thermal:lnk_file r_file_perms; allow dump_thermal vendor_toolbox_exec:file execute_no_trans; + +#vendor-metrics +r_dir_file(dump_thermal, sysfs_vendor_metrics) +allow dump_thermal sysfs_vendor_metrics:lnk_file r_file_perms; diff --git a/thermal/sepolicy/genfs_contexts b/thermal/sepolicy/genfs_contexts index 1422e63..5cecbd3 100644 --- a/thermal/sepolicy/genfs_contexts +++ b/thermal/sepolicy/genfs_contexts @@ -1,3 +1,5 @@ # thermal sysfs files genfscon sysfs /module/gs_thermal/parameters u:object_r:sysfs_thermal:s0 +#vendor-metrics +genfscon sysfs /kernel/metrics/temp_residency/temp_residency_all/stats u:object_r:sysfs_vendor_metrics:s0