Add statistics/2 (cputime and inferences)
I'm not very sure that I'm counting inferences in the right place (I'm a noob in WAM things). I've seen that CallPolicy has an inference counter also, but it is designed to count only if it has been configured first.
This is a hard one for a good first issue. The new module to contain statistics/2 could be named statistics, informations, status, report, gathering or information_gathering.
- How would the predicate
statistics/2be used? For inferences, time, ...
An u64 should be enough to count inferences (there aren't 1 BLIPS engines yet).
Having simple code is good but:
- Is it required to measure the number of inferences for every execution?
And only some instructions count as inferences. This new feature will also have an impact on the design.
CallPolicy is a trait and CWILCallPolicy has the counter.
... but it is designed to count only if it has been configured first.
Zero-cost abstraction?
Thank you a lot for working on this! library(statistics) sounds nice!
As to what is an inference: I think first and foremost call and execute instructions in the WAM should count.
There are also the arithmetic relations one could count. However, they are a bit strange: For example, X is 8^8^8 may count as a single inference, but take thousands of times longer than an inference that only invokes a user-defined predicate.
I do not think that having a u64 for inferences is reasonable, at least if we want Scryer to be stable long time running (I don't know what are BLIPS engines). I've modified the measure place to only count call and execute instructions. If this are the right places, maybe CWICallPolicy should be modified to just take an inferences value at the start and then check the current inference counter (similar to what time is doing).