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

timing doesn't work properly #128

Closed
AdrickTench opened this issue Sep 19, 2024 · 2 comments
Closed

timing doesn't work properly #128

AdrickTench opened this issue Sep 19, 2024 · 2 comments
Assignees
Labels
bug Issues that represent errors in the code good first issue Good for newcomers

Comments

@AdrickTench
Copy link
Collaborator

The following demonstrates time! fails to time sleep! accurately, and likewise max-time! fails to abort sleep!

metta+>!(time! (sleep! 1))
[
; eval_args([sleep!,1]) took 0.000298 secs. (298.50 microseconds)

True]
metta+>!(catch! (max-time! 1 (sleep! 2)) time_limit_exceeded time_limit_exceeded)
[True]
@AdrickTench AdrickTench added the bug Issues that represent errors in the code label Sep 19, 2024
@TeamSPoon
Copy link
Collaborator

TeamSPoon commented Sep 19, 2024

!(,(get-time!) (sleep! 1) (get-time!))
[(, 1726774806.2906268 True 1726774807.2910154)]

I see get-time! is wall time and time! is using cputime.. good find!

we need a (time $Eval) and a without a bang ! like (because time! is really time/1

This should be pretty easy to implement! (Marking this as a good first issue)

So the idea woudl be to write two predicates:

(time (sleep! 1)) -> 1.0 secs
(cpu-time (sleep! 1)) -> 000000000000001 secs

@TeamSPoon TeamSPoon assigned TeamSPoon and AdrickTench and unassigned TeamSPoon Sep 19, 2024
@TeamSPoon TeamSPoon added the good first issue Good for newcomers label Sep 19, 2024
TeamSPoon added a commit that referenced this issue Oct 4, 2024
TeamSPoon added a commit that referenced this issue Oct 4, 2024
@TeamSPoon
Copy link
Collaborator

TeamSPoon commented Oct 4, 2024

metta+>!(time (sleep! 1))
[
; eval_args([sleep!,1]) took 1.000 secs. (1000.00 milliseconds)

True]
metta+>!(catch! (max-time! 1 (sleep! 2)) time_limit_exceeded time_limit_exceeded)
[time_limit_exceeded]

TeamSPoon added a commit that referenced this issue Dec 4, 2024
TeamSPoon added a commit that referenced this issue Dec 4, 2024
TeamSPoon added a commit that referenced this issue Dec 4, 2024
TeamSPoon added a commit that referenced this issue Dec 4, 2024
TeamSPoon added a commit that referenced this issue Dec 4, 2024
TeamSPoon added a commit that referenced this issue Dec 4, 2024
TeamSPoon added a commit that referenced this issue Dec 4, 2024
TeamSPoon added a commit that referenced this issue Dec 4, 2024
TeamSPoon added a commit that referenced this issue Dec 4, 2024
TeamSPoon added a commit to logicmoo/metta-testsuite that referenced this issue Dec 9, 2024
TeamSPoon added a commit to logicmoo/metta-testsuite that referenced this issue Dec 9, 2024
TeamSPoon added a commit to logicmoo/metta-testsuite that referenced this issue Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that represent errors in the code good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants