[erlang-patches] Fix spec for cpu_sup:util/1

Henrik Nord henrik@REDACTED
Tue Dec 10 14:09:11 CET 2013


Thank you for you contribution!

At first glance, feel free to include the WHY in the commit message.

https://github.com/erlang/otp/wiki/Writing-good-commit-messages

Tidy up the commit message and then create a pull request from the 
branch, We will keep this email thread too, for comments and reviews.




On 2013-12-04 15:38, Andrew Caruth wrote:
> Hi OTP devs,
>
> I recently noticed dialyzer was flagging an issue in one of our own modules that was making a call to cpu_sup:util([detailed]). An 'is_list()' guard test was performed on the second element of the tuple returned which dialyzer was reporting as a test that could never succeed. Sample output from a call to cpu_sup:util([detailed]):
>
> {[0],
>   [{soft_irq,0.0},
>    {hard_irq,0.0},
>    {kernel,0.41368935690109065},
>    {nice_user,0.0},
>    {user,0.9402030838661151}],
>   [{steal,0.0},{idle,98.64610755923279},{wait,0.0}],
>   []}
>
> The spec implied {'all' | integer | list, tuple | float, tuple | float, []}, which excludes the above output, so I've updated the spec to allow the second and third elements as lists.
>
> Also, the atoms 'soft_irq', 'hard_irq', and 'steal' were also not part of the spec, so I've also added those.
>
> git fetch git://github.com/acaruth/otp.git cpu_sup_spec_fix
> https://github.com/acaruth/otp/compare/erlang:maint...cpu_sup_spec_fix
> https://github.com/acaruth/otp/compare/erlang:maint...cpu_sup_spec_fix.patch
>
> Thanks,
> Andrew Caruth
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@REDACTED
> http://erlang.org/mailman/listinfo/erlang-patches

-- 
/Henrik Nord Erlang/OTP




More information about the erlang-patches mailing list