SystemInfo.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #ifndef RUNTIME_PLATFORM_AGNOSTIC_COMMON_SYSTEMINFO
  6. #define RUNTIME_PLATFORM_AGNOSTIC_COMMON_SYSTEMINFO
  7. namespace PlatformAgnostic
  8. {
  9. class SystemInfo
  10. {
  11. class PlatformData
  12. {
  13. public:
  14. size_t totalRam;
  15. PlatformData();
  16. };
  17. static PlatformData data;
  18. public:
  19. static bool GetTotalRam(size_t *totalRam)
  20. {
  21. if (SystemInfo::data.totalRam == 0)
  22. {
  23. return false;
  24. }
  25. *totalRam = SystemInfo::data.totalRam;
  26. return true;
  27. }
  28. static bool GetMaxVirtualMemory(size_t *totalAS);
  29. };
  30. } // namespace PlatformAgnostic
  31. #endif // RUNTIME_PLATFORM_AGNOSTIC_COMMON_SYSTEMINFO