Skip to content

Commit

Permalink
Fix issue #18.
Browse files Browse the repository at this point in the history
  • Loading branch information
IanLuites committed Mar 17, 2017
1 parent 52f1155 commit fdd8fa5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/wobserver/system/scheduler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,17 @@ defmodule Wobserver.System.Scheduler do
case last_utilization() do
false ->
get_utilization()
|> Enum.map(fn {_, u, t} -> u / t end)
|> Enum.map(fn {_, u, t} -> percentage(u, t) end)
last ->
get_utilization()
|> Enum.zip(last)
|> Enum.map(fn {{_, u0, t0}, {_, u1, t1}} -> (u1 - u0) / (t1 - t0) end)
|> Enum.map(fn {{_, u0, t0}, {_, u1, t1}} -> percentage((u1 - u0), (t1 - t0)) end)
end
end

defp percentage(_, 0), do: 0
defp percentage(u, t), do: u / t

defp get_utilization do
util =
:scheduler_wall_time
Expand Down

0 comments on commit fdd8fa5

Please sign in to comment.