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

When a guest has two vcpus, busy loop implementation of waiting for a specified duration always read the same clock value. #19

Open
tan-yue opened this issue Aug 21, 2019 · 0 comments

Comments

@tan-yue
Copy link
Contributor

tan-yue commented Aug 21, 2019

Due to #18 , I tried this alternative approach with commit shown below:

start = int(time.clock() * 1000)
while int(time.clock() * 1000) - start < 500:
    pass

My test is based on firecracker@23b4387 on console branch and firerunner@bca73a7 on integrate branch.

This workaround works when the guest has one vcpu. But the loop effectively becomes an infinite loop if a guest has two vcpus because time.clock() always return the same value. Under the hood, for python2, time.clock() calls clock_gettime with clock id CLOCK_PROCESS_CPUTIME_ID

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

No branches or pull requests

1 participant