diff options
author | Ioannis Ilkos <ilkos@google.com> | 2022-12-09 17:36:11 +0000 |
---|---|---|
committer | Ioannis Ilkos <ilkos@google.com> | 2023-03-13 11:48:58 +0000 |
commit | f35a169ad7118512483e7a04a0efc59a2bdfa504 (patch) | |
tree | 6d23d270f26cea8715a70cd081489dc0f65f2117 | |
parent | d52380b318c1ebc2b6e636cc56432f3356784bf7 (diff) | |
download | perfetto-f35a169ad7118512483e7a04a0efc59a2bdfa504.tar.gz |
Introduce guardrail override for max buffer size
Bug: 261864179
Bug: 272719059
Change-Id: If9dbe9df68f61499313a5e2bb5f4ef990770b928
Merged-In: If9dbe9df68f61499313a5e2bb5f4ef990770b928
-rw-r--r-- | protos/perfetto/config/perfetto_config.proto | 4 | ||||
-rw-r--r-- | protos/perfetto/config/trace_config.proto | 4 | ||||
-rw-r--r-- | protos/perfetto/trace/perfetto_trace.proto | 4 | ||||
-rw-r--r-- | src/tracing/core/tracing_service_impl.cc | 8 |
4 files changed, 18 insertions, 2 deletions
diff --git a/protos/perfetto/config/perfetto_config.proto b/protos/perfetto/config/perfetto_config.proto index 00fee9061..3bc791895 100644 --- a/protos/perfetto/config/perfetto_config.proto +++ b/protos/perfetto/config/perfetto_config.proto @@ -1918,6 +1918,10 @@ message TraceConfig { // On R-, this override only affected userdebug builds. Since S, it also // affects user builds. optional uint64 max_upload_per_day_bytes = 1; + + // Overrides the guardrail for maximum trace buffer size. + // Available on U+ + optional uint32 max_tracing_buffer_size_kb = 2; } optional GuardrailOverrides guardrail_overrides = 11; diff --git a/protos/perfetto/config/trace_config.proto b/protos/perfetto/config/trace_config.proto index be1ba8237..4fc271724 100644 --- a/protos/perfetto/config/trace_config.proto +++ b/protos/perfetto/config/trace_config.proto @@ -208,6 +208,10 @@ message TraceConfig { // On R-, this override only affected userdebug builds. Since S, it also // affects user builds. optional uint64 max_upload_per_day_bytes = 1; + + // Overrides the guardrail for maximum trace buffer size. + // Available on U+ + optional uint32 max_tracing_buffer_size_kb = 2; } optional GuardrailOverrides guardrail_overrides = 11; diff --git a/protos/perfetto/trace/perfetto_trace.proto b/protos/perfetto/trace/perfetto_trace.proto index 58a0f68e6..7a80660bb 100644 --- a/protos/perfetto/trace/perfetto_trace.proto +++ b/protos/perfetto/trace/perfetto_trace.proto @@ -1918,6 +1918,10 @@ message TraceConfig { // On R-, this override only affected userdebug builds. Since S, it also // affects user builds. optional uint64 max_upload_per_day_bytes = 1; + + // Overrides the guardrail for maximum trace buffer size. + // Available on U+ + optional uint32 max_tracing_buffer_size_kb = 2; } optional GuardrailOverrides guardrail_overrides = 11; diff --git a/src/tracing/core/tracing_service_impl.cc b/src/tracing/core/tracing_service_impl.cc index 807b955d8..b35345118 100644 --- a/src/tracing/core/tracing_service_impl.cc +++ b/src/tracing/core/tracing_service_impl.cc @@ -664,12 +664,16 @@ base::Status TracingServiceImpl::EnableTracing(ConsumerEndpointImpl* consumer, } buf_size_sum += buf.size_kb(); } - if (buf_size_sum > kGuardrailsMaxTracingBufferSizeKb) { + + uint32_t max_tracing_buffer_size_kb = + std::max(kGuardrailsMaxTracingBufferSizeKb, + cfg.guardrail_overrides().max_tracing_buffer_size_kb()); + if (buf_size_sum > max_tracing_buffer_size_kb) { MaybeLogUploadEvent( cfg, PerfettoStatsdAtom::kTracedEnableTracingBufferSizeTooLarge); return PERFETTO_SVC_ERR("Requested too large trace buffer (%" PRIu64 "kB > %" PRIu32 " kB)", - buf_size_sum, kGuardrailsMaxTracingBufferSizeKb); + buf_size_sum, max_tracing_buffer_size_kb); } } |