gs-common: dumpstate: Rewrite dump_pixel_metrics to cpp

Test: adb bugreport
Bug: 279486693
Change-Id: Ia1611db82440e2a1a522269b363d8931b08f0fe5
Signed-off-by: Ziyi Cui <ziyic@google.com>
This commit is contained in:
Ziyi Cui 2023-06-06 00:20:47 +00:00
parent 9e92e70fc1
commit 717622c5bd
7 changed files with 43 additions and 14 deletions

View File

@ -2,9 +2,19 @@ package {
default_applicable_licenses: ["Android-Apache-2.0"], default_applicable_licenses: ["Android-Apache-2.0"],
} }
sh_binary { cc_binary {
name: "dump_pixel_metrics.sh", name: "dump_pixel_metrics",
src: "dump_pixel_metrics.sh", srcs: ["dump_pixel_metrics.cpp"],
cflags: [
"-Wall",
"-Wextra",
"-Werror",
],
shared_libs: [
"libbase",
"libdump",
"liblog",
],
vendor: true, vendor: true,
sub_dir: "dump", relative_install_path: "dump",
} }

View File

@ -0,0 +1,26 @@
/*
* 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 <dump/pixel_dump.h>
#include <android-base/file.h>
int main() {
setbuf(stdout, NULL);
dumpFileContent("Long running IRQ metrics", "/sys/kernel/metrics/irq/long_irq_metrics");
dumpFileContent("Resume latency metrics", "/sys/kernel/metrics/resume_latency/resume_latency_metrics");
return 0;
}

View File

@ -1,7 +0,0 @@
#!/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

View File

@ -1,3 +1,3 @@
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/pixel_metrics/sepolicy BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/pixel_metrics/sepolicy
PRODUCT_PACKAGES += dump_pixel_metrics.sh PRODUCT_PACKAGES += dump_pixel_metrics

View File

@ -2,4 +2,4 @@ pixel_bugreport(dump_pixel_metrics)
#vendor-metrics #vendor-metrics
r_dir_file(dump_pixel_metrics, sysfs_vendor_metrics) r_dir_file(dump_pixel_metrics, sysfs_vendor_metrics)
allow dump_pixel_metrics vendor_toolbox_exec:file execute_no_trans; allow dump_pixel_metrics vendor_dumpsys:file execute_no_trans;

View File

@ -1 +1 @@
/vendor/bin/dump/dump_pixel_metrics\.sh u:object_r:dump_pixel_metrics_exec:s0 /vendor/bin/dump/dump_pixel_metrics u:object_r:dump_pixel_metrics_exec:s0