library/src/mmap/BP-MMapSlabAllocator.cc
// Iterate through all items in the allocator and run checks on each to determine
// the status of our allocator.
Iterate through all items in the allocator and run checks on each to determine
the status of our allocator.
Iterate through all items in the allocator and run checks on each to determine the status of our allocator .
BP_SLAB_ALLOCATOR_ITER_LOOP_ALL(allocator)
	{
		if(BP_FLAG_IS_SET(allocator->curr_entry->flags, BP_MMAP_SLAB_ENTRY_INFO_IS_GROUP_TOP))
			group_top_entries_n++;
		if(BP_FLAG_IS_SET(allocator->curr_entry->flags, BP_MMAP_SLAB_ENTRY_INFO_IN_USE))
			entries_used++;
		if(BP_FLAG_IS_SET(allocator->curr_entry->flags, BP_MMAP_SLAB_ENTRY_INFO_NEVER_ALLOCATED))
			entries_still_newly_allocated++;
		if(BP_FLAG_IS_SET(allocator->curr_entry->flags, BP_MMAP_SLAB_ENTRY_INFO_AVAILABLE))
		{
			if(!last_available_slab_entry)
			{
				last_available_slab_entry = allocator->curr_entry;
				last_available_slab_entry_adjacent_entry_n = 1;
			}
			else
			{
				last_available_slab_entry_adjacent_entry_n++;
			}
			entries_available++;
		}
		else
		{
			prev_available_slab_entry = last_available_slab_entry;
			prev_available_slab_entry_adjacent_entry_n = last_available_slab_entry_adjacent_entry_n;
		}
		if(prev_available_slab_entry_adjacent_entry_n < last_available_slab_entry_adjacent_entry_n)
		{
			largest_contiguous_blocks_available_n = last_available_slab_entry_adjacent_entry_n;
			largest_contiguous_blocks_available = last_available_slab_entry;
		}
	}
BP_SLAB_ALLOCATOR_ITER_LOOP_ALL ( allocator ) { if ( BP_FLAG_IS_SET ( allocator -> curr_entry -> flags , BP_MMAP_SLAB_ENTRY_INFO_IS_GROUP_TOP ) ) group_top_entries_n ++ ; if ( BP_FLAG_IS_SET ( allocator -> curr_entry -> flags , BP_MMAP_SLAB_ENTRY_INFO_IN_USE ) ) entries_used ++ ; if ( BP_FLAG_IS_SET ( allocator -> curr_entry -> flags , BP_MMAP_SLAB_ENTRY_INFO_NEVER_ALLOCATED ) ) entries_still_newly_allocated ++ ; if ( BP_FLAG_IS_SET ( allocator -> curr_entry -> flags , BP_MMAP_SLAB_ENTRY_INFO_AVAILABLE ) ) { if ( ! last_available_slab_entry ) { last_available_slab_entry = allocator -> curr_entry ; last_available_slab_entry_adjacent_entry_n = 1 ; } else { last_available_slab_entry_adjacent_entry_n ++ ; } entries_available ++ ; } else { prev_available_slab_entry = last_available_slab_entry ; prev_available_slab_entry_adjacent_entry_n = last_available_slab_entry_adjacent_entry_n ; } if ( prev_available_slab_entry_adjacent_entry_n < last_available_slab_entry_adjacent_entry_n ) { largest_contiguous_blocks_available_n = last_available_slab_entry_adjacent_entry_n ; largest_contiguous_blocks_available = last_available_slab_entry ; } }
Iterate through all items in the allocator and run checks on each to determine
the status of our allocator.
Iterate through all items in the allocator and run checks on each to determine the status of our allocator .
// count the number of group top entries // count the number of entries used // if the current slab has never been allocated, indicate that here // check if flag is available // if the last available slab entry isn't set, set it // increase the available adjacent count // if the previous largest has less entries than the current set of available entries, then // set the current set of entries as the largest. // set count // set entry