alloc-limits.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. # Copyright 2021, gRPC Authors All rights reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # This script parses output from the SwiftNIO allocation counter framework to
  16. # generate a list of per-test limits for total_allocations.
  17. #
  18. # Input is like:
  19. # ...
  20. # test_embedded_server_unary_1k_rpcs_1_small_request.total_allocated_bytes: 5992858
  21. # test_embedded_server_unary_1k_rpcs_1_small_request.total_allocations: 63000
  22. # test_embedded_server_unary_1k_rpcs_1_small_request.remaining_allocations: 0
  23. # DEBUG: [["total_allocated_bytes": 5992858, "total_allocations": ...
  24. #
  25. # Output:
  26. # MAX_ALLOCS_ALLOWED_embedded_server_unary_1k_rpcs_1_small_request=64000
  27. grep 'test_.*\.total_allocations: ' \
  28. | sed 's/^[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}T[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}.[0-9]*Z //' \
  29. | sed 's/^test_/MAX_ALLOCS_ALLOWED_/' \
  30. | sed 's/.total_allocations://' \
  31. | awk '{ print " " $1 ": " ((int($2 / 1000) + 1) * 1000) }' \
  32. | sort