change names
diff --git a/xbyak/xbyak_util.h b/xbyak/xbyak_util.h index 1baa4ad..065e11c 100644 --- a/xbyak/xbyak_util.h +++ b/xbyak/xbyak_util.h
@@ -808,34 +808,32 @@ class CpuMask { typedef std::set<uint32_t> IntSet; - IntSet v_; + IntSet indices_; public: typedef IntSet::const_iterator const_iterator; typedef IntSet::iterator iterator; - CpuMask() : v_() {} - size_t size() const { return v_.size(); } + CpuMask() : indices_() {} + size_t size() const { return indices_.size(); } void append(uint32_t idx) { - v_.insert(idx); + indices_.insert(idx); } - iterator begin() { return v_.begin(); } - iterator end() { return v_.end(); } - const_iterator begin() const { return v_.begin(); } - const_iterator end() const { return v_.end(); } - void put(const char *msg = nullptr) const + iterator begin() { return indices_.begin(); } + iterator end() { return indices_.end(); } + const_iterator begin() const { return indices_.begin(); } + const_iterator end() const { return indices_.end(); } + void put(const char *label = nullptr) const { - if (msg) printf("%s: ", msg); + if (label) printf("%s: ", label); std::string s; s.reserve(size() * 3); - uint32_t maxi = 0; for (const auto& i : *this) { char buf[16]; snprintf(buf, sizeof(buf), "%d ", i); s += buf; - if (i > maxi) maxi = i; } - if (maxi+1 == size()) { - printf("all\n"); + if (size() > 2 && *indices_.rbegin() - *begin() + 1 == size()) { + printf("[%u %u]\n", *begin(), *indices_.rbegin()); } else { printf("%s\n", s.c_str()); } @@ -857,21 +855,21 @@ // Set of logical CPU indices sharing this cache CpuMask sharedCpuIndices; - void put(const char *msg = nullptr) const + void put(const char *label = nullptr) const { - if (msg) printf("%s: ", msg); - printf("size=%8u, assoc.=%2u, sharedIdx=", size, associativity); + if (label) printf("%s: ", label); + printf("size=%9u, assoc.=%2u, sharedIdx=", size, associativity); sharedCpuIndices.put(); } }; struct LogicalCpu { LogicalCpu() - : cache() + : caches() , coreType(Unknown) { } - CpuCache cache[CACHE_TYPE_NUM]; + CpuCache caches[CACHE_TYPE_NUM]; CoreType coreType; // for hybrid systems // Logical CPU index in the system (0 to N-1) @@ -880,13 +878,13 @@ // uint32_t physicalId; // Physical core index within the socket // uint32_t coreId; - void put(const char *msg = nullptr) const + void put(const char *label = nullptr) const { - if (msg) printf("%s: ", msg); + if (label) printf("%s: ", label); printf("%s\n", coreType == Pcore ? "Pcore" : coreType == Ecore ? "Ecore" : "Standard"); static const char msgTbl[][4] = { "L1i", "L1d", "L2 ", "L3 " }; for (int i = 0; i < CACHE_TYPE_NUM; i++) { - cache[i].put(msgTbl[i]); + caches[i].put(msgTbl[i]); } } }; @@ -920,9 +918,9 @@ // Whether this is a hybrid system bool isHybrid() const { return isHybrid_; } - void put(const char *msg = nullptr) const + void put(const char *label = nullptr) const { - if (msg) printf("%s: ", msg); + if (label) printf("%s: ", label); printf("isHybrid=%d, logicalCpuNum=%zu\n", isHybrid_ ? 1 : 0, logicalCpus_.size()); for (size_t i = 0; i < logicalCpus_.size(); i++) { char buf[32]; @@ -1038,11 +1036,11 @@ } for (const auto& i : mask) { assert(i < cpuSet.logicalCpus_.size()); - cpuSet.logicalCpus_[i].cache[type].size = cache.CacheSize; -// cpuSet.logicalCpus_[i].cache[type].lineSize = cache.LineSize; - cpuSet.logicalCpus_[i].cache[type].associativity = cache.Associativity; -// cpuSet.logicalCpus_[i].cache[type].isShared = mask.size() > 1; - cpuSet.logicalCpus_[i].cache[type].sharedCpuIndices = mask; + cpuSet.logicalCpus_[i].caches[type].size = cache.CacheSize; +// cpuSet.logicalCpus_[i].caches[type].lineSize = cache.LineSize; + cpuSet.logicalCpus_[i].caches[type].associativity = cache.Associativity; +// cpuSet.logicalCpus_[i].caches[type].isShared = mask.size() > 1; + cpuSet.logicalCpus_[i].caches[type].sharedCpuIndices = mask; } } p += entry.Size; @@ -1206,9 +1204,9 @@ // Set cache information if (cacheType < CACHE_TYPE_NUM) { - logicalCpu.cache[cacheType].size = cacheSize; - logicalCpu.cache[cacheType].associativity = associativity; - logicalCpu.cache[cacheType].sharedCpuIndices = sharedCpuIndices; + logicalCpu.caches[cacheType].size = cacheSize; + logicalCpu.caches[cacheType].associativity = associativity; + logicalCpu.caches[cacheType].sharedCpuIndices = sharedCpuIndices; } } }