[erlang-questions] Get Erlang node uptime and way to test it is working

Mithun B <>
Wed Jul 5 12:27:05 CEST 2017


Hi everyone,

     I am glad that Mr. Rickard Green and Mr. Richard Carlsson gave some 
insight about the problem, with using erlang:statistics(wall_clock) in 
Erlang OTP 19.

     Any Idea how to test this without waiting for 50 days for actually 
see its working fine. I mean what if I need to test for 100 days or 
more, it doesn't look logical.

with regards,

Mithun B

On Thursday 22 June 2017 06:03 PM, Rickard Green wrote:
> Hmm, looked closer at statistics(wall_clock) and found that it is 
> buggy on 32-bit architectures. This due to an unfortunate cast which 
> causes it to wrap after approximately 50 days. This will be fixed in 
> an upcoming patches for OTP 19 and 20.
>
> Internally erlang:statistics(wall_clock) use Erlang monotonic time, so 
> it will be as accurate as using erlang monotonic time directly. It is 
> however not as efficient as using erlang monotonic time directly due 
> to the locking that is needs. That is, the recommended way to get this 
> info is:
>  erlang:convert_time_unit(erlang:monotonic_time() - 
> erlang:system_info(start_time), native, TheTimeUnitYouWant).
>
> Regards,
> Rickard, Erlang/OTP, Ericsson AB
>
> On 06/22/2017 10:45 AM, Richard Carlsson wrote:
>> Would be good to patch the uptime function in c.erl, in that case, 
>> since that uses wall_clock.
>>
>>
>>          /Richard
>>
>> 2017-06-20 12:56 GMT+02:00 Rickard Green < 
>> <mailto:>>:
>>
>>
>>     tis 20 juni 2017 kl. 09:21 skrev Mithun B <
>>     <mailto:>>:
>>
>>         Hi all,
>>
>>         We are using "erlang:statistics(wall_clock)" to get the Erlang
>>         node up
>>         time in millisecond.
>>
>>         It works fine till 49 days, but on 49th day it will role back to
>>         start
>>         from 0 millisecond.
>>
>>         I need to know two things here, First of all, a different method
>>         for how
>>         to test it, I don't want to wait for 49+ days to see it works or
>>         not.
>>
>>         Secondly, I need to know a method which gives proper up time
>>         even after
>>         49+ days. How about following:
>>
>>         "(erlang:monotonic_time() - erlang:system_info(start_time)) div
>>         1000000000"
>>
>>
>>     Apart from the assumption of nanosecond native time unit this is the
>>     way to do it. Use erlang:convert_time_unit() instead. There are
>>     Erlang systems not using nanoseconds as native time unit.
>>
>>     Regards,
>>     Rickard Green, Erlang/OTP
>>
>>
>>         If any one having more insight on this, please shed some light
>>         on these
>>         topics.
>>
>>         Thanks and regards,
>>
>>         Mithun B
>>
>>         _______________________________________________
>>         erlang-questions mailing list
>>          <mailto:>
>>         http://erlang.org/mailman/listinfo/erlang-questions
>> <http://erlang.org/mailman/listinfo/erlang-questions>
>>
>>     --     Rickard Green, Erlang/OTP, Ericsson AB
>>
>>     _______________________________________________
>>     erlang-questions mailing list
>>      <mailto:>
>>     http://erlang.org/mailman/listinfo/erlang-questions
>>     <http://erlang.org/mailman/listinfo/erlang-questions>
>>
>>
>
>



More information about the erlang-questions mailing list