optinal load_avg to fix
This commit is contained in:
21
user/sysinfo.c
Normal file
21
user/sysinfo.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "kernel/param.h"
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "user/user.h"
|
||||
|
||||
int main() {
|
||||
struct sysinfo info;
|
||||
|
||||
if (sysinfo(&info) < 0) {
|
||||
printf("sysinfo: failed to retrieve system information\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf("System Information:\n");
|
||||
printf(" Free Memory: %d bytes\n", info.freemem);
|
||||
printf(" Number of Processes: %d\n", info.nproc);
|
||||
printf(" Unused Process Slots: %d\n", info.unused_proc_num);
|
||||
printf(" Load Average: %d\n", info.load_avg);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
Reference in New Issue
Block a user