Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/device/cpu.cfa

    r72b5805e r032234bd  
    359359                int idxs = count_cache_indexes();
    360360
    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 
    377361                // Count actual cache levels
    378362                unsigned cache_levels = 0;
    379363                unsigned llc = 0;
    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);
     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                }
    389374
    390375                // Read in raw data
Note: See TracChangeset for help on using the changeset viewer.