• Home
  • Raw
  • Download

Lines Matching refs:tctx

140 static bool	prof_tctx_should_destroy(tsdn_t *tsdn, prof_tctx_t *tctx);
141 static void prof_tctx_destroy(tsd_t *tsd, prof_tctx_t *tctx);
211 prof_alloc_rollback(tsd_t *tsd, prof_tctx_t *tctx, bool updated) { in rb_gen()
229 if ((uintptr_t)tctx > (uintptr_t)1U) { in rb_gen()
230 malloc_mutex_lock(tsd_tsdn(tsd), tctx->tdata->lock); in rb_gen()
231 tctx->prepared = false; in rb_gen()
232 if (prof_tctx_should_destroy(tsd_tsdn(tsd), tctx)) { in rb_gen()
233 prof_tctx_destroy(tsd, tctx); in rb_gen()
235 malloc_mutex_unlock(tsd_tsdn(tsd), tctx->tdata->lock); in rb_gen()
242 prof_tctx_t *tctx) { in prof_malloc_sample_object() argument
243 prof_tctx_set(tsdn, ptr, usize, NULL, tctx); in prof_malloc_sample_object()
245 malloc_mutex_lock(tsdn, tctx->tdata->lock); in prof_malloc_sample_object()
246 tctx->cnts.curobjs++; in prof_malloc_sample_object()
247 tctx->cnts.curbytes += usize; in prof_malloc_sample_object()
249 tctx->cnts.accumobjs++; in prof_malloc_sample_object()
250 tctx->cnts.accumbytes += usize; in prof_malloc_sample_object()
252 tctx->prepared = false; in prof_malloc_sample_object()
253 malloc_mutex_unlock(tsdn, tctx->tdata->lock); in prof_malloc_sample_object()
257 prof_free_sampled_object(tsd_t *tsd, size_t usize, prof_tctx_t *tctx) { in prof_free_sampled_object() argument
258 malloc_mutex_lock(tsd_tsdn(tsd), tctx->tdata->lock); in prof_free_sampled_object()
259 assert(tctx->cnts.curobjs > 0); in prof_free_sampled_object()
260 assert(tctx->cnts.curbytes >= usize); in prof_free_sampled_object()
261 tctx->cnts.curobjs--; in prof_free_sampled_object()
262 tctx->cnts.curbytes -= usize; in prof_free_sampled_object()
264 if (prof_tctx_should_destroy(tsd_tsdn(tsd), tctx)) { in prof_free_sampled_object()
265 prof_tctx_destroy(tsd, tctx); in prof_free_sampled_object()
267 malloc_mutex_unlock(tsd_tsdn(tsd), tctx->tdata->lock); in prof_free_sampled_object()
614 prof_tctx_should_destroy(tsdn_t *tsdn, prof_tctx_t *tctx) { in prof_tctx_should_destroy() argument
615 malloc_mutex_assert_owner(tsdn, tctx->tdata->lock); in prof_tctx_should_destroy()
620 if (tctx->cnts.curobjs != 0) { in prof_tctx_should_destroy()
623 if (tctx->prepared) { in prof_tctx_should_destroy()
644 prof_tctx_destroy(tsd_t *tsd, prof_tctx_t *tctx) { in prof_tctx_destroy() argument
645 prof_tdata_t *tdata = tctx->tdata; in prof_tctx_destroy()
646 prof_gctx_t *gctx = tctx->gctx; in prof_tctx_destroy()
649 malloc_mutex_assert_owner(tsd_tsdn(tsd), tctx->tdata->lock); in prof_tctx_destroy()
651 assert(tctx->cnts.curobjs == 0); in prof_tctx_destroy()
652 assert(tctx->cnts.curbytes == 0); in prof_tctx_destroy()
654 assert(tctx->cnts.accumobjs == 0); in prof_tctx_destroy()
655 assert(tctx->cnts.accumbytes == 0); in prof_tctx_destroy()
662 switch (tctx->state) { in prof_tctx_destroy()
664 tctx_tree_remove(&gctx->tctxs, tctx); in prof_tctx_destroy()
693 tctx->state = prof_tctx_state_purgatory; in prof_tctx_destroy()
708 malloc_mutex_assert_not_owner(tsd_tsdn(tsd), tctx->tdata->lock); in prof_tctx_destroy()
715 idalloctm(tsd_tsdn(tsd), tctx, NULL, NULL, true, true); in prof_tctx_destroy()
1056 prof_tctx_merge_tdata(tsdn_t *tsdn, prof_tctx_t *tctx, prof_tdata_t *tdata) { in prof_tctx_merge_tdata() argument
1057 malloc_mutex_assert_owner(tsdn, tctx->tdata->lock); in prof_tctx_merge_tdata()
1059 malloc_mutex_lock(tsdn, tctx->gctx->lock); in prof_tctx_merge_tdata()
1061 switch (tctx->state) { in prof_tctx_merge_tdata()
1063 malloc_mutex_unlock(tsdn, tctx->gctx->lock); in prof_tctx_merge_tdata()
1066 tctx->state = prof_tctx_state_dumping; in prof_tctx_merge_tdata()
1067 malloc_mutex_unlock(tsdn, tctx->gctx->lock); in prof_tctx_merge_tdata()
1069 memcpy(&tctx->dump_cnts, &tctx->cnts, sizeof(prof_cnt_t)); in prof_tctx_merge_tdata()
1071 tdata->cnt_summed.curobjs += tctx->dump_cnts.curobjs; in prof_tctx_merge_tdata()
1072 tdata->cnt_summed.curbytes += tctx->dump_cnts.curbytes; in prof_tctx_merge_tdata()
1075 tctx->dump_cnts.accumobjs; in prof_tctx_merge_tdata()
1077 tctx->dump_cnts.accumbytes; in prof_tctx_merge_tdata()
1087 prof_tctx_merge_gctx(tsdn_t *tsdn, prof_tctx_t *tctx, prof_gctx_t *gctx) { in prof_tctx_merge_gctx() argument
1090 gctx->cnt_summed.curobjs += tctx->dump_cnts.curobjs; in prof_tctx_merge_gctx()
1091 gctx->cnt_summed.curbytes += tctx->dump_cnts.curbytes; in prof_tctx_merge_gctx()
1093 gctx->cnt_summed.accumobjs += tctx->dump_cnts.accumobjs; in prof_tctx_merge_gctx()
1094 gctx->cnt_summed.accumbytes += tctx->dump_cnts.accumbytes; in prof_tctx_merge_gctx()
1099 prof_tctx_merge_iter(prof_tctx_tree_t *tctxs, prof_tctx_t *tctx, void *arg) { in prof_tctx_merge_iter() argument
1102 malloc_mutex_assert_owner(tsdn, tctx->gctx->lock); in prof_tctx_merge_iter()
1104 switch (tctx->state) { in prof_tctx_merge_iter()
1110 prof_tctx_merge_gctx(tsdn, tctx, tctx->gctx); in prof_tctx_merge_iter()
1125 prof_tctx_dump_iter(prof_tctx_tree_t *tctxs, prof_tctx_t *tctx, void *opaque) { in prof_tctx_dump_iter() argument
1129 malloc_mutex_assert_owner(arg->tsdn, tctx->gctx->lock); in prof_tctx_dump_iter()
1131 switch (tctx->state) { in prof_tctx_dump_iter()
1140 "%"FMTu64"]\n", tctx->thr_uid, tctx->dump_cnts.curobjs, in prof_tctx_dump_iter()
1141 tctx->dump_cnts.curbytes, tctx->dump_cnts.accumobjs, in prof_tctx_dump_iter()
1142 tctx->dump_cnts.accumbytes)) { in prof_tctx_dump_iter()
1143 return tctx; in prof_tctx_dump_iter()
1153 prof_tctx_finish_iter(prof_tctx_tree_t *tctxs, prof_tctx_t *tctx, void *arg) { in prof_tctx_finish_iter() argument
1157 malloc_mutex_assert_owner(tsdn, tctx->gctx->lock); in prof_tctx_finish_iter()
1159 switch (tctx->state) { in prof_tctx_finish_iter()
1164 tctx->state = prof_tctx_state_nominal; in prof_tctx_finish_iter()
1167 ret = tctx; in prof_tctx_finish_iter()
1281 } tctx; in prof_tdata_merge_iter() local
1286 &tctx.v);) { in prof_tdata_merge_iter()
1287 prof_tctx_merge_tdata(arg->tsdn, tctx.p, tdata); in prof_tdata_merge_iter()