Bug 1464983 - Lower the java sampling rate to 1ms and increase the java buffer. r=gerald

We had to increase the java buffer limit to 64MiB because it was a bottleneck
and 8MiB wasn't enough for 1ms sampling rate. It was getting full pretty quick.
Even though we increased that limit, we are not going to allocate all of this
at the start. Since we are allocating the buffer chunk by chunk, we are going
to allocate only when we need.

Differential Revision: https://phabricator.services.mozilla.com/D74715
This commit is contained in:
Nazım Can Altınova 2020-05-12 10:54:13 +00:00
Родитель 609e319c24
Коммит 2490316019
1 изменённых файлов: 9 добавлений и 7 удалений

Просмотреть файл

@ -2514,11 +2514,12 @@ static void locked_profiler_stream_json_for_this_process(
if (ActivePS::FeatureJava(aLock)) { if (ActivePS::FeatureJava(aLock)) {
java::GeckoJavaSampler::Pause(); java::GeckoJavaSampler::Pause();
// locked_profiler_start uses sample count is 1000 for Java thread. // We are allocating it chunk by chunk. So this will not allocate 64 MiB
// This entry size is enough now, but we might have to estimate it // at once. This size should be more than enough for java threads.
// if we can customize it // This buffer is being created for each process but Android has
// relatively less processes compared to desktop, so it's okay here.
mozilla::ProfileBufferChunkManagerWithLocalLimit chunkManager( mozilla::ProfileBufferChunkManagerWithLocalLimit chunkManager(
8 * 1024 * 1024, 1024 * 1024); 64 * 1024 * 1024, 1024 * 1024);
ProfileChunkedBuffer bufferManager( ProfileChunkedBuffer bufferManager(
ProfileChunkedBuffer::ThreadSafety::WithoutMutex, chunkManager); ProfileChunkedBuffer::ThreadSafety::WithoutMutex, chunkManager);
ProfileBuffer javaBuffer(bufferManager); ProfileBuffer javaBuffer(bufferManager);
@ -4260,9 +4261,10 @@ static void locked_profiler_start(PSLockRef aLock, PowerOfTwo32 aCapacity,
#if defined(GP_OS_android) #if defined(GP_OS_android)
if (ActivePS::FeatureJava(aLock)) { if (ActivePS::FeatureJava(aLock)) {
int javaInterval = interval; int javaInterval = interval;
// Java sampling doesn't accurately keep up with 1ms sampling. // Java sampling doesn't accurately keep up with the sampling rate that is
if (javaInterval < 10) { // lower than 1ms.
javaInterval = 10; if (javaInterval < 1) {
javaInterval = 1;
} }
// Send the interval-relative entry count, but we have 100000 hard cap in // Send the interval-relative entry count, but we have 100000 hard cap in
// the java code, it can't be more than that. // the java code, it can't be more than that.