Skip to content

Optimize AndroidCpuCollector #5925

Description

@runningcode

AndroidCpuCollector reads and parses /proc/self/stat on every sample to obtain the process cpu time. collect() runs every 100ms for the whole duration of every transaction, and each sample allocates the file reader buffers, the intermediate strings and a regex split of all 52 fields — measured at 33623 bytes per call on a Pixel 3 — to extract four numbers.

Reduce the cost of the collector, and of constructing it (the regex Pattern is compiled on the SentryAndroid.init path, whether or not performance collection ever starts).

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions