Skip to content

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

Open
Swetha Seelam (sseelam2) wants to merge 7 commits into
microsoft:masterfrom
sseelam2:remove-logging
Open

Align ntttcp-for-linux sleep behavior during the test with Windows version#85
Swetha Seelam (sseelam2) wants to merge 7 commits into
microsoft:masterfrom
sseelam2:remove-logging

Conversation

@sseelam2

Copy link
Copy Markdown

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
Copy Markdown
Author

@sseelam2

Copy link
Copy Markdown
Author

Comment thread src/throughputmanagement.c Outdated
goto END;
}
}
sleep(tep->test->warmup);

Copy link
Copy Markdown
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.

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

END:

@sseelam2 Swetha Seelam (sseelam2) May 29, 2024

Copy link
Copy Markdown
Author

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 thread src/throughputmanagement.c Outdated
Comment thread src/throughputmanagement.c Outdated
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;
}

@kalvdans kalvdans Jun 1, 2024

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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!


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
Copy Markdown

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