-
Notifications
You must be signed in to change notification settings - Fork 88
code: the sender and receiver call sequence
Simon Xiao edited this page Apr 13, 2019
·
3 revisions
Take TCP call sequence as example:
receiver:
----------------------------
main():
run_ntttcp_receiver():
|-----> pthread_create() to create test threads and each thread does:
| |-> run_ntttcp_receiver_tcp_stream():
| |-> ntttcp_server_listen()
| |-> ntttcp_server_epoll(), or ntttcp_server_select()
| |-> if (no_synch), then: turn_on_light() once any data received
|-----> if (!no_synch), then: pthread_create() to create sync thread create_receiver_sync_socket():
| |-> reply sender sync requests
| |-> turn_on_light() once sender requested
|-----> while (1), do:
|-> wait_light_on()
|-> reset perf counters
|-> run_test_timer()
|-> wait_light_off()
|-> turn_off_light() will be triggered by:
| |-> test timer expired, or
| |-> Ctrl+C signal captured
|-> calculate receiver side perf stats
sender:
----------------------------
main():
run_ntttcp_sender():
|-----> if (!no_synch), then: create_sender_sync_socket():
| |-> query_receiver_busy_state()
| |-> negotiate_test_duration()
|-----> pthread_create() to create test threads and each thread does:
| |-> run_ntttcp_sender_tcp_stream():
| |-> create socket and connect to TCP server
| |-> wait_light_on()
| |-> do test (call n_write()) while (is_light_turned_on())
|-----> if (!no_synch), then:
| |-> request_to_start()
|-----> turn_on_light()
|-----> run_test_timer()
|-----> wait_light_off()
|-----> turn_off_light() will be triggered by:
| |-> test timer expired, or
| |-> Ctrl+C signal captured
|-----> pthread_join() to wait all threads exit after light is off
|-----> calculate sender side perf stats