ex64.pp 886 B

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