Fix spec for cpu_sup:util/1

Andrew Caruth <[email protected]>
Newsgroups gmane.comp.lang.erlang.patches
Message-ID <1fb41668f5e8478398b8e62f3adcfd21@DB3PR03MB315.eurprd03.prod.outlook.com>
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
[email protected]
http://erlang.org/mailman/listinfo/erlang-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.