mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
CPUCache (Windows): detect cache line size
This commit is contained in:
@@ -14,6 +14,7 @@ typedef struct FFCPUCache
|
||||
{
|
||||
uint32_t size;
|
||||
uint32_t num;
|
||||
uint32_t lineSize;
|
||||
FFCPUCacheType type;
|
||||
} FFCPUCache;
|
||||
|
||||
@@ -24,13 +25,13 @@ typedef struct FFCPUCacheResult
|
||||
|
||||
const char* ffDetectCPUCache(FFCPUCacheResult* result);
|
||||
|
||||
static inline FFCPUCache* ffCPUCacheAddItem(FFCPUCacheResult* result, uint32_t level, uint32_t size, FFCPUCacheType type)
|
||||
static inline FFCPUCache* ffCPUCacheAddItem(FFCPUCacheResult* result, uint32_t level, uint32_t size, uint32_t lineSize, FFCPUCacheType type)
|
||||
{
|
||||
FFlist* cacheLevel = &result->caches[level - 1];
|
||||
|
||||
FF_LIST_FOR_EACH(FFCPUCache, item, *cacheLevel)
|
||||
{
|
||||
if (item->type == type && item->size == size)
|
||||
if (item->type == type && item->size == size && item->lineSize == lineSize)
|
||||
{
|
||||
item->num++;
|
||||
return item;
|
||||
@@ -41,6 +42,7 @@ static inline FFCPUCache* ffCPUCacheAddItem(FFCPUCacheResult* result, uint32_t l
|
||||
*item = (FFCPUCache) {
|
||||
.size = size,
|
||||
.num = 1,
|
||||
.lineSize = lineSize,
|
||||
.type = type,
|
||||
};
|
||||
return item;
|
||||
|
||||
@@ -33,8 +33,7 @@ const char* ffDetectCPUCache(FFCPUCacheResult* result)
|
||||
case CacheTrace: cacheType = FF_CPU_CACHE_TYPE_TRACE; break;
|
||||
default: __builtin_unreachable(); break;
|
||||
}
|
||||
|
||||
ffCPUCacheAddItem(result, ptr->Cache.Level, ptr->Cache.CacheSize, cacheType);
|
||||
ffCPUCacheAddItem(result, ptr->Cache.Level, ptr->Cache.CacheSize, ptr->Cache.LineSize, cacheType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -122,6 +122,7 @@ void ffGenerateCPUCacheJsonResult(FF_MAYBE_UNUSED FFCPUCacheOptions* options, yy
|
||||
case FF_CPU_CACHE_TYPE_UNIFIED: typeStr = "unified"; break;
|
||||
case FF_CPU_CACHE_TYPE_TRACE: typeStr = "trace"; break;
|
||||
}
|
||||
yyjson_mut_obj_add_uint(doc, item, "lineSize", src->lineSize);
|
||||
yyjson_mut_obj_add_str(doc, item, "type", typeStr);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user