Buffer size trace config param adoption
Summary: Using `trace_config.buffer_sizes` param to allocate buffers of appropriate sizes.
@@ -397,13 +397,17 @@ public final class TraceControl {
private Buffer[] getBuffers(Config config, TraceConfigExtras traceConfigExtras) {
int bufferCount = traceConfigExtras.getIntParam("trace_config.buffers", 1);
- int size =
+ int systemBufferSize =
config.optSystemConfigParamInt("system_config.buffer_size", DEFAULT_RING_BUFFER_SIZE);
boolean filebacked = config.optSystemConfigParamBool("system_config.mmap_buffer", false);
+ int[] bufferSizes = traceConfigExtras.getIntArrayParam("trace_config.buffer_sizes");
Buffer[] buffers = new Buffer[bufferCount];
for (int idx = 0; idx < bufferCount; idx++) {
- buffers[idx] = mBufferManager.allocateBuffer(size, filebacked);
+ buffers[idx] =
+ mBufferManager.allocateBuffer(
+ bufferSizes != null && idx < bufferSizes.length ? bufferSizes[idx] : systemBufferSize,
+ filebacked);
}
return buffers;
}
