Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align ntttcp-for-linux sleep behavior during the test with Windows version #85

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

sseelam2
Copy link

Description
This pull request updates the ntttcp-for-linux code to more closely match the behavior of the Windows version regarding sleep intervals during the test duration.

Background
In the Windows version of ntttcp, the process sleeps once for the entire duration of the test, wakes up at the end, and then concludes the results. In contrast, the Linux version was designed to wake up every 500 microseconds to check the bandwidth limit and every half second to report the current throughput.

Changes Made

  • Removed the frequent sleep intervals in the Linux version.
  • Implemented a single sleep that lasts for the entire duration of the test, similar to the Windows implementation.

@sseelam2
Copy link
Author

sseelam2 commented May 29, 2024 via email

@sseelam2
Copy link
Author

sseelam2 commented May 29, 2024 via email

goto END;
}
}
sleep(tep->test->warmup);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update this to nano sleep and move it inside the while loop.

@@ -236,20 +141,4 @@ void run_ntttcp_throughput_management(struct ntttcp_test_endpoint *tep)

wait_light_off();
PRINT_INFO("Test cycle finished.");

END:
Copy link
Author

@sseelam2 sseelam2 May 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the label and keep lines from 241 - 254

Comment on lines 68 to 74
} else if (errno == EFAULT) {
PRINT_ERR("EFAULT: Problem with copying information from user space.");
break;
} else if (errno == EINVAL) {
PRINT_ERR("EINVAL: The time specified to sleep was not in the range [0,999999999]");
break;
}
Copy link

@kalvdans kalvdans Jun 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use perror or strerror to convert any unexpected error code into a message. Don't continue to run the program after unexpected errors.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Updated the code.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the special handling of EFAULT and EINVAL. Quit the program on unexpected errors.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I updated the code.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good now, I'm happy!

@@ -237,8 +166,7 @@ void run_ntttcp_throughput_management(struct ntttcp_test_endpoint *tep)
wait_light_off();
PRINT_INFO("Test cycle finished.");

END:
if (tep->test->client_role == true && tep->test->no_synch == false) {
if (tep->test->client_role == true && tep->test->no_synch == false) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert accidental indentation of code here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants