35 #include "utilities/nativeCallStack.hpp" |
35 #include "utilities/nativeCallStack.hpp" |
36 |
36 |
37 // MallocSite represents a code path that eventually calls |
37 // MallocSite represents a code path that eventually calls |
38 // os::malloc() to allocate memory |
38 // os::malloc() to allocate memory |
39 class MallocSite : public AllocationSite<MemoryCounter> { |
39 class MallocSite : public AllocationSite<MemoryCounter> { |
40 private: |
|
41 MEMFLAGS _flags; |
|
42 |
|
43 public: |
40 public: |
44 MallocSite() : |
41 MallocSite() : |
45 AllocationSite<MemoryCounter>(NativeCallStack::empty_stack()), _flags(mtNone) {} |
42 AllocationSite<MemoryCounter>(NativeCallStack::empty_stack(), mtNone) {} |
46 |
43 |
47 MallocSite(const NativeCallStack& stack, MEMFLAGS flags) : |
44 MallocSite(const NativeCallStack& stack, MEMFLAGS flags) : |
48 AllocationSite<MemoryCounter>(stack), _flags(flags) {} |
45 AllocationSite<MemoryCounter>(stack, flags) {} |
49 |
46 |
50 |
47 |
51 void allocate(size_t size) { data()->allocate(size); } |
48 void allocate(size_t size) { data()->allocate(size); } |
52 void deallocate(size_t size) { data()->deallocate(size); } |
49 void deallocate(size_t size) { data()->deallocate(size); } |
53 |
50 |
54 // Memory allocated from this code path |
51 // Memory allocated from this code path |
55 size_t size() const { return peek()->size(); } |
52 size_t size() const { return peek()->size(); } |
56 // The number of calls were made |
53 // The number of calls were made |
57 size_t count() const { return peek()->count(); } |
54 size_t count() const { return peek()->count(); } |
58 MEMFLAGS flags() const { return (MEMFLAGS)_flags; } |
|
59 }; |
55 }; |
60 |
56 |
61 // Malloc site hashtable entry |
57 // Malloc site hashtable entry |
62 class MallocSiteHashtableEntry : public CHeapObj<mtNMT> { |
58 class MallocSiteHashtableEntry : public CHeapObj<mtNMT> { |
63 private: |
59 private: |