Skip to content

Commit

Permalink
pw_{log, log_rpc}: Remove optional from thread filter
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
Reviewed-by: Carlos Chinchilla <[email protected]>
Reviewed-by: Keir Mierle <[email protected]>
  • Loading branch information
Leonardo Acosta authored and CQ Bot Account committed Jun 16, 2022
1 parent f04cd24 commit 5a1f043
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pw_log/log.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions pw_log_rpc/public/pw_log_rpc/log_filter_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down

0 comments on commit 5a1f043

Please sign in to comment.