{
fss = fsh_slice_get (fsh, i);
vec_validate_init_empty (fss->free_chunks, max_chunk_sz, 0);
+ vec_validate_init_empty (fss->num_chunks, max_chunk_sz, 0);
clib_spinlock_init (&fss->chunk_lock);
}
* with a smaller FIFO.
*/
return size >= FIFO_SEGMENT_MIN_FIFO_SIZE
- && size <= (1 << fsh->max_log2_chunk_size);
+ && size <= (1ULL << fsh->max_log2_chunk_size);
}
static svm_fifo_t *
cmem += sizeof (*c) + rounded_data_size;
}
+ fss->num_chunks[fl_index] += batch_size;
fss->n_fl_chunk_bytes += batch_size * rounded_data_size;
fsh_cached_bytes_add (fsh, batch_size * rounded_data_size);
fsh_free_bytes_sub (fsh, size);
fmem += hdrs + rounded_data_size;
}
+ fss->num_chunks[fl_index] += batch_size;
fss->n_fl_chunk_bytes += batch_size * rounded_data_size;
fsh_cached_bytes_add (fsh, batch_size * rounded_data_size);
fsh_free_bytes_sub (fsh, size);
ssvm_pop_heap (oldheap);
if (f)
{
+ fss->num_chunks[fl_index] += 1;
fsh_free_bytes_sub (fsh, fifo_sz);
goto done;
}
if (c)
{
+ fss->num_chunks[fl_index] += 1;
fsh_free_bytes_sub (fsh, chunk_size + sizeof (*c));
goto done;
}
fsh_cached_bytes_add (fsh, rounded_data_size);
}
+ fss->num_chunks[fl_index] += batch_size;
fss->n_fl_chunk_bytes += batch_size * rounded_data_size;
fsh_free_bytes_sub (fsh, size);
u8 *
format_fifo_segment (u8 * s, va_list * args)
{
- u32 count, indent, active_fifos, free_fifos, fifo_hdr = 0;
+ u32 count, indent, active_fifos, free_fifos;
fifo_segment_t *fs = va_arg (*args, fifo_segment_t *);
int verbose __attribute__ ((unused)) = va_arg (*args, int);
uword est_chunk_bytes, est_free_seg_bytes, free_chunks;
uword chunk_bytes = 0, free_seg_bytes, chunk_size;
uword tracked_cached_bytes;
+ uword fifo_hdr = 0, reserved;
fifo_segment_header_t *fsh;
fifo_segment_slice_t *fss;
svm_fifo_chunk_t *c;
free_chunks = fifo_segment_num_free_chunks (fs, ~0);
if (free_chunks)
- s = format (s, "\n\n%UFree chunks by size:\n", format_white_space,
- indent + 2);
+ s =
+ format (s, "\n\n%UFree/Allocated chunks by size:\n", format_white_space,
+ indent + 2);
else
s = format (s, "\n");
for (i = 0; i < vec_len (fss->free_chunks); i++)
{
c = fss->free_chunks[i];
- if (c == 0)
+ if (c == 0 && fss->num_chunks[i] == 0)
continue;
count = 0;
while (c)
}
chunk_size = fs_freelist_index_to_size (i);
- s = format (s, "%U%-5u kB: %u\n", format_white_space, indent + 2,
- chunk_size >> 10, count);
+ s = format (s, "%U%-5u kB: %u/%u\n", format_white_space, indent + 2,
+ chunk_size >> 10, count, fss->num_chunks[i]);
chunk_bytes += count * chunk_size;
}
usage = (100.0 * in_use) / allocated;
mem_st = fifo_segment_get_mem_status (fs);
virt = fsh_virtual_mem (fsh);
+ reserved = fsh->n_reserved_bytes;
s = format (s, "\n%Useg free bytes: %U (%lu) estimated: %U (%lu) reserved:"
" %U (%lu)\n", format_white_space, indent + 2,
format_memory_size, free_seg_bytes, free_seg_bytes,
format_memory_size, est_free_seg_bytes, est_free_seg_bytes,
- format_memory_size, fsh->n_reserved_bytes,
- fsh->n_reserved_bytes);
+ format_memory_size, reserved, reserved);
s = format (s, "%Uchunk free bytes: %U (%lu) estimated: %U (%lu) tracked:"
" %U (%lu)\n", format_white_space, indent + 2,
format_memory_size, chunk_bytes, chunk_bytes,