| 1615 | prof_dump_header_t *JET_MUTABLE prof_dump_header = prof_dump_header_impl; |
| 1616 | |
| 1617 | static bool |
| 1618 | prof_dump_gctx(tsdn_t *tsdn, bool propagate_err, prof_gctx_t *gctx, |
| 1619 | const prof_bt_t *bt, prof_gctx_tree_t *gctxs) { |
| 1620 | bool ret; |
| 1621 | unsigned i; |
| 1622 | struct prof_tctx_dump_iter_arg_s prof_tctx_dump_iter_arg; |
| 1623 | |
| 1624 | cassert(config_prof); |
| 1625 | malloc_mutex_assert_owner(tsdn, gctx->lock); |
| 1626 | |
| 1627 | /* Avoid dumping such gctx's that have no useful data. */ |
| 1628 | if ((!opt_prof_accum && gctx->cnt_summed.curobjs == 0) || |
| 1629 | (opt_prof_accum && gctx->cnt_summed.accumobjs == 0)) { |
| 1630 | assert(gctx->cnt_summed.curobjs == 0); |
| 1631 | assert(gctx->cnt_summed.curbytes == 0); |
| 1632 | assert(gctx->cnt_summed.accumobjs == 0); |
| 1633 | assert(gctx->cnt_summed.accumbytes == 0); |
| 1634 | ret = false; |
| 1635 | goto label_return; |
| 1636 | } |
| 1637 | |
| 1638 | if (prof_dump_printf(propagate_err, "@")) { |
| 1639 | ret = true; |
| 1640 | goto label_return; |
| 1641 | } |
| 1642 | for (i = 0; i < bt->len; i++) { |
| 1643 | if (prof_dump_printf(propagate_err, " %#"FMTxPTR, |
| 1644 | (uintptr_t)bt->vec[i])) { |
| 1645 | ret = true; |
| 1646 | goto label_return; |
| 1647 | } |
| 1648 | } |
| 1649 | |
| 1650 | if (prof_dump_printf(propagate_err, |
| 1651 | "\n" |
| 1652 | " t*: %"FMTu64": %"FMTu64" [%"FMTu64": %"FMTu64"]\n", |
| 1653 | gctx->cnt_summed.curobjs, gctx->cnt_summed.curbytes, |
| 1654 | gctx->cnt_summed.accumobjs, gctx->cnt_summed.accumbytes)) { |
| 1655 | ret = true; |
| 1656 | goto label_return; |
| 1657 | } |
| 1658 | |
| 1659 | prof_tctx_dump_iter_arg.tsdn = tsdn; |
| 1660 | prof_tctx_dump_iter_arg.propagate_err = propagate_err; |
| 1661 | if (tctx_tree_iter(&gctx->tctxs, NULL, prof_tctx_dump_iter, |
| 1662 | (void *)&prof_tctx_dump_iter_arg) != NULL) { |
| 1663 | ret = true; |
| 1664 | goto label_return; |
| 1665 | } |
| 1666 | |
| 1667 | ret = false; |
| 1668 | label_return: |
| 1669 | return ret; |
| 1670 | } |
| 1671 | |
| 1672 | #ifndef _WIN32 |
| 1673 | JEMALLOC_FORMAT_PRINTF(1, 2) |
no test coverage detected