|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
67 uword i, n_callers, trace_index, *p;
96 t = tm->
traces + trace_index;
113 if (tm->
traces != old_start)
120 q = uword_to_pointer (p->key, mheap_trace_t *);
121 ASSERT (q >= old_start && q < old_end);
122 p->key = pointer_to_uword (tm->traces + (q - old_start));
126 trace_index = t - tm->
traces;
129 t = tm->
traces + trace_index;
150 uword trace_index, *p;
175 t = tm->
traces + trace_index;
218 flags = CLIB_MEM_HEAP_F_UNMAP_ON_DESTROY;
224 flags |= CLIB_MEM_HEAP_F_LOCKED;
229 h->log2_page_sz = log2_page_sz;
232 strcpy (
h->name,
name);
303 int verbose = va_arg (*va,
int);
331 else if (
a >= 1ULL << 20)
333 else if (
a >= 1ULL << 10)
357 int verbose = va_arg (*va,
int);
369 u32 indent, total_objects_traced;
373 qsort (traces_copy,
vec_len (traces_copy),
sizeof (traces_copy[0]),
376 total_objects_traced = 0;
387 if (!verbose && t->
n_bytes < 1024)
390 if (t == traces_copy)
391 s =
format (s,
"%=9s%=9s %=10s Traceback\n",
"Bytes",
"Count",
399 #if defined(CLIB_UNIX) && !defined(__APPLE__)
410 s =
format (s,
"%d total traced objects\n", total_objects_traced);
415 if (have_traces == 0)
416 s =
format (s,
"no traced allocations\n");
425 int verbose = va_arg (*va,
int);
435 s =
format (s,
"base %p, size %U",
439 if (heap->flags & CLIB_MEM_HEAP_F_##v) s = format (s, ", %s", str);
454 s =
format (s,
"\n%Utotal: %U, used: %U, free: %U, trimmable: %U",
461 s =
format (s,
"\n%Ufree chunks %llu free fastbin blks %llu",
463 s =
format (s,
"\n%Umax total allocated %U",
486 usage->bytes_used_sbrk = 0;
487 usage->object_count = 0;
547 else if (strchr (
fmt,
'%'))
574 if (
h->flags & CLIB_MEM_HEAP_F_UNMAP_ON_DESTROY)
static void clib_spinlock_init(clib_spinlock_t *p)
__clib_export void clib_mem_trace(int enable)
void * current_traced_mheap
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
@ foreach_clib_mem_heap_flag
static_always_inline clib_mem_page_sz_t clib_mem_log2_page_size_validate(clib_mem_page_sz_t log2_page_size)
static clib_mem_heap_t * clib_mem_get_heap(void)
__clib_export void * clib_mem_init_thread_safe(void *memory, uword memory_size)
#define CLIB_MEM_POISON(a, s)
MALLINFO_FIELD_TYPE arena
#define vec_end(v)
End (last data address) of vector.
__clib_export int clib_mem_vm_unmap(void *base)
MALLINFO_FIELD_TYPE hblkhd
DLMALLOC_EXPORT int mspace_enable_disable_trace(mspace msp, int enable)
static_always_inline uword clib_mem_page_bytes(clib_mem_page_sz_t log2_page_size)
MALLINFO_FIELD_TYPE uordblks
vl_api_ikev2_sa_stats_t stats
#define CLIB_MEM_VM_MAP_FAILED
__clib_export void clib_mem_get_page_stats(void *start, clib_mem_page_sz_t log2_page_size, uword n_pages, clib_mem_page_stats_t *stats)
DLMALLOC_EXPORT int mspace_is_traced(mspace msp)
DLMALLOC_EXPORT void mspace_disable_expand(mspace msp)
#define hash_foreach_pair(p, v, body)
Iterate over hash pairs.
u8 * format_msize(u8 *s, va_list *va)
#define hash_set(h, key, value)
static uword round_pow2(uword x, uword pow2)
void clib_mem_main_init()
static int mheap_trace_sort(const void *_t1, const void *_t2)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void mheap_trace_main_free(mheap_trace_main_t *tm)
DLMALLOC_EXPORT void * mspace_least_addr(mspace msp)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
__clib_export uword clib_mem_get_heap_free_space(clib_mem_heap_t *h)
#define vec_dup(V)
Return copy of vector (no header, no alignment)
MALLINFO_FIELD_TYPE usmblks
vhost_user_memory_t memory
struct clib_bihash_value offset
template key/value backing page structure
int clib_mem_is_traced(void)
MALLINFO_FIELD_TYPE keepcost
static_always_inline void clib_spinlock_lock(clib_spinlock_t *p)
DLMALLOC_EXPORT size_t mspace_footprint(mspace msp)
#define hash_set_mem(h, key, value)
uword * trace_index_by_offset
static clib_mem_heap_t * clib_mem_create_heap_internal(void *base, uword size, clib_mem_page_sz_t log2_page_sz, int is_locked, char *name)
sll srl srl sll sra u16x4 i
__clib_export uword clib_mem_trace_enable_disable(uword enable)
__clib_export void * clib_mem_init_with_page_size(uword memory_size, clib_mem_page_sz_t log2_page_sz)
void * clib_mem_vm_map_internal(void *base, clib_mem_page_sz_t log2_page_sz, uword size, int fd, uword offset, char *name)
MALLINFO_FIELD_TYPE ordblks
format_function_t format_clib_elf_symbol_with_address
__clib_export void * clib_mem_init(void *memory, uword memory_size)
clib_mem_page_sz_t log2_page_sz
void mheap_put_trace(uword offset, uword size)
mheap_trace_main_t mheap_trace_main
#define vec_free(V)
Free vector's memory (no header).
template key/value backing page structure
#define hash_get_mem(h, key)
description fragment has unexpected format
DLMALLOC_EXPORT struct dlmallinfo mspace_mallinfo(mspace msp)
__clib_export u8 * format_clib_mem_usage(u8 *s, va_list *va)
__clib_export void * clib_mem_get_heap_base(clib_mem_heap_t *h)
@ CLIB_MEM_PAGE_SZ_DEFAULT
__clib_export uword clib_backtrace(uword *callers, uword max_callers, uword n_frames_to_skip)
#define vec_foreach(var, vec)
Vector iterator.
u8 * format_clib_mem_page_stats(u8 *s, va_list *va)
static_always_inline void clib_spinlock_unlock(clib_spinlock_t *p)
static_always_inline clib_mem_page_sz_t clib_mem_get_log2_page_size(void)
DLMALLOC_EXPORT mspace create_mspace_with_base(void *base, size_t capacity, int locked)
#define hash_unset(h, key)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
#define hash_unset_mem(h, key)
__clib_export u8 * format_clib_mem_heap(u8 *s, va_list *va)
MALLINFO_FIELD_TYPE smblks
__clib_export void clib_mem_destroy_heap(clib_mem_heap_t *h)
uword clib_mem_validate_serial
void mheap_get_trace(uword offset, uword size)
#define hash_create_shmem(elts, key_bytes, value_bytes)
void qsort(void *base, uword n, uword size, int(*compar)(const void *, const void *))
__clib_export void clib_mem_destroy(void)
u8 * format_mheap_trace(u8 *s, va_list *va)
__clib_export void clib_mem_get_heap_usage(clib_mem_heap_t *heap, clib_mem_usage_t *usage)
@ CLIB_MEM_PAGE_SZ_UNKNOWN
__clib_export void mheap_trace(clib_mem_heap_t *h, int enable)
static clib_mem_heap_t * clib_mem_set_heap(clib_mem_heap_t *heap)
__clib_export clib_mem_heap_t * clib_mem_create_heap(void *base, uword size, int is_locked, char *fmt,...)
static void * clib_mem_init_internal(void *base, uword size, clib_mem_page_sz_t log2_page_sz)
DLMALLOC_EXPORT size_t destroy_mspace(mspace msp)
MALLINFO_FIELD_TYPE fordblks
__clib_export uword clib_mem_get_heap_size(clib_mem_heap_t *heap)
vl_api_wireguard_peer_flags_t flags