summaryrefslogtreecommitdiffstats
path: root/runtime/base/allocator.cc
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2014-10-08 11:47:24 -0700
committerIan Rogers <irogers@google.com>2014-10-08 11:57:59 -0700
commit7e70b002c4552347ed1af8c002a0e13f08864f20 (patch)
tree79d5ee5444a5be70130d9a75dd51831c4b15687b /runtime/base/allocator.cc
parentedc34c88b8f8abd04f9c4668787403608cf0b2d4 (diff)
downloadart-7e70b002c4552347ed1af8c002a0e13f08864f20.zip
art-7e70b002c4552347ed1af8c002a0e13f08864f20.tar.gz
art-7e70b002c4552347ed1af8c002a0e13f08864f20.tar.bz2
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
Diffstat (limited to 'runtime/base/allocator.cc')
-rw-r--r--runtime/base/allocator.cc20
1 files changed, 12 insertions, 8 deletions
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 @@ Allocator* Allocator::GetNoopAllocator() {
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 @@ void TrackedAllocators::Dump(std::ostream& os) {
}
}
+} // namespace TrackedAllocators
+
} // namespace art