You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.4 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Author: David Robert Nadeau
  3. * Site: http://NadeauSoftware.com/
  4. * License: Creative Commons Attribution 3.0 Unported License
  5. * http://creativecommons.org/licenses/by/3.0/deed.en_US
  6. */
  7. #ifndef DEBUG
  8. size_t getPeakRSS( );
  9. size_t getCurrentRSS( );
  10. #else
  11. #if defined(_WIN32)
  12. #include <windows.h>
  13. #include <psapi.h>
  14. #elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__))
  15. #include <unistd.h>
  16. #include <sys/resource.h>
  17. #if defined(__APPLE__) && defined(__MACH__)
  18. #include <mach/mach.h>
  19. #elif (defined(_AIX) || defined(__TOS__AIX__)) || (defined(__sun__) || defined(__sun) || defined(sun) && (defined(__SVR4) || defined(__svr4__)))
  20. #include <fcntl.h>
  21. #include <procfs.h>
  22. #elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__)
  23. #include <stdio.h>
  24. #endif
  25. #else
  26. #error "Cannot define getPeakRSS( ) or getCurrentRSS( ) for an unknown OS."
  27. #endif
  28. /**
  29. * Returns the peak (maximum so far) resident set size (physical
  30. * memory use) measured in bytes, or zero if the value cannot be
  31. * determined on this OS.
  32. */
  33. size_t getPeakRSS( );
  34. /**
  35. * Returns the current resident set size (physical memory use) measured
  36. * in bytes, or zero if the value cannot be determined on this OS.
  37. */
  38. size_t getCurrentRSS( );
  39. #endif // DEBUG