ex64.pp 964 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. program Example64;
  2. { Example to demonstrate the SysInfo function.
  3. Sysinfo is Linux-only. }
  4. {$ifdef Linux}
  5. Uses Linux;
  6. Function Mb(L : Longint) : longint;
  7. begin
  8. Mb:=L div (1024*1024);
  9. end;
  10. Var Info : TSysInfo;
  11. D,M,Secs,H : longint;
  12. {$endif}
  13. begin
  14. {$ifdef Linux}
  15. If Not SysInfo(Info) then
  16. Halt(1);
  17. With Info do
  18. begin
  19. D:=Uptime div (3600*24);
  20. UpTime:=UpTime mod (3600*24);
  21. h:=uptime div 3600;
  22. uptime:=uptime mod 3600;
  23. m:=uptime div 60;
  24. secs:=uptime mod 60;
  25. Writeln('Uptime : ',d,'days, ',h,' hours, ',m,' min, ',secs,' s.');
  26. Writeln('Loads : ',Loads[1],'/',Loads[2],'/',Loads[3]);
  27. Writeln('Total Ram : ',Mb(totalram),'Mb.');
  28. Writeln('Free Ram : ',Mb(freeram),'Mb.');
  29. Writeln('Shared Ram : ',Mb(sharedram),'Mb.');
  30. Writeln('Buffer Ram : ',Mb(bufferram),'Mb.');
  31. Writeln('Total Swap : ',Mb(totalswap),'Mb.');
  32. Writeln('Free Swap : ',Mb(freeswap),'Mb.');
  33. end;
  34. {$endif}
  35. end.