cacheSize = std::max(cacheSize, ( size_t) sysconf(_SC_LEVEL4_CACHE_SIZE));
#endif
-#if defined(HOST_ARM64)
+#if defined(TARGET_LINUX) && !defined(HOST_ARM)
if (cacheSize == 0)
{
+ //
+ // Fallback to retrieve cachesize via /sys/.. if sysconf was not available
+ // for the platform. Currently musl and arm64 should be only cases to use
+ // this method to determine cache size.
+ //
size_t size;
if (ReadMemoryValueFromFile("/sys/devices/system/cpu/cpu0/cache/index0/size", &size))
if (ReadMemoryValueFromFile("/sys/devices/system/cpu/cpu0/cache/index4/size", &size))
cacheSize = std::max(cacheSize, size);
}
+#endif
+#if defined(HOST_ARM64)
if (cacheSize == 0)
{
// It is currently expected to be missing cache size info
cacheSize = std::max(cacheSize, (size_t)sysconf(_SC_LEVEL4_CACHE_SIZE));
#endif
-#if defined(HOST_ARM64)
- if(cacheSize == 0)
+#if defined(TARGET_LINUX) && !defined(HOST_ARM)
+ if (cacheSize == 0)
{
+ //
+ // Fallback to retrieve cachesize via /sys/.. if sysconf was not available
+ // for the platform. Currently musl and arm64 should be only cases to use
+ // this method to determine cache size.
+ //
size_t size;
if(ReadMemoryValueFromFile("/sys/devices/system/cpu/cpu0/cache/index0/size", &size))
if(ReadMemoryValueFromFile("/sys/devices/system/cpu/cpu0/cache/index4/size", &size))
cacheSize = std::max(cacheSize, size);
}
+#endif
- if(cacheSize == 0)
+#if defined(HOST_ARM64)
+ if (cacheSize == 0)
{
// It is currently expected to be missing cache size info
//