MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / prof_log_emit_traces

Function prof_log_emit_traces

deps/jemalloc/src/prof.c:2604–2631  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2602}
2603
2604static void
2605prof_log_emit_traces(tsd_t *tsd, emitter_t *emitter) {
2606 emitter_json_array_kv_begin(emitter, "stack_traces");
2607 prof_bt_node_t *bt_node = log_bt_first;
2608 prof_bt_node_t *bt_old_node;
2609 /*
2610 * Calculate how many hex digits we need: twice number of bytes, two for
2611 * "0x", and then one more for terminating '\0'.
2612 */
2613 char buf[2 * sizeof(intptr_t) + 3];
2614 size_t buf_sz = sizeof(buf);
2615 while (bt_node != NULL) {
2616 emitter_json_array_begin(emitter);
2617 size_t i;
2618 for (i = 0; i < bt_node->bt.len; i++) {
2619 malloc_snprintf(buf, buf_sz, "%p", bt_node->bt.vec[i]);
2620 char *trace_str = buf;
2621 emitter_json_value(emitter, emitter_type_string,
2622 &trace_str);
2623 }
2624 emitter_json_array_end(emitter);
2625
2626 bt_old_node = bt_node;
2627 bt_node = bt_node->next;
2628 idalloc(tsd, bt_old_node);
2629 }
2630 emitter_json_array_end(emitter);
2631}
2632
2633static void
2634prof_log_emit_allocs(tsd_t *tsd, emitter_t *emitter) {

Callers 1

prof_log_stopFunction · 0.85

Calls 5

emitter_json_array_beginFunction · 0.85
emitter_json_valueFunction · 0.85
emitter_json_array_endFunction · 0.85
idallocFunction · 0.50

Tested by

no test coverage detected