| 1344 | prof_dump_header_t *JET_MUTABLE prof_dump_header = prof_dump_header_impl; |
| 1345 | |
| 1346 | static bool |
| 1347 | prof_dump_gctx(tsdn_t *tsdn, bool propagate_err, prof_gctx_t *gctx, |
| 1348 | const prof_bt_t *bt, prof_gctx_tree_t *gctxs) { |
| 1349 | bool ret; |
| 1350 | unsigned i; |
| 1351 | struct prof_tctx_dump_iter_arg_s prof_tctx_dump_iter_arg; |
| 1352 | |
| 1353 | cassert(config_prof); |
| 1354 | malloc_mutex_assert_owner(tsdn, gctx->lock); |
| 1355 | |
| 1356 | /* Avoid dumping such gctx's that have no useful data. */ |
| 1357 | if ((!opt_prof_accum && gctx->cnt_summed.curobjs == 0) || |
| 1358 | (opt_prof_accum && gctx->cnt_summed.accumobjs == 0)) { |
| 1359 | assert(gctx->cnt_summed.curobjs == 0); |
| 1360 | assert(gctx->cnt_summed.curbytes == 0); |
| 1361 | assert(gctx->cnt_summed.accumobjs == 0); |
| 1362 | assert(gctx->cnt_summed.accumbytes == 0); |
| 1363 | ret = false; |
| 1364 | goto label_return; |
| 1365 | } |
| 1366 | |
| 1367 | if (prof_dump_printf(propagate_err, "@")) { |
| 1368 | ret = true; |
| 1369 | goto label_return; |
| 1370 | } |
| 1371 | for (i = 0; i < bt->len; i++) { |
| 1372 | if (prof_dump_printf(propagate_err, " %#"FMTxPTR, |
| 1373 | (uintptr_t)bt->vec[i])) { |
| 1374 | ret = true; |
| 1375 | goto label_return; |
| 1376 | } |
| 1377 | } |
| 1378 | |
| 1379 | if (prof_dump_printf(propagate_err, |
| 1380 | "\n" |
| 1381 | " t*: %"FMTu64": %"FMTu64" [%"FMTu64": %"FMTu64"]\n", |
| 1382 | gctx->cnt_summed.curobjs, gctx->cnt_summed.curbytes, |
| 1383 | gctx->cnt_summed.accumobjs, gctx->cnt_summed.accumbytes)) { |
| 1384 | ret = true; |
| 1385 | goto label_return; |
| 1386 | } |
| 1387 | |
| 1388 | prof_tctx_dump_iter_arg.tsdn = tsdn; |
| 1389 | prof_tctx_dump_iter_arg.propagate_err = propagate_err; |
| 1390 | if (tctx_tree_iter(&gctx->tctxs, NULL, prof_tctx_dump_iter, |
| 1391 | (void *)&prof_tctx_dump_iter_arg) != NULL) { |
| 1392 | ret = true; |
| 1393 | goto label_return; |
| 1394 | } |
| 1395 | |
| 1396 | ret = false; |
| 1397 | label_return: |
| 1398 | return ret; |
| 1399 | } |
| 1400 | |
| 1401 | #ifndef _WIN32 |
| 1402 | JEMALLOC_FORMAT_PRINTF(1, 2) |
no test coverage detected