diff --git a/pixel_metrics/Android.bp b/pixel_metrics/Android.bp new file mode 100644 index 0000000..3ad3ff4 --- /dev/null +++ b/pixel_metrics/Android.bp @@ -0,0 +1,10 @@ +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +sh_binary { + name: "dump_pixel_metrics.sh", + src: "dump_pixel_metrics.sh", + vendor: true, + sub_dir: "dump", +} diff --git a/pixel_metrics/dump_pixel_metrics.sh b/pixel_metrics/dump_pixel_metrics.sh new file mode 100644 index 0000000..0c6e2c2 --- /dev/null +++ b/pixel_metrics/dump_pixel_metrics.sh @@ -0,0 +1,7 @@ +#!/vendor/bin/sh +echo "Long running IRQ metrics" +cat /sys/kernel/metrics/irq/long_irq_metrics +echo "Resume latency metrics" +cat /sys/kernel/metrics/resume_latency/resume_latency_metrics +echo "Temperature Residency Metrics:" +cat /sys/kernel/metrics/temp_residency/temp_residency_all/stats diff --git a/pixel_metrics/pixel_metrics.mk b/pixel_metrics/pixel_metrics.mk new file mode 100644 index 0000000..41e027d --- /dev/null +++ b/pixel_metrics/pixel_metrics.mk @@ -0,0 +1,3 @@ +BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/pixel_metrics/sepolicy + +PRODUCT_PACKAGES += dump_pixel_metrics.sh diff --git a/thermal/sepolicy/device.te b/pixel_metrics/sepolicy/device.te similarity index 100% rename from thermal/sepolicy/device.te rename to pixel_metrics/sepolicy/device.te diff --git a/pixel_metrics/sepolicy/dump_pixel_metrics.te b/pixel_metrics/sepolicy/dump_pixel_metrics.te new file mode 100644 index 0000000..681670e --- /dev/null +++ b/pixel_metrics/sepolicy/dump_pixel_metrics.te @@ -0,0 +1,5 @@ +pixel_bugreport(dump_pixel_metrics) + +#vendor-metrics +r_dir_file(dump_pixel_metrics, sysfs_vendor_metrics) +allow dump_pixel_metrics vendor_toolbox_exec:file execute_no_trans; diff --git a/pixel_metrics/sepolicy/file_contexts b/pixel_metrics/sepolicy/file_contexts new file mode 100644 index 0000000..1b5b11f --- /dev/null +++ b/pixel_metrics/sepolicy/file_contexts @@ -0,0 +1 @@ +/vendor/bin/dump/dump_pixel_metrics\.sh u:object_r:dump_pixel_metrics_exec:s0 diff --git a/pixel_metrics/sepolicy/genfs_contexts b/pixel_metrics/sepolicy/genfs_contexts new file mode 100644 index 0000000..b914014 --- /dev/null +++ b/pixel_metrics/sepolicy/genfs_contexts @@ -0,0 +1,4 @@ +#vendor-metrics +genfscon sysfs /kernel/metrics/resume_latency/resume_latency_metrics u:object_r:sysfs_vendor_metrics:s0 +genfscon sysfs /kernel/metrics/irq/long_irq_metrics u:object_r:sysfs_vendor_metrics:s0 +genfscon sysfs /kernel/metrics/temp_residency/temp_residency_all/stats u:object_r:sysfs_vendor_metrics:s0 diff --git a/thermal/dump_thermal.sh b/thermal/dump_thermal.sh index 748753c..2b87da9 100644 --- a/thermal/dump_thermal.sh +++ b/thermal/dump_thermal.sh @@ -44,5 +44,3 @@ 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/dump_thermal.te b/thermal/sepolicy/dump_thermal.te index 930b4dd..c36f7cd 100644 --- a/thermal/sepolicy/dump_thermal.te +++ b/thermal/sepolicy/dump_thermal.te @@ -5,6 +5,3 @@ 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 5cecbd3..1422e63 100644 --- a/thermal/sepolicy/genfs_contexts +++ b/thermal/sepolicy/genfs_contexts @@ -1,5 +1,3 @@ # 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