for (auto &p : type_map) {
std::string n = ceph_demangle(p.second.type_name);
stats_t &s = (*by_type)[n];
+#if defined(WITH_SEASTAR) && !defined(WITH_ALIEN)
s.bytes = 0;
s.items = 0;
for (size_t i = 0 ; i < num_shards; ++i) {
s.bytes += p.second.shards[i].items * p.second.item_size;
s.items += p.second.shards[i].items;
}
+#else
+ s.bytes = p.second.items * p.second.item_size;
+ s.items = p.second.items;
+#endif
}
}
}
struct type_t {
const char *type_name;
size_t item_size;
+#if defined(WITH_SEASTAR) && !defined(WITH_ALIEN)
struct type_shard_t {
ceph::atomic<ssize_t> items = {0}; // signed
char __padding[128 - sizeof(ceph::atomic<ssize_t>)];
} __attribute__ ((aligned (128)));
+ static_assert(sizeof(type_shard_t) == 128,
+ "type_shard_t should be cacheline-sized");
type_shard_t shards[num_shards];
+#else
+// XXX: consider dropping this case for classic with perf tests
+ ceph::atomic<ssize_t> items = {0}; // signed
+#endif
};
-static_assert(sizeof(type_t::type_shard_t) == 128,
- "type_shard_t should be cacheline-sized");
-
struct type_info_hash {
std::size_t operator()(const std::type_info& k) const {
return k.hash_code();
shard.bytes += total;
shard.items += n;
if (type) {
+#if defined(WITH_SEASTAR) && !defined(WITH_ALIEN)
type->shards[shid].items += n;
+#else
+ type->items += n;
+#endif
}
T* r = reinterpret_cast<T*>(new char[total]);
return r;
shard.bytes -= total;
shard.items -= n;
if (type) {
+#if defined(WITH_SEASTAR) && !defined(WITH_ALIEN)
type->shards[shid].items -= n;
+#else
+ type->items -= n;
+#endif
}
delete[] reinterpret_cast<char*>(p);
}
shard.bytes += total;
shard.items += n;
if (type) {
+#if defined(WITH_SEASTAR) && !defined(WITH_ALIEN)
type->shards[shid].items += n;
+#else
+ type->items += n;
+#endif
}
char *ptr;
int rc = ::posix_memalign((void**)(void*)&ptr, align, total);
shard.bytes -= total;
shard.items -= n;
if (type) {
+#if defined(WITH_SEASTAR) && !defined(WITH_ALIEN)
type->shards[shid].items -= n;
+#else
+ type->items -= n;
+#endif
}
aligned_free(p);
}