Changeset 72b5805e
- Timestamp:
- Oct 19, 2022, 3:11:43 PM (18 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- d1abc63c
- Parents:
- 77de429
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/device/cpu.cfa
r77de429 r72b5805e 359 359 int idxs = count_cache_indexes(); 360 360 361 // Do we actually have a cache? 362 if(idxs == 0) { 363 // if not just fake the data structure, it makes things easier. 364 cpu_info.hthrd_count = cpus_c; 365 cpu_info.llc_count = 0; 366 struct cpu_map_entry_t * entries = alloc(cpu_info.hthrd_count); 367 for(i; cpu_info.hthrd_count) { 368 entries[i].self = i; 369 entries[i].start = 0; 370 entries[i].count = cpu_info.hthrd_count; 371 entries[i].cache = 0; 372 } 373 cpu_info.llc_map = entries; 374 return; 375 } 376 361 377 // Count actual cache levels 362 378 unsigned cache_levels = 0; 363 379 unsigned llc = 0; 364 if (idxs != 0) { 365 unsigned char prev = -1u; 366 void first(unsigned idx, unsigned char level, const char * map, size_t len) { 367 /* paranoid */ verifyf(level < prev, "Index %u of cpu 0 has cache levels out of order: %u then %u", idx, (unsigned)prev, (unsigned)level); 368 llc = max(llc, level); 369 prev = level; 370 cache_levels++; 371 } 372 foreach_cacheidx(0, idxs, first); 373 } 380 381 unsigned char prev = -1u; 382 void first(unsigned idx, unsigned char level, const char * map, size_t len) { 383 /* paranoid */ verifyf(level < prev, "Index %u of cpu 0 has cache levels out of order: %u then %u", idx, (unsigned)prev, (unsigned)level); 384 llc = max(llc, level); 385 prev = level; 386 cache_levels++; 387 } 388 foreach_cacheidx(0, idxs, first); 374 389 375 390 // Read in raw data -
tests/device/cpu.cfa
r77de429 r72b5805e 117 117 unsigned find_idx() { 118 118 int idxs = count_cache_indexes(); 119 if( 0 == idxs ) return 0; 119 120 120 121 unsigned found_level = 0; … … 179 180 unsigned idx = find_idx(); 180 181 // For all procs check mapping is consistent 181 for(cpu_me; cpu_info.hthrd_count) {182 if( idx > 0 ) for(cpu_me; cpu_info.hthrd_count) { 182 183 char buf_me[32]; 183 184 size_t len_me = read_cpuidxinfo_into(cpu_me, idx, "shared_cpu_list", buf_me, 32);
Note: See TracChangeset
for help on using the changeset viewer.