Header file clean up.
Remove runtime.h from object.h.
Move TypeStaticIf to its own header file to avoid bringing utils.h into
allocator.h.
Move Array::DataOffset into -inl.h as it now has a utils.h dependency.
Fix include issues arising from this.
Change-Id: I4605b1aa4ff5f8dc15706a0132e15df03c7c8ba0
diff --git a/runtime/base/allocator.cc b/runtime/base/allocator.cc
index 64cdbbf..f67616e 100644
--- a/runtime/base/allocator.cc
+++ b/runtime/base/allocator.cc
@@ -25,10 +25,6 @@
namespace art {
-Atomic<uint64_t> TrackedAllocators::bytes_used_[kAllocatorTagCount];
-Atomic<uint64_t> TrackedAllocators::max_bytes_used_[kAllocatorTagCount];
-Atomic<uint64_t> TrackedAllocators::total_bytes_used_[kAllocatorTagCount];
-
class MallocAllocator FINAL : public Allocator {
public:
explicit MallocAllocator() {}
@@ -76,13 +72,19 @@
return &g_noop_allocator;
}
-void TrackedAllocators::Dump(std::ostream& os) {
+namespace TrackedAllocators {
+
+Atomic<size_t> g_bytes_used[kAllocatorTagCount];
+volatile size_t g_max_bytes_used[kAllocatorTagCount];
+Atomic<uint64_t> g_total_bytes_used[kAllocatorTagCount];
+
+void Dump(std::ostream& os) {
if (kEnableTrackingAllocator) {
os << "Dumping native memory usage\n";
for (size_t i = 0; i < kAllocatorTagCount; ++i) {
- uint64_t bytes_used = bytes_used_[i].LoadRelaxed();
- uint64_t max_bytes_used = max_bytes_used_[i].LoadRelaxed();
- uint64_t total_bytes_used = total_bytes_used_[i].LoadRelaxed();
+ uint64_t bytes_used = g_bytes_used[i].LoadRelaxed();
+ uint64_t max_bytes_used = g_max_bytes_used[i];
+ uint64_t total_bytes_used = g_total_bytes_used[i].LoadRelaxed();
if (total_bytes_used != 0) {
os << static_cast<AllocatorTag>(i) << " active=" << bytes_used << " max="
<< max_bytes_used << " total=" << total_bytes_used << "\n";
@@ -91,4 +93,6 @@
}
}
+} // namespace TrackedAllocators
+
} // namespace art