diff --git a/CHANGELOG.md b/CHANGELOG.md index b17b587ee..d7f0ae1c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Fix the printing of the bottom button row in the form column table * Fix to recommend Perl `Sys::Syslog` module #2557 * Fix to avoid using short hostname in HTTPS redirects when an FQDN is available +* Fix to query specific fields in FreeBSD memory stats collection, cutting CPU use by 80% * Add a complete overhaul of `var_dump` subroutine, which is now fully portable * Update the Authentic theme to the latest version with various fixes: - Fix the text color when reading email in the Read User Mail module [webmin#2555](https://github.com/webmin/webmin/issues/2555) diff --git a/proc/freebsd-lib.pl b/proc/freebsd-lib.pl index 861006892..630527e56 100755 --- a/proc/freebsd-lib.pl +++ b/proc/freebsd-lib.pl @@ -101,7 +101,16 @@ ioctl($ttyfh, 536900705, 0); sub get_memory_info { my $sysctl = {}; -my $sysctl_output = &backquote_command("/sbin/sysctl -a 2>/dev/null"); +# Get only the specific values we need not all with -a +my @needed = qw( + hw.physmem + hw.pagesize + vm.stats.vm.v_inactive_count + vm.stats.vm.v_cache_count + vm.stats.vm.v_free_count + ); +my $sysctl_output = &backquote_command("/sbin/sysctl " . + join(" ", @needed) . " 2>/dev/null"); return ( ) if ($?); foreach my $line (split(/\n/, $sysctl_output)) { if ($line =~ m/^([^:]+):\s+(.+)\s*$/s) {