Get Erlang node uptime and way to test it is working

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Get Erlang node uptime and way to test it is working

Mithun B
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"

If any one having more insight on this, please shed some light on these
topics.

Thanks and regards,

Mithun B

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Get Erlang node uptime and way to test it is working

Rickard Green-2

tis 20 juni 2017 kl. 09:21 skrev Mithun B <[hidden email]>:
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
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
--
Rickard Green, Erlang/OTP, Ericsson AB

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Get Erlang node uptime and way to test it is working

Mithun B
Hi Rickard Green,

    Thanks for your valuable reply and will consider your suggestion of using erlang:convert_time_unit/3 instead of assuming nanoseconds.

Regards,
Mithun B

On Tuesday 20 June 2017 04:26 PM, Rickard Green wrote:

tis 20 juni 2017 kl. 09:21 skrev Mithun B <[hidden email]>:
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
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
--
Rickard Green, Erlang/OTP, Ericsson AB



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Get Erlang node uptime and way to test it is working

Richard Carlsson-3
In reply to this post by Rickard Green-2
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 <[hidden email]>:

tis 20 juni 2017 kl. 09:21 skrev Mithun B <[hidden email]>:
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
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
--
Rickard Green, Erlang/OTP, Ericsson AB

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Get Erlang node uptime and way to test it is working

Rickard Green-2
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 <[hidden email]
> <mailto:[hidden email]>>:
>
>
>     tis 20 juni 2017 kl. 09:21 skrev Mithun B <[hidden email]
>     <mailto:[hidden email]>>:
>
>         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
>         [hidden email] <mailto:[hidden email]>
>         http://erlang.org/mailman/listinfo/erlang-questions
>         <http://erlang.org/mailman/listinfo/erlang-questions>
>
>     --
>     Rickard Green, Erlang/OTP, Ericsson AB
>
>     _______________________________________________
>     erlang-questions mailing list
>     [hidden email] <mailto:[hidden email]>
>     http://erlang.org/mailman/listinfo/erlang-questions
>     <http://erlang.org/mailman/listinfo/erlang-questions>
>
>

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Get Erlang node uptime and way to test it is working

Mithun B
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 <[hidden email]
>> <mailto:[hidden email]>>:
>>
>>
>>     tis 20 juni 2017 kl. 09:21 skrev Mithun B <[hidden email]
>>     <mailto:[hidden email]>>:
>>
>>         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
>>         [hidden email] <mailto:[hidden email]>
>>         http://erlang.org/mailman/listinfo/erlang-questions
>> <http://erlang.org/mailman/listinfo/erlang-questions>
>>
>>     --     Rickard Green, Erlang/OTP, Ericsson AB
>>
>>     _______________________________________________
>>     erlang-questions mailing list
>>     [hidden email] <mailto:[hidden email]>
>>     http://erlang.org/mailman/listinfo/erlang-questions
>>     <http://erlang.org/mailman/listinfo/erlang-questions>
>>
>>
>
>

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Loading...