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).
AndroidCpuCollectorreads and parses/proc/self/staton 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
Patternis compiled on theSentryAndroid.initpath, whether or not performance collection ever starts).