Create more documentation (#7627)

* Documentation, format class, no modification.
This commit is contained in:
frytimo
2025-11-18 21:33:07 -04:00
committed by GitHub
parent e619c97ce6
commit adfc4cc469
104 changed files with 24461 additions and 21721 deletions

View File

@@ -31,6 +31,11 @@
*/
class bsd_system_information extends system_information {
/**
* Returns the number of CPU cores available on the system.
*
* @return int The number of CPU cores.
*/
public function get_cpu_cores(): int {
$result = shell_exec("dmesg | grep -i --max-count 1 CPUs | sed 's/[^0-9]*//g'");
$cpu_cores = trim($result);
@@ -38,6 +43,12 @@ class bsd_system_information extends system_information {
}
//get the CPU details
/**
* Returns the current CPU usage percentage.
*
* @return float The current CPU usage percentage.
*/
public function get_cpu_percent(): float {
$result = shell_exec('ps -A -o pcpu');
$percent_cpu = 0;
@@ -49,10 +60,20 @@ class bsd_system_information extends system_information {
return $percent_cpu;
}
/**
* Returns the system uptime in seconds.
*
* @return string The system uptime in seconds.
*/
public function get_uptime() {
return shell_exec('uptime');
}
/**
* Returns the current CPU usage percentage per core.
*
* @return array An associative array where keys are core indices and values are their respective CPU usage percentages.
*/
public function get_cpu_percent_per_core(): array {
static $last = [];
$results = [];
@@ -94,11 +115,11 @@ class bsd_system_information extends system_information {
}
/**
* Returns the current network speed for a given interface.
*
* @staticvar array $last
* @param string $interface
* @return array
* @depends FreeBSD Version 12
* @param string $interface The network interface to query (default: 'em0')
*
* @return array An array containing the current receive and transmit speeds in bytes per second.
*/
public function get_network_speed(string $interface = 'em0'): array {
static $last = [];