-
Notifications
You must be signed in to change notification settings - Fork 0
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
Read pcap files with nanosec precision, set nano_sleep as default sle… #3
Conversation
e5d3ebe
to
52a6830
Compare
src/sleep.h
Outdated
break; | ||
} | ||
get_current_time(now); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit concerned about this one. Converting nanosleep to a busy loop might consume many resources. Am I miss something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it is a good idea to use absolute sleep instead of relative sleep when an application needs to be suspended and activated in a periodic time, precise periodic activation cannot be achieved with a relative sleep() or nanosleep() function call. --> https://linux.die.net/man/3/clock_nanosleep
Do you think this solution is less efficient in ensuring precise periodic suspension and activation?
In case of nanosleep we do the following.
- calculate now
- calculate nap time (from pcap file)
- nanosleep(nap)
When CPU time is taken away from the process right after (2) before (3) then the application will not be activated exactly at now+nap. It will be activated at now+context_switch+nap
With busy loop it is easier to eliminate the effect of context switch since the time until the program should do nothing useful is an absolute time. What is your view on this?
52a6830
to
80885b0
Compare
80885b0
to
00e9f83
Compare
No description provided.