Use proper UI functions for CPU and RAM modes

This commit is contained in:
Jamie Cameron
2023-08-31 22:39:45 -07:00
parent a133cdfdef
commit 2db507e5e8
3 changed files with 26 additions and 23 deletions

View File

@@ -10,23 +10,22 @@ if (defined(&get_cpu_info)) {
print "<table>\n";
@c = &get_cpu_info();
if (@c) {
print "<tr> <td><b>$text{'index_loadname'}</b></td>\n";
print "<td>",&text('index_loadnums',
"<tt>$c[0]</tt>", "<tt>$c[1]</tt>", "<tt>$c[2]</tt>"),
"</td> </tr>\n";
print &ui_table_start(undef, undef, 2);
print &ui_table_row($text{'index_loadname'},
&text('index_loadnums',
"<tt>$c[0]</tt>", "<tt>$c[1]</tt>", "<tt>$c[2]</tt>"));
if (@c >= 5) {
print "<tr> <td><b>$text{'index_cpuname'}</b></td>\n";
print "<td>$c[4]\n";
my $cpu = $c[4]."\n";
if ($c[4] !~ /Hz/) {
print "($c[3] MHz)\n";
$cpu .= "($c[3] MHz)\n";
}
if ($c[7]) {
print ", $c[7] cores\n";
$cpu .= ", $c[7] cores\n";
}
print "</td> </tr>\n";
print &ui_table_row($text{'index_cpuname'}, $cpu);
}
print &ui_table_end(),"<p>\n";
}
print "</table><br>\n";
}
print &ui_columns_start([ $text{'pid'}, $text{'owner'},

View File

@@ -9,17 +9,20 @@ if (defined(&get_memory_info)) {
@m = &get_memory_info();
if (@m) {
$msg = $m[4] ? 'index_mem3' : 'index_mem2';
print "<p>";
print &text($msg, &nice_size($m[0]*1024),
&nice_size($m[1]*1024),
&nice_size($m[4]*1024)),"\n";
print &ui_table_start(undef, undef, 2);
print &ui_table_row($text{'index_memreal'},
&text($m[4] ? 'index_memtfc' : 'index_memtf',
&nice_size($m[0]*1024),
&nice_size($m[1]*1024),
&nice_size($m[4]*1024)));
if ($m[5]) {
print "&nbsp;&nbsp;",
&text('index_burst', &nice_size($m[5]*1024));
print &ui_table_row($text{'index_memburst'},
&nice_size($m[5]*1024));
}
print "&nbsp;&nbsp;",
&text('index_swap2', &nice_size($m[2]*1024),
&nice_size($m[3]*1024)),"<p>\n";
print &ui_table_row($text{'index_memswap'},
&text('index_memtf', &nice_size($m[2]*1024),
&nice_size($m[3]*1024)));
print &ui_table_end(),"<p>\n";
}
}
print &ui_columns_start([

View File

@@ -8,10 +8,11 @@ index_search=Search
index_zone=Zone
index_run=Run..
index_return=process list
index_mem2=<b>Real memory:</b> $1 total / $2 free
index_mem3=<b>Real memory:</b> $1 total / $2 free / $3 cached
index_swap2=<b>Swap space:</b> $1 total / $2 free
index_burst=<b>Burstable memory:</b> $1 total
index_memreal=Real memory:
index_memswap=Swap space:
index_memburst=Burstable memory:
index_memtf=$1 total / $2 free
index_memtfc=$1 total / $2 free / $3 cached
index_loadname=CPU load averages:
index_loadnums=$1 (1 mins) , $2 (5 mins) , $3 (15 mins)
index_cpuname=CPU type: