Skip to content

Commit

Permalink
Correct allocation test script (#2956)
Browse files Browse the repository at this point in the history
Motivation:

Unfortunately the current script has a bug meaning it can never fail.

Modifications:

Change bracketing for output search.

Result:

Allocation tests will flag when failing
  • Loading branch information
PeterAdams-A authored Oct 31, 2024
1 parent 08af85a commit e1d0d21
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 5 deletions.
2 changes: 1 addition & 1 deletion IntegrationTests/tests_04_performance/Thresholds/5.10.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"10000000_asyncsequenceproducer": 19,
"1000000_asyncwriter": 1000013,
"1000_addHandlers": 43000,
"1000_addHandlers": 44000,
"1000_addHandlers_sync": 36000,
"1000_addRemoveHandlers_handlercontext": 8032,
"1000_addRemoveHandlers_handlername": 8032,
Expand Down
2 changes: 1 addition & 1 deletion IntegrationTests/tests_04_performance/Thresholds/5.9.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"10000000_asyncsequenceproducer": 19,
"1000000_asyncwriter": 1000013,
"1000_addHandlers": 43000,
"1000_addHandlers": 44000,
"1000_addHandlers_sync": 36000,
"1000_addRemoveHandlers_handlercontext": 8032,
"1000_addRemoveHandlers_handlername": 8032,
Expand Down
50 changes: 50 additions & 0 deletions IntegrationTests/tests_04_performance/Thresholds/6.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"10000000_asyncsequenceproducer": 19,
"1000000_asyncwriter": 1000013,
"1000_addHandlers": 44000,
"1000_addHandlers_sync": 36000,
"1000_addRemoveHandlers_handlercontext": 8032,
"1000_addRemoveHandlers_handlername": 8032,
"1000_addRemoveHandlers_handlertype": 8032,
"1000_autoReadGetAndSet": 18000,
"1000_autoReadGetAndSet_sync": 0,
"1000_copying_bytebufferview_to_array": 1000,
"1000_copying_circularbuffer_to_array": 1000,
"1000_getHandlers": 8034,
"1000_getHandlers_sync": 34,
"1000_reqs_1_conn": 26363,
"1000_rst_connections": 145004,
"1000_tcpbootstraps": 3001,
"1000_tcpconnections": 152002,
"1000_udp_reqs": 6014,
"1000_udpbootstraps": 2000,
"1000_udpconnections": 75008,
"1_reqs_1000_conn": 389000,
"bytebuffer_lots_of_rw": 2005,
"creating_10000_headers": 0,
"decode_1000_ws_frames": 2000,
"encode_1000_ws_frames_holding_buffer": 3,
"encode_1000_ws_frames_holding_buffer_with_mask": 2003,
"encode_1000_ws_frames_holding_buffer_with_space": 3,
"encode_1000_ws_frames_holding_buffer_with_space_with_mask": 2003,
"encode_1000_ws_frames_new_buffer": 3000,
"encode_1000_ws_frames_new_buffer_with_mask": 5000,
"encode_1000_ws_frames_new_buffer_with_space": 3000,
"encode_1000_ws_frames_new_buffer_with_space_with_mask": 5000,
"execute_hop_10000_tasks": 0,
"future_erase_result": 4001,
"future_lots_of_callbacks": 53001,
"get_100000_headers_canonical_form": 700000,
"get_100000_headers_canonical_form_trimming_whitespace": 700000,
"get_100000_headers_canonical_form_trimming_whitespace_from_long_string": 700000,
"get_100000_headers_canonical_form_trimming_whitespace_from_short_string": 700000,
"modifying_1000_circular_buffer_elements": 0,
"modifying_byte_buffer_view": 6000,
"ping_pong_1000_reqs_1_conn": 319,
"read_10000_chunks_from_file": 110009,
"schedule_10000_tasks": 40084,
"schedule_and_run_10000_tasks": 50010,
"scheduling_10000_executions": 89,
"udp_1000_reqs_1_conn": 6156,
"udp_1_reqs_1000_conn": 162000
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"10000000_asyncsequenceproducer": 19,
"1000000_asyncwriter": 1000013,
"1000_addHandlers": 43000,
"1000_addHandlers": 44000,
"1000_addHandlers_sync": 36000,
"1000_addRemoveHandlers_handlercontext": 8032,
"1000_addRemoveHandlers_handlername": 8032,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"10000000_asyncsequenceproducer": 19,
"1000000_asyncwriter": 1000013,
"1000_addHandlers": 43000,
"1000_addHandlers": 44000,
"1000_addHandlers_sync": 36000,
"1000_addRemoveHandlers_handlercontext": 8032,
"1000_addRemoveHandlers_handlername": 8032,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ done

"$here/test_01_resources/run-nio-alloc-counter-tests.sh" -t "$tmp" > "$tmp/output"

observed_allocations="{"
for test in "${all_tests[@]}"; do
while read -r test_case; do
test_case=${test_case#test_*}
total_allocations=$(grep "^test_$test_case.total_allocations:" "$tmp/output" | cut -d: -f2 | sed 's/ //g')
observed_allocations="${observed_allocations}
\"${test_case}\": ${total_allocations},"
done < <(grep "^test_${test}[^\W]*.total_allocations:" "$tmp/output" | cut -d: -f1 | cut -d. -f1 | sort | uniq)
done
observed_allocations="${observed_allocations}
}"
info "observed allocations:
${observed_allocations}"

for test in "${all_tests[@]}"; do
cat "$tmp/output" # helps debugging

Expand Down Expand Up @@ -63,5 +77,5 @@ for test in "${all_tests[@]}"; do
assert_less_than_or_equal "$total_allocations" "$max_allowed"
assert_greater_than "$total_allocations" "$(( max_allowed - 1000))"
fi
done < <(grep "^test_${test[^\W]}*.total_allocations:" "$tmp/output" | cut -d: -f1 | cut -d. -f1 | sort | uniq)
done < <(grep "^test_${test}[^\W]*.total_allocations:" "$tmp/output" | cut -d: -f1 | cut -d. -f1 | sort | uniq)
done

0 comments on commit e1d0d21

Please sign in to comment.