Skip to content

Commit

Permalink
rate -> ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
mnakao committed Jan 14, 2024
1 parent f57b547 commit 797030b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Disk_Info/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def num_with_commas(number)
return number.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\1,').reverse
end

def rate(a, b)
def ratio(a, b)
if b.to_i == 0
return 0
else
Expand Down
8 changes: 4 additions & 4 deletions Disk_Info/views/index.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ td {
<th>Limit</th>
<th>Usage</th>
<th>Avail.</th>
<th>Rate</th>
<th>Ratio</th>
<th>Limit</th>
<th>Usage</th>
<th>Avail.</th>
<th>Rate</th>
<th>Ratio</th>
</tr>
<% @disk_info[i][1..-1].each do |d| %>
<tr>
Expand All @@ -67,7 +67,7 @@ td {
<td><%= num_with_commas(capacity_avail) %></td>
<td>
<div class="graph">
<strong class="bar_<%= color(rate(capacity, capacity_limit)) %>" style="width: <%= rate(capacity, capacity_limit) %>%;"><%= rate(capacity, capacity_limit) %>%</strong>
<strong class="bar_<%= color(ratio(capacity, capacity_limit)) %>" style="width: <%= ratio(capacity, capacity_limit) %>%;"><%= ratio(capacity, capacity_limit) %>%</strong>
</div>
</td>
<% else %>
Expand All @@ -82,7 +82,7 @@ td {
<td><%= num_with_commas(inode_avail) %></td>
<td>
<div class="graph">
<strong class="bar_<%= color(rate(inode, inode_limit)) %>" style="width: <%= rate(inode, inode_limit) %>%;"><%= rate(inode, inode_limit) %>%</strong>
<strong class="bar_<%= color(ratio(inode, inode_limit)) %>" style="width: <%= ratio(inode, inode_limit) %>%;"><%= ratio(inode, inode_limit) %>%</strong>
</div>
</td>
<% else %>
Expand Down
2 changes: 1 addition & 1 deletion Resource_Info/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def title
"Resource info"
end

def rate(a, b)
def ratio(a, b)
if b.to_i == 0
return 0
else
Expand Down
4 changes: 2 additions & 2 deletions Resource_Info/views/index.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ td {
<th>Limit</th>
<th>Usage</th>
<th>Available</th>
<th>Rate</th>
<th>Ratio</th>
</tr>
<% @resource_info[i].each do |d| %>
<tr>
Expand All @@ -56,7 +56,7 @@ td {
<td><%= num_with_commas(avail) %></td>
<td>
<div class="graph">
<strong class="bar_<%= color(rate(usage, limit)) %>" style="width: <%= rate(usage, limit) %>%;"><%= rate(usage, limit) %>%</strong>
<strong class="bar_<%= color(ratio(usage, limit)) %>" style="width: <%= ratio(usage, limit) %>%;"><%= ratio(usage, limit) %>%</strong>
</div>
</td>
<% else %>
Expand Down
16 changes: 8 additions & 8 deletions misc/dashboard/fugaku_info/_accounting.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<th colspan="4">Resource (NH)</th>
</tr>
<tr>
<th>Limit</th><th>Usage</th><th>Avail.</th><th>Rate</th>
<th>Limit</th><th>Usage</th><th>Avail.</th><th>Rate</th>
<th>Limit</th><th>Usage</th><th>Avail.</th><th>Rate</th>
<th>Limit</th><th>Usage</th><th>Avail.</th><th>Ratio</th>
<th>Limit</th><th>Usage</th><th>Avail.</th><th>Ratio</th>
<th>Limit</th><th>Usage</th><th>Avail.</th><th>Ratio</th>
</tr>
<%- groups = `groups`.split - ["f-op"] -%>
<%- groups.each do |group_name| -%>
Expand All @@ -42,7 +42,7 @@
<td align="right"><%= disk_info[i].avail %></td>
<td>
<div class="graph">
<strong class="bar_<%= dashboard_color(disk_info[i].rate) %>" style="width: <%= disk_info[i].rate %>%;"><%= disk_info[i].rate %>%</strong>
<strong class="bar_<%= dashboard_color(disk_info[i].ratio) %>" style="width: <%= disk_info[i].ratio %>%;"><%= disk_info[i].ratio %>%</strong>
</div>
</td>
<%- else -%>
Expand All @@ -55,7 +55,7 @@
<td align="right"><%= inode_info[i].avail %></td>
<td>
<div class="graph">
<strong class="bar_<%= dashboard_color(inode_info[i].rate) %>" style="width: <%= inode_info[i].rate %>%;"><%= inode_info[i].rate %>%</strong>
<strong class="bar_<%= dashboard_color(inode_info[i].ratio) %>" style="width: <%= inode_info[i].ratio %>%;"><%= inode_info[i].ratio %>%</strong>
</div>
</td>
<%- else -%>
Expand All @@ -69,7 +69,7 @@
<td align="right" rowspan="<%= num_volumes %>"><%= resource_info.avail %></td>
<td rowspan="<%= num_volumes %>">
<div class="graph">
<strong class="bar_<%= dashboard_color(resource_info.rate) %>" style="width: <%= resource_info.rate %>%;"><%= resource_info.rate %>%</strong>
<strong class="bar_<%= dashboard_color(resource_info.ratio) %>" style="width: <%= resource_info.ratio %>%;"><%= resource_info.ratio %>%</strong>
</div>
</td>
<%- else -%>
Expand All @@ -93,15 +93,15 @@
<td align="right"><%= home_disk_info.avail %></td>
<td>
<div class="graph">
<strong class="bar_<%= dashboard_color(home_disk_info.rate) %>" style="width: <%= home_disk_info.rate %>%;"><%= home_disk_info.rate %>%</strong>
<strong class="bar_<%= dashboard_color(home_disk_info.ratio) %>" style="width: <%= home_disk_info.ratio %>%;"><%= home_disk_info.ratio %>%</strong>
</div>
</td>
<td align="right"><%= home_inode_info.limit %></td>
<td align="right"><%= home_inode_info.usage %></td>
<td align="right"><%= home_inode_info.avail %></td>
<td>
<div class="graph">
<strong class="bar_<%= dashboard_color(home_inode_info.rate) %>" style="width: <%= home_inode_info.rate %>%;"><%= home_inode_info.rate %>%</strong>
<strong class="bar_<%= dashboard_color(home_inode_info.ratio) %>" style="width: <%= home_inode_info.ratio %>%;"><%= home_inode_info.ratio %>%</strong>
</div>
</td>
<td> - </td><td> - </td><td> - </td><td> - </td>
Expand Down
16 changes: 8 additions & 8 deletions misc/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
ACC_GROUP_DIR = ACC_DIR + "group/"
ACC_HOME_DIR = ACC_DIR + "home/"
APP_CACHE_DIR = SYS_OOD_DIR + "app/"
Resource_info = Struct.new(:limit, :usage, :avail, :rate)
Disk_info = Struct.new(:volume, :limit, :usage, :avail, :rate)
Resource_info = Struct.new(:limit, :usage, :avail, :ratio)
Disk_info = Struct.new(:volume, :limit, :usage, :avail, :ratio)
NOT_DEFINED = -1
NOT_USED = -1
$attr = ""
Expand Down Expand Up @@ -704,8 +704,8 @@ def dashboard_resource(group_name)
limit = i[3].to_i/3600
usage = i[7].to_i/3600
avail = i[6].to_i/3600
rate = ((usage * 100) / limit).round
return Resource_info.new(num_with_commas(limit), num_with_commas(usage), num_with_commas(avail), rate)
ratio = ((usage * 100) / limit).round
return Resource_info.new(num_with_commas(limit), num_with_commas(usage), num_with_commas(avail), ratio)
end
end
end
Expand All @@ -729,8 +729,8 @@ def _disk_info(file, group_name)
limit = i[3].to_i
usage = i[4].to_i
avail = i[5].to_i
rate = ((usage * 100) / limit).round
info.push(Disk_info.new(volume, num_with_commas(limit), num_with_commas(usage), num_with_commas(avail), rate))
ratio = ((usage * 100) / limit).round
info.push(Disk_info.new(volume, num_with_commas(limit), num_with_commas(usage), num_with_commas(avail), ratio))
end
end
end
Expand Down Expand Up @@ -776,8 +776,8 @@ def _home_info(file)
limit = i[3].to_i
usage = i[4].to_i
avail = i[5].to_i
rate = ((usage * 100) / limit).round
return Disk_info.new(volume, num_with_commas(limit), num_with_commas(usage), num_with_commas(avail), rate)
ratio = ((usage * 100) / limit).round
return Disk_info.new(volume, num_with_commas(limit), num_with_commas(usage), num_with_commas(avail), ratio)
end
end

Expand Down

0 comments on commit 797030b

Please sign in to comment.