mirror of
https://github.com/webmin/webmin.git
synced 2026-02-08 00:12:14 +00:00
47 lines
1.2 KiB
Perl
Executable File
47 lines
1.2 KiB
Perl
Executable File
#!/usr/local/bin/perl
|
|
# index_cpu.cgi
|
|
|
|
require './proc-lib.pl';
|
|
&ui_print_header(undef, $text{'index_title'}, "", "cpu", !$no_module_config, 1);
|
|
|
|
# Show CPU load and type
|
|
&index_links("cpu");
|
|
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";
|
|
if (@c >= 5) {
|
|
print "<tr> <td><b>$text{'index_cpuname'}</b></td>\n";
|
|
print "<td>$c[4] ($c[3] MHz)</td> </tr>\n";
|
|
}
|
|
}
|
|
print "</table><br>\n";
|
|
}
|
|
|
|
print &ui_columns_start([ $text{'pid'}, $text{'owner'},
|
|
$text{'cpu'}, $text{'command'} ], 100);
|
|
@procs = sort { $b->{'cpu'} <=> $a->{'cpu'} } &list_processes();
|
|
@procs = grep { &can_view_process($_->{'user'}) } @procs;
|
|
foreach $pr (@procs) {
|
|
$p = $pr->{'pid'};
|
|
local @cols;
|
|
if (&can_edit_process($pr->{'user'})) {
|
|
push(@cols, "<a href=\"edit_proc.cgi?$p\">$p</a>");
|
|
}
|
|
else {
|
|
push(@cols, $p);
|
|
}
|
|
push(@cols, $pr->{'user'});
|
|
push(@cols, $pr->{'cpu'});
|
|
push(@cols, &html_escape(cut_string($pr->{'args'})));
|
|
print &ui_columns_row(\@cols);
|
|
}
|
|
print &ui_columns_end();
|
|
|
|
&ui_print_footer("/", $text{'index'});
|
|
|