From 1aea24d503676b4a0d19d1eea4df0061810a86ed Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Sun, 9 Feb 2025 17:46:15 +0800 Subject: [PATCH] init.rc: Disable native stats collection service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When opening and closing activities in Settings, a measurably significant amount of CPU time is spent processing and logging stats events in statsd: 0.02% /apex/com.android.os.statsd/lib64/libstatspull.so @plt 0.01% /apex/com.android.os.statsd/bin/statsd @plt 0.01% /apex/com.android.os.statsd/bin/statsd SocketListener::runListener() 0.01% /apex/com.android.os.statsd/bin/statsd android::os::statsd::LogEvent::parseBuffer(unsigned char*, unsigned long) 0.01% /apex/com.android.os.statsd/bin/statsd android::os::statsd::LogEvent::parseAnnotations(unsigned char, int) Over longer device uptimes with real-world usage, statsd uses a substantial amount of total CPU time. We have no use for the stats recorded by statsd, so disable the service entirely to save CPU in potential hotpaths. This is the system/core part of the change; changes to frameworks/base are also required. Test: simpleperf record -a; verify that statsd no longer appears in sample hits Change-Id: Idf6fdb0eff987169bd5f370dd72315e831a669e6 Signed-off-by: Hưng Phan Signed-off-by: Dmitrii Signed-off-by: Pranav Vashi Signed-off-by: rmp22 <195054967+rmp22@users.noreply.github.com> --- rootdir/init.rc | 1 - 1 file changed, 1 deletion(-) diff --git a/rootdir/init.rc b/rootdir/init.rc index 1a775ff60..f0fb1d630 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -1143,7 +1143,6 @@ on zygote-start wait_for_prop odsign.verification.done 1 # A/B update verifier that marks a successful boot. exec_start update_verifier - start statsd start zygote start zygote_secondary