Permalink
Browse files

Workaround for badarg when dividing by 0

  • Loading branch information...
1 parent 5bfdb88 commit 2e1896ff448a2be076f19e9759e5d55aa5a90cd5 Paul Oliver committed Jul 10, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/etop2.erl
View
@@ -250,7 +250,9 @@ loadinfo(SysI) ->
now = Now,
wall_clock = {_, WC},
runtime = {_, RT}} = SysI,
- Cpu = round(100*RT/WC),
+ Cpu = try round(100*RT/WC)
+ catch _:_ -> 0
+ end,
Clock = io_lib:format("~2.2.0w:~2.2.0w:~2.2.0w",
tuple_to_list(element(2,calendar:now_to_datetime(Now)))),
{Cpu,Procs,RQ,Clock}.

0 comments on commit 2e1896f

Please sign in to comment.