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
Signed-off-by: Hưng Phan <[email protected]>
Signed-off-by: Dmitrii <[email protected]>
Signed-off-by: Joey Huab <[email protected]>

Former-commit-id: 713d3c615df1f9da06074841a3a1eeeb73117bf8
Former-commit-id: facceb44f5357b2bcf480b678c100e6f6c96eb9e
Signed-off-by: Pranav Vashi <[email protected]>
Signed-off-by: Anushek Prasal <[email protected]>
  • Loading branch information
kdrag0n authored and SKULSHADY committed Aug 25, 2023
1 parent 6509cc9 commit c8f2280
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 @@ -1038,7 +1038,6 @@ on zygote-start && property:ro.crypto.state=unencrypted
wait_for_prop odsign.verification.done 1
# A/B update verifier that marks a successful boot.
exec_start update_verifier_nonencrypted
start statsd
start netd
start zygote
start zygote_secondary
Expand All @@ -1047,7 +1046,6 @@ on zygote-start && property:ro.crypto.state=unsupported
wait_for_prop odsign.verification.done 1
# A/B update verifier that marks a successful boot.
exec_start update_verifier_nonencrypted
start statsd
start netd
start zygote
start zygote_secondary
Expand All @@ -1056,7 +1054,6 @@ on zygote-start && property:ro.crypto.state=encrypted && property:ro.crypto.type
wait_for_prop odsign.verification.done 1
# 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 c8f2280

Please sign in to comment.