25 #ifndef _JIT_COMPILER2_MEMORY_MEMSTAT
26 #define _JIT_COMPILER2_MEMORY_MEMSTAT
30 #if defined(ENABLE_STATISTICS)
31 #define ENABLE_MEMORY_MANAGER_STATISTICS
34 #if defined(ENABLE_MEMORY_MANAGER_STATISTICS)
45 STAT_DECLARE_SUM_GROUP(comp2_allocated)
46 STAT_DECLARE_SUM_GROUP(comp2_deallocated)
47 STAT_DECLARE_SUM_GROUP(comp2_max)
49 inline unordered_map<
void*,std::
size_t>& mem_map() {
50 static unordered_map<void*,std::size_t> mm;
56 static std::size_t t = 0;
61 inline const char* get_class_name() {
67 inline StatVar<std::size_t,0>& get_comp2_allocated() {
73 inline StatVar<std::
size_t,0>& get_comp2_deallocated() {
74 STAT_REGISTER_GROUP_VAR(std::size_t,comp2_deallocated,0,get_class_name<T>(),get_class_name<T>(),comp2_deallocated)
79 inline StatVar<std::
size_t,0>& get_comp2_max() {
85 inline
void stat_new(std::
size_t size,
void* p) {
86 current_heap_size<T>()+=size;
87 get_comp2_allocated<T>()+=size;
88 get_comp2_max<T>().
max(current_heap_size<T>());
92 inline void stat_delete(
void* p) {
93 std::size_t size = mem_map()[p];
94 current_heap_size<T>() -= size;
95 get_comp2_deallocated<T>() += size;
104 #define MM_STAT(x) do { x; } while(0)
106 #define MM_CLASS_NAME(x) \
109 inline const char* get_class_name<x>() { \
114 #define MM_MAKE_NAME(x) \
117 namespace compiler2 { \
126 #define MM_CLASS_NAME(x)
127 #define MM_MAKE_NAME(x)
JNIEnv jthread jobject jclass jlong size
This file contains the statistics framework.
#define STAT_REGISTER_GROUP_VAR(type, var, init, name, description, group)
Register an statistics variable and add it to a group.
std::size_t & current_heap_size()