From 5a1f043c4dea70649cc9248cb7c06c57955f8218 Mon Sep 17 00:00:00 2001 From: Leonardo Acosta Date: Tue, 14 Jun 2022 12:03:51 -0700 Subject: [PATCH] pw_{log, log_rpc}: Remove optional from thread filter - Remove `optional` from FilterRule thread_equals field. - Use configuration module and name field sizes in response buffer sizing. Change-Id: I9bc8f21ff13d7ba5a2f45c9d404be31ece55b34a Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/98141 Commit-Queue: Carlos Chinchilla Reviewed-by: Carlos Chinchilla Reviewed-by: Keir Mierle --- pw_log/log.proto | 2 +- pw_log_rpc/public/pw_log_rpc/log_filter_service.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pw_log/log.proto b/pw_log/log.proto index aa45583aa1..a1f4e7011d 100644 --- a/pw_log/log.proto +++ b/pw_log/log.proto @@ -201,7 +201,7 @@ message FilterRule { Action action = 4; // Condition 4: (thread_equals.size() == 0 || log.thread == thread_equals). - optional bytes thread_equals = 5 [(tokenizer.format) = TOKENIZATION_OPTIONAL]; + bytes thread_equals = 5 [(tokenizer.format) = TOKENIZATION_OPTIONAL]; } // A filter is a series of rules. First matching rule wins. diff --git a/pw_log_rpc/public/pw_log_rpc/log_filter_service.h b/pw_log_rpc/public/pw_log_rpc/log_filter_service.h index bb074afbdb..3532ef2b89 100644 --- a/pw_log_rpc/public/pw_log_rpc/log_filter_service.h +++ b/pw_log_rpc/public/pw_log_rpc/log_filter_service.h @@ -58,10 +58,12 @@ class FilterService final (protobuf::SizeOfFieldEnum( log::FilterRule::Fields::LEVEL_GREATER_THAN_OR_EQUAL, 7) + protobuf::SizeOfFieldBytes(log::FilterRule::Fields::MODULE_EQUALS, - 6) + + cfg::kMaxModuleNameBytes) + protobuf::SizeOfFieldUint32(log::FilterRule::Fields::ANY_FLAGS_SET, 1) + - protobuf::SizeOfFieldEnum(log::FilterRule::Fields::ACTION, 2)); + protobuf::SizeOfFieldEnum(log::FilterRule::Fields::ACTION, 2) + + protobuf::SizeOfFieldBytes(log::FilterRule::Fields::THREAD_EQUALS, + cfg::kMaxThreadNameBytes)); static constexpr size_t kFilterIdsResponseBufferSize = kMinSupportedFilters *