Skip to content

Commit

Permalink
init.rc: Disable native stats collection service
Browse files Browse the repository at this point in the history
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
Tested-By: SakuraiLH-MergeBot <quantalogic@outlook.com>
  • Loading branch information
kdrag0n authored and Kapp509840 committed Jul 5, 2021
1 parent 39ccbe3 commit 3922529
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions rootdir/init.rc
Original file line number Diff line number Diff line change
Expand Up @@ -812,23 +812,20 @@ on zygote-start && property:persist.sys.fuse=""
on zygote-start && property:ro.crypto.state=unencrypted
# A/B update verifier that marks a successful boot.
exec_start update_verifier_nonencrypted
start statsd
start netd
start zygote
start zygote_secondary

on zygote-start && property:ro.crypto.state=unsupported
# A/B update verifier that marks a successful boot.
exec_start update_verifier_nonencrypted
start statsd
start netd
start zygote
start zygote_secondary

on zygote-start && property:ro.crypto.state=encrypted && property:ro.crypto.type=file
# A/B update verifier that marks a successful boot.
exec_start update_verifier_nonencrypted
start statsd
start netd
start zygote
start zygote_secondary
Expand Down

0 comments on commit 3922529

Please sign in to comment.