Skip to content
Closed
Next Next commit
Logging.
  • Loading branch information
mrsharm authored and github-actions committed Apr 3, 2024
commit 48682aff5d724f20195855ae694a0c8295522fa4
10 changes: 7 additions & 3 deletions src/coreclr/gc/unix/gcenv.unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ bool ReadMemoryValueFromFile(const char* filename, uint64_t* val)
return result;
}

#define UPDATE_CACHE_SIZE_AND_LEVEL(NEW_CACHE_SIZE, NEW_CACHE_LEVEL) if (NEW_CACHE_SIZE > cacheSize) { cacheSize = NEW_CACHE_SIZE; cacheLevel = NEW_CACHE_LEVEL; }
#define UPDATE_CACHE_SIZE_AND_LEVEL(NEW_CACHE_SIZE, NEW_CACHE_LEVEL) if ((NEW_CACHE_SIZE != UINTMAX_MAX) || NEW_CACHE_SIZE > cacheSize) { cacheSize = NEW_CACHE_SIZE; cacheLevel = NEW_CACHE_LEVEL; }

static size_t GetLogicalProcessorCacheSizeFromOS()
{
Expand All @@ -809,12 +809,16 @@ static size_t GetLogicalProcessorCacheSizeFromOS()
UPDATE_CACHE_SIZE_AND_LEVEL(size, 2)
#endif
#ifdef _SC_LEVEL3_CACHE_SIZE
size = ( size_t) sysconf(_SC_LEVEL3_CACHE_SIZE);
size_t level3_dcache_size;
size = level3_dcache_size = ( size_t) sysconf(_SC_LEVEL3_CACHE_SIZE);
UPDATE_CACHE_SIZE_AND_LEVEL(size, 3)
printf("[GetLogicalProcessorCacheSizeFromOS]: size after Level3DCacheSize (%zu): %zu\n", level3_dcache_size, size);
#endif
#ifdef _SC_LEVEL4_CACHE_SIZE
size = ( size_t) sysconf(_SC_LEVEL4_CACHE_SIZE);
size_t level4_dcache_size;
size = level4_dcache_size = ( size_t) sysconf(_SC_LEVEL4_CACHE_SIZE);
UPDATE_CACHE_SIZE_AND_LEVEL(size, 4)
printf("[GetLogicalProcessorCacheSizeFromOS]: size after Level4DCacheSize (%zu): %zu\n", level4_dcache_size, size);
#endif

#if defined(TARGET_LINUX) && !defined(HOST_ARM) && !defined(HOST_X86)
Expand Down