• Home
  • Raw
  • Download

Lines Matching refs:gctx

555 	prof_gctx_t *gctx = (prof_gctx_t *)iallocztm(tsd, size,  in prof_gctx_create()  local
557 if (gctx == NULL) in prof_gctx_create()
559 gctx->lock = prof_gctx_mutex_choose(); in prof_gctx_create()
564 gctx->nlimbo = 1; in prof_gctx_create()
565 tctx_tree_new(&gctx->tctxs); in prof_gctx_create()
567 memcpy(gctx->vec, bt->vec, bt->len * sizeof(void *)); in prof_gctx_create()
568 gctx->bt.vec = gctx->vec; in prof_gctx_create()
569 gctx->bt.len = bt->len; in prof_gctx_create()
570 return (gctx); in prof_gctx_create()
574 prof_gctx_try_destroy(tsd_t *tsd, prof_tdata_t *tdata_self, prof_gctx_t *gctx, in prof_gctx_try_destroy() argument
588 malloc_mutex_lock(gctx->lock); in prof_gctx_try_destroy()
589 assert(gctx->nlimbo != 0); in prof_gctx_try_destroy()
590 if (tctx_tree_empty(&gctx->tctxs) && gctx->nlimbo == 1) { in prof_gctx_try_destroy()
592 if (ckh_remove(tsd, &bt2gctx, &gctx->bt, NULL, NULL)) in prof_gctx_try_destroy()
596 malloc_mutex_unlock(gctx->lock); in prof_gctx_try_destroy()
597 idalloctm(tsd, gctx, tcache_get(tsd, false), true, true); in prof_gctx_try_destroy()
603 gctx->nlimbo--; in prof_gctx_try_destroy()
604 malloc_mutex_unlock(gctx->lock); in prof_gctx_try_destroy()
624 prof_gctx_should_destroy(prof_gctx_t *gctx) in prof_gctx_should_destroy() argument
629 if (!tctx_tree_empty(&gctx->tctxs)) in prof_gctx_should_destroy()
631 if (gctx->nlimbo != 0) in prof_gctx_should_destroy()
641 prof_gctx_t *gctx = tctx->gctx; in prof_tctx_destroy() local
650 ckh_remove(tsd, &tdata->bt2tctx, &gctx->bt, NULL, NULL); in prof_tctx_destroy()
654 malloc_mutex_lock(gctx->lock); in prof_tctx_destroy()
657 tctx_tree_remove(&gctx->tctxs, tctx); in prof_tctx_destroy()
659 if (prof_gctx_should_destroy(gctx)) { in prof_tctx_destroy()
674 gctx->nlimbo++; in prof_tctx_destroy()
694 malloc_mutex_unlock(gctx->lock); in prof_tctx_destroy()
696 prof_gctx_try_destroy(tsd, prof_tdata_get(tsd, false), gctx, in prof_tctx_destroy()
714 } gctx; in prof_lookup_global() local
722 if (ckh_search(&bt2gctx, bt, &btkey.v, &gctx.v)) { in prof_lookup_global()
724 gctx.p = prof_gctx_create(tsd, bt); in prof_lookup_global()
725 if (gctx.v == NULL) { in prof_lookup_global()
729 btkey.p = &gctx.p->bt; in prof_lookup_global()
730 if (ckh_insert(tsd, &bt2gctx, btkey.v, gctx.v)) { in prof_lookup_global()
733 idalloctm(tsd, gctx.v, tcache_get(tsd, false), true, in prof_lookup_global()
743 malloc_mutex_lock(gctx.p->lock); in prof_lookup_global()
744 gctx.p->nlimbo++; in prof_lookup_global()
745 malloc_mutex_unlock(gctx.p->lock); in prof_lookup_global()
751 *p_gctx = gctx.p; in prof_lookup_global()
780 prof_gctx_t *gctx; in prof_lookup() local
787 if (prof_lookup_global(tsd, bt, tdata, &btkey, &gctx, in prof_lookup()
798 prof_gctx_try_destroy(tsd, tdata, gctx, tdata); in prof_lookup()
805 ret.p->gctx = gctx; in prof_lookup()
814 prof_gctx_try_destroy(tsd, tdata, gctx, tdata); in prof_lookup()
818 malloc_mutex_lock(gctx->lock); in prof_lookup()
820 tctx_tree_insert(&gctx->tctxs, ret.p); in prof_lookup()
821 gctx->nlimbo--; in prof_lookup()
822 malloc_mutex_unlock(gctx->lock); in prof_lookup()
1040 malloc_mutex_lock(tctx->gctx->lock); in prof_tctx_merge_tdata()
1044 malloc_mutex_unlock(tctx->gctx->lock); in prof_tctx_merge_tdata()
1048 malloc_mutex_unlock(tctx->gctx->lock); in prof_tctx_merge_tdata()
1069 prof_tctx_merge_gctx(prof_tctx_t *tctx, prof_gctx_t *gctx) in prof_tctx_merge_gctx() argument
1072 gctx->cnt_summed.curobjs += tctx->dump_cnts.curobjs; in prof_tctx_merge_gctx()
1073 gctx->cnt_summed.curbytes += tctx->dump_cnts.curbytes; in prof_tctx_merge_gctx()
1075 gctx->cnt_summed.accumobjs += tctx->dump_cnts.accumobjs; in prof_tctx_merge_gctx()
1076 gctx->cnt_summed.accumbytes += tctx->dump_cnts.accumbytes; in prof_tctx_merge_gctx()
1091 prof_tctx_merge_gctx(tctx, tctx->gctx); in prof_tctx_merge_iter()
1152 prof_dump_gctx_prep(prof_gctx_t *gctx, prof_gctx_tree_t *gctxs) in prof_dump_gctx_prep() argument
1157 malloc_mutex_lock(gctx->lock); in prof_dump_gctx_prep()
1164 gctx->nlimbo++; in prof_dump_gctx_prep()
1165 gctx_tree_insert(gctxs, gctx); in prof_dump_gctx_prep()
1167 memset(&gctx->cnt_summed, 0, sizeof(prof_cnt_t)); in prof_dump_gctx_prep()
1169 malloc_mutex_unlock(gctx->lock); in prof_dump_gctx_prep()
1173 prof_gctx_merge_iter(prof_gctx_tree_t *gctxs, prof_gctx_t *gctx, void *arg) in prof_gctx_merge_iter() argument
1177 malloc_mutex_lock(gctx->lock); in prof_gctx_merge_iter()
1178 tctx_tree_iter(&gctx->tctxs, NULL, prof_tctx_merge_iter, NULL); in prof_gctx_merge_iter()
1179 if (gctx->cnt_summed.curobjs != 0) in prof_gctx_merge_iter()
1181 malloc_mutex_unlock(gctx->lock); in prof_gctx_merge_iter()
1190 prof_gctx_t *gctx; in prof_gctx_finish() local
1198 while ((gctx = gctx_tree_first(gctxs)) != NULL) { in prof_gctx_finish()
1199 gctx_tree_remove(gctxs, gctx); in prof_gctx_finish()
1200 malloc_mutex_lock(gctx->lock); in prof_gctx_finish()
1207 tctx_tree_iter(&gctx->tctxs, next, in prof_gctx_finish()
1210 next = tctx_tree_next(&gctx->tctxs, in prof_gctx_finish()
1212 tctx_tree_remove(&gctx->tctxs, in prof_gctx_finish()
1220 gctx->nlimbo--; in prof_gctx_finish()
1221 if (prof_gctx_should_destroy(gctx)) { in prof_gctx_finish()
1222 gctx->nlimbo++; in prof_gctx_finish()
1223 malloc_mutex_unlock(gctx->lock); in prof_gctx_finish()
1224 prof_gctx_try_destroy(tsd, tdata, gctx, tdata); in prof_gctx_finish()
1226 malloc_mutex_unlock(gctx->lock); in prof_gctx_finish()
1311 prof_dump_gctx(bool propagate_err, prof_gctx_t *gctx, const prof_bt_t *bt, in prof_dump_gctx() argument
1320 if ((!opt_prof_accum && gctx->cnt_summed.curobjs == 0) || in prof_dump_gctx()
1321 (opt_prof_accum && gctx->cnt_summed.accumobjs == 0)) { in prof_dump_gctx()
1322 assert(gctx->cnt_summed.curobjs == 0); in prof_dump_gctx()
1323 assert(gctx->cnt_summed.curbytes == 0); in prof_dump_gctx()
1324 assert(gctx->cnt_summed.accumobjs == 0); in prof_dump_gctx()
1325 assert(gctx->cnt_summed.accumbytes == 0); in prof_dump_gctx()
1345 gctx->cnt_summed.curobjs, gctx->cnt_summed.curbytes, in prof_dump_gctx()
1346 gctx->cnt_summed.accumobjs, gctx->cnt_summed.accumbytes)) { in prof_dump_gctx()
1351 if (tctx_tree_iter(&gctx->tctxs, NULL, prof_tctx_dump_iter, in prof_dump_gctx()
1463 prof_gctx_dump_iter(prof_gctx_tree_t *gctxs, prof_gctx_t *gctx, void *arg) in prof_gctx_dump_iter() argument
1468 malloc_mutex_lock(gctx->lock); in prof_gctx_dump_iter()
1470 if (prof_dump_gctx(propagate_err, gctx, &gctx->bt, gctxs)) { in prof_gctx_dump_iter()
1471 ret = gctx; in prof_gctx_dump_iter()
1477 malloc_mutex_unlock(gctx->lock); in prof_gctx_dump_iter()
1490 } gctx; in prof_dump() local
1508 for (tabind = 0; !ckh_iter(&bt2gctx, &tabind, NULL, &gctx.v);) in prof_dump()
1509 prof_dump_gctx_prep(gctx.p, &gctxs); in prof_dump()