22 lines
523 B
C
22 lines
523 B
C
#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 / 100 \n", info.load_avg);
|
|
|
|
exit(0);
|
|
}
|