diff options
Diffstat (limited to 'base/sys_info_posix.cc')
-rw-r--r-- | base/sys_info_posix.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/base/sys_info_posix.cc b/base/sys_info_posix.cc index 9ea3cab..b46d1b4 100644 --- a/base/sys_info_posix.cc +++ b/base/sys_info_posix.cc @@ -24,7 +24,7 @@ namespace base { int SysInfo::NumberOfProcessors() { // It seems that sysconf returns the number of "logical" processors on both // mac and linux. So we get the number of "online logical" processors. - long res = sysconf(_SC_NPROCESSORS_ONLN); + static long res = sysconf(_SC_NPROCESSORS_ONLN); if (res == -1) { NOTREACHED(); return 1; @@ -48,7 +48,7 @@ int64 SysInfo::AmountOfPhysicalMemory() { NOTREACHED(); return 0; } - + return static_cast<int64>(hostinfo.max_mem); #else long pages = sysconf(_SC_PHYS_PAGES); @@ -134,4 +134,13 @@ size_t SysInfo::VMAllocationGranularity() { return getpagesize(); } +// static +void SysInfo::CacheSysInfo() { + // Due to startup time concerns [premature optimization?] we only cache values + // from functions we know to be called in the renderer & fail when the sandbox + // is enabled. + NumberOfProcessors(); + +} + } // namespace base |