#ifndef HEAP_H #define HEAP_H #include #include #define NUM_HEAPS 4 /** * A structure to represent a singly linked list node */ typedef struct node_s { void *data; /**< pointer to the actual data */ struct node_s *next; /**< pointer to the next item of the list */ } NODE; /** * A structure to represent a maptable node * * Heaps contain */ typedef struct maptable_node_s { unsigned int size; /**< the size of the blocks of the fixed list */ NODE *fixed_list_head; /**< pointer to the head node of the fixed list */ struct maptable_node_s *next; /**< pointer to the next node of the maptable */ } MAPTABLE_NODE; typedef struct dmmstats_s { uint32_t max_mem_allocated; /**< maximum total memory allocated */ uint32_t max_mem_requested; /**< maximum total memory requested */ uint32_t mem_allocated; /**< total memory currently allocated */ uint32_t mem_requested; /**< total memory currently requested */ uint32_t live_objects; /**< number of live objects */ uint32_t read_mem_accesses; /**< number of read accesses */ uint32_t write_mem_accesses; /**< number of write accesses */ uint32_t num_malloc; /**< number of malloc()'s served */ uint32_t num_free; /**< number of free()'s served */ } dmmstats_t; typedef struct dmmknobs_s { uint32_t maxCoalesceSize; uint32_t minSplitSize; float empty_threshold; uint32_t percentage; char frag_state; //FIXME It was in the old code to refresh the frag check } dmmknobs_t; typedef struct heap_s { MAPTABLE_NODE *maptable_head; NODE *free_list_head; NODE *rov_ptr; uint64_t num_objects; dmmstats_t dmm_stats; dmmknobs_t dmm_knobs; pthread_mutex_t mutex; } heap_t; typedef struct allocator_s { heap_t heaps[NUM_HEAPS]; char *border_ptr; } allocator_t; #endif /* HEAP_H */