This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Processes</h1> | |
<hr /> | |
<table> | |
<thead> | |
<tr> | |
<th>PID</th> | |
<th>Name or Initial Func</th> | |
<th>Reds</th> | |
<th>Memory</th> | |
<th>MsqQ</th> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule PhoenixObserverWeb.ObserverLive do | |
use Phoenix.LiveView | |
alias PhoenixObserverWeb.PageView | |
alias PhoenixObserver.Format | |
@initial_settings %{ | |
timer_refresh_rate: 1000, | |
timer: nil, | |
system_info: %{ | |
proc_count: 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule PhoenixObserverWeb.ObserverLive do | |
use Phoenix.LiveView | |
alias PhoenixObserverWeb.PageView | |
alias PhoenixObserver.Format | |
@initial_settings %{ | |
timer_refresh_rate: 1000, | |
timer: nil, | |
system_info: %{ | |
proc_count: 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table> | |
<thead> | |
<tr> | |
<th>System</th> | |
<th><i>Count / Limit</i></th> | |
<th>System Switch</th> | |
<th><i>Status</i></th> | |
<th>Memory Info</th> | |
<th><i>Size</i></th> | |
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule PhoenixObserver.Format do | |
def number_to_human_size(size) when is_integer(size) and size < 1024, do: "#{size} B" | |
def number_to_human_size(size) when size < 1024 * 1024, do: "#{Float.round(size / 1024, 4)} KB" | |
def number_to_human_size(size) when size < 1024 * 1024 * 1024, | |
do: "#{Float.round(size / (1024 * 1024), 4)} MB" | |
def number_to_human_size(size) when size < 1024 * 1024 * 1024 * 1024 do | |
"#{Float.round(size / (1024 * 1024 * 1024), 4)} GB" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule PhoenixObserver.Format do | |
def number_to_human_size(size) when is_integer(size) and size < 1024, do: "#{size} B" | |
def number_to_human_size(size) when size < 1024 * 1024, do: "#{Float.round(size / 1024, 4)} KB" | |
def number_to_human_size(size) when size < 1024 * 1024 * 1024, | |
do: "#{Float.round(size / (1024 * 1024), 4)} MB" | |
def number_to_human_size(size) when size < 1024 * 1024 * 1024 * 1024 do | |
"#{Float.round(size / (1024 * 1024 * 1024), 4)} GB" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section class="phx-hero"> | |
<div> | |
<%= live_render(@conn, PhoenixObserverWeb.ObserverLive) %> | |
</div> | |
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import "../../deps/phoenix_live_view/assets/css/live_view.css"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Solution do | |
#Enter your code here. Read input from STDIN. Print output to STDOUT | |
defstruct arrival: [], duration: [], events_allowed: [], event_hours: MapSet.new, read_step: :arrival, number_of_events: nil | |
def max_events do | |
%Solution{} | |
|> read_parameter | |
|> calculate_max_events | |
|> IO.puts | |
end |