MCPcopy Create free account
hub / github.com/beefytech/Beef / prof_recent_alloc_dump_node

Function prof_recent_alloc_dump_node

BeefRT/JEMalloc/src/prof_recent.c:485–528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

483}
484
485static void
486prof_recent_alloc_dump_node(emitter_t *emitter, prof_recent_t *node) {
487 emitter_json_object_begin(emitter);
488
489 emitter_json_kv(emitter, "size", emitter_type_size, &node->size);
490 emitter_json_kv(emitter, "usize", emitter_type_size, &node->usize);
491 bool released = prof_recent_alloc_edata_get_no_lock(node) == NULL;
492 emitter_json_kv(emitter, "released", emitter_type_bool, &released);
493
494 emitter_json_kv(emitter, "alloc_thread_uid", emitter_type_uint64,
495 &node->alloc_tctx->thr_uid);
496 prof_tdata_t *alloc_tdata = node->alloc_tctx->tdata;
497 assert(alloc_tdata != NULL);
498 if (alloc_tdata->thread_name != NULL) {
499 emitter_json_kv(emitter, "alloc_thread_name",
500 emitter_type_string, &alloc_tdata->thread_name);
501 }
502 uint64_t alloc_time_ns = nstime_ns(&node->alloc_time);
503 emitter_json_kv(emitter, "alloc_time", emitter_type_uint64,
504 &alloc_time_ns);
505 emitter_json_array_kv_begin(emitter, "alloc_trace");
506 prof_recent_alloc_dump_bt(emitter, node->alloc_tctx);
507 emitter_json_array_end(emitter);
508
509 if (released && node->dalloc_tctx != NULL) {
510 emitter_json_kv(emitter, "dalloc_thread_uid",
511 emitter_type_uint64, &node->dalloc_tctx->thr_uid);
512 prof_tdata_t *dalloc_tdata = node->dalloc_tctx->tdata;
513 assert(dalloc_tdata != NULL);
514 if (dalloc_tdata->thread_name != NULL) {
515 emitter_json_kv(emitter, "dalloc_thread_name",
516 emitter_type_string, &dalloc_tdata->thread_name);
517 }
518 assert(!nstime_equals_zero(&node->dalloc_time));
519 uint64_t dalloc_time_ns = nstime_ns(&node->dalloc_time);
520 emitter_json_kv(emitter, "dalloc_time", emitter_type_uint64,
521 &dalloc_time_ns);
522 emitter_json_array_kv_begin(emitter, "dalloc_trace");
523 prof_recent_alloc_dump_bt(emitter, node->dalloc_tctx);
524 emitter_json_array_end(emitter);
525 }
526
527 emitter_json_object_end(emitter);
528}
529
530#define PROF_RECENT_PRINT_BUFSIZE 65536
531JEMALLOC_COLD

Callers 1

prof_recent_alloc_dumpFunction · 0.85

Calls 9

emitter_json_kvFunction · 0.85
nstime_nsFunction · 0.85
emitter_json_array_endFunction · 0.85
nstime_equals_zeroFunction · 0.85
emitter_json_object_endFunction · 0.85

Tested by

no test coverage detected