Erlang monotonic time. This is Erlang's view of the OS monotonic time if available, or the VM's own monotonic version of the system time if not available. This is the adjusted clock that is used for events, timers, and so on. Its stability makes it ideal to count a time interval. Do note that this time is monotonic, but not strictly monotonic, meaning that the clock can't go backwards, but it can return the same value many times!
As mentioned earlier, the Erlang monotonic time is not strictly monotonic: it will possibly return the same number twice if it's called at the same time on two different cores, for example.
And under the hood of Erlang monotonic time are clock_gettime (Linux) , and QueryPerformanceCounter (QPC) (Windows) , the reference about them here.
The code of commit is not beautiful but it can solve the problem :relaxed:
This commit to fix the calc_workload function to avoid the error due to division by zero.
The details discussion at #5 .
The cause is Erlang monotonic time can return the same value many times ! Then
idle_time
andduration
might zero at unspecified point in time.Following https://learnyousomeerlang.com/time:
And under the hood of Erlang monotonic time are
clock_gettime
(Linux) , andQueryPerformanceCounter
(QPC) (Windows) , the reference about them here.The code of commit is not beautiful but it can solve the problem :relaxed: