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

efun::eval_cost returns inaccurate numbers #2

Closed
Voltara opened this issue Feb 26, 2013 · 3 comments
Closed

efun::eval_cost returns inaccurate numbers #2

Voltara opened this issue Feb 26, 2013 · 3 comments

Comments

@Voltara
Copy link
Owner

Voltara commented Feb 26, 2013

Evaluation cost is tracked internally by a CPU clock alarm; the eval_cost efun returns an estimate based on elapsed wall time. This can even return negative numbers to the caller. Proposed fix is to add an optional POSIX timers based eval_cost mechanism, and to use timer_gettime() when querying the amount remaining.

setitimer/getitimer is not as suitable because getitimer only has 1/250 second resolution on current versions of Linux, which limits precision when profiling LPC code.

@thefallentree
Copy link

@Voltara
Copy link
Owner Author

Voltara commented Feb 27, 2013

Yes, that. In my prototype, I have it use a CLOCK_PROCESS_CPUTIME_ID timer configured to send SIGVTALRM, similar to what setitimer / uvalarm currently does. The advantage here is timer_gettime() can be used to get the remaining time with high precision.

My first attempt was simply to use getitimer(), but then I noticed it was counting up in 4000 microsecond increments. That would be granular for profiling code speed from within LPC.

It's working well; I just need to integrate the code more cleanly into fluffos.

@thefallentree
Copy link

http://www.kernel.org/doc/man-pages/online/pages/man2/clock_getres.2.html allows you to get precision.

maybe useful to print that thing out too.

@Voltara Voltara closed this as completed Mar 19, 2013
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

2 participants