• Home
  • Raw
  • Download

Lines Matching refs:tctx

124 static bool	prof_tctx_should_destroy(prof_tctx_t *tctx);
125 static void prof_tctx_destroy(tsd_t *tsd, prof_tctx_t *tctx);
197 prof_alloc_rollback(tsd_t *tsd, prof_tctx_t *tctx, bool updated) in rb_gen()
215 if ((uintptr_t)tctx > (uintptr_t)1U) { in rb_gen()
216 malloc_mutex_lock(tctx->tdata->lock); in rb_gen()
217 tctx->prepared = false; in rb_gen()
218 if (prof_tctx_should_destroy(tctx)) in rb_gen()
219 prof_tctx_destroy(tsd, tctx); in rb_gen()
221 malloc_mutex_unlock(tctx->tdata->lock); in rb_gen()
226 prof_malloc_sample_object(const void *ptr, size_t usize, prof_tctx_t *tctx) in prof_malloc_sample_object() argument
229 prof_tctx_set(ptr, usize, tctx); in prof_malloc_sample_object()
231 malloc_mutex_lock(tctx->tdata->lock); in prof_malloc_sample_object()
232 tctx->cnts.curobjs++; in prof_malloc_sample_object()
233 tctx->cnts.curbytes += usize; in prof_malloc_sample_object()
235 tctx->cnts.accumobjs++; in prof_malloc_sample_object()
236 tctx->cnts.accumbytes += usize; in prof_malloc_sample_object()
238 tctx->prepared = false; in prof_malloc_sample_object()
239 malloc_mutex_unlock(tctx->tdata->lock); in prof_malloc_sample_object()
243 prof_free_sampled_object(tsd_t *tsd, size_t usize, prof_tctx_t *tctx) in prof_free_sampled_object() argument
246 malloc_mutex_lock(tctx->tdata->lock); in prof_free_sampled_object()
247 assert(tctx->cnts.curobjs > 0); in prof_free_sampled_object()
248 assert(tctx->cnts.curbytes >= usize); in prof_free_sampled_object()
249 tctx->cnts.curobjs--; in prof_free_sampled_object()
250 tctx->cnts.curbytes -= usize; in prof_free_sampled_object()
252 if (prof_tctx_should_destroy(tctx)) in prof_free_sampled_object()
253 prof_tctx_destroy(tsd, tctx); in prof_free_sampled_object()
255 malloc_mutex_unlock(tctx->tdata->lock); in prof_free_sampled_object()
611 prof_tctx_should_destroy(prof_tctx_t *tctx) in prof_tctx_should_destroy() argument
616 if (tctx->cnts.curobjs != 0) in prof_tctx_should_destroy()
618 if (tctx->prepared) in prof_tctx_should_destroy()
638 prof_tctx_destroy(tsd_t *tsd, prof_tctx_t *tctx) in prof_tctx_destroy() argument
640 prof_tdata_t *tdata = tctx->tdata; in prof_tctx_destroy()
641 prof_gctx_t *gctx = tctx->gctx; in prof_tctx_destroy()
644 assert(tctx->cnts.curobjs == 0); in prof_tctx_destroy()
645 assert(tctx->cnts.curbytes == 0); in prof_tctx_destroy()
647 assert(tctx->cnts.accumobjs == 0); in prof_tctx_destroy()
648 assert(tctx->cnts.accumbytes == 0); in prof_tctx_destroy()
655 switch (tctx->state) { in prof_tctx_destroy()
657 tctx_tree_remove(&gctx->tctxs, tctx); in prof_tctx_destroy()
685 tctx->state = prof_tctx_state_purgatory; in prof_tctx_destroy()
704 idalloctm(tsd, tctx, tcache_get(tsd, false), true, true); in prof_tctx_destroy()
1037 prof_tctx_merge_tdata(prof_tctx_t *tctx, prof_tdata_t *tdata) in prof_tctx_merge_tdata() argument
1040 malloc_mutex_lock(tctx->gctx->lock); in prof_tctx_merge_tdata()
1042 switch (tctx->state) { in prof_tctx_merge_tdata()
1044 malloc_mutex_unlock(tctx->gctx->lock); in prof_tctx_merge_tdata()
1047 tctx->state = prof_tctx_state_dumping; in prof_tctx_merge_tdata()
1048 malloc_mutex_unlock(tctx->gctx->lock); in prof_tctx_merge_tdata()
1050 memcpy(&tctx->dump_cnts, &tctx->cnts, sizeof(prof_cnt_t)); in prof_tctx_merge_tdata()
1052 tdata->cnt_summed.curobjs += tctx->dump_cnts.curobjs; in prof_tctx_merge_tdata()
1053 tdata->cnt_summed.curbytes += tctx->dump_cnts.curbytes; in prof_tctx_merge_tdata()
1056 tctx->dump_cnts.accumobjs; in prof_tctx_merge_tdata()
1058 tctx->dump_cnts.accumbytes; 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()
1082 prof_tctx_merge_iter(prof_tctx_tree_t *tctxs, prof_tctx_t *tctx, void *arg) in prof_tctx_merge_iter() argument
1085 switch (tctx->state) { in prof_tctx_merge_iter()
1091 prof_tctx_merge_gctx(tctx, tctx->gctx); in prof_tctx_merge_iter()
1102 prof_tctx_dump_iter(prof_tctx_tree_t *tctxs, prof_tctx_t *tctx, void *arg) in prof_tctx_dump_iter() argument
1106 switch (tctx->state) { in prof_tctx_dump_iter()
1115 "%"FMTu64"]\n", tctx->thr_uid, tctx->dump_cnts.curobjs, in prof_tctx_dump_iter()
1116 tctx->dump_cnts.curbytes, tctx->dump_cnts.accumobjs, in prof_tctx_dump_iter()
1117 tctx->dump_cnts.accumbytes)) in prof_tctx_dump_iter()
1118 return (tctx); in prof_tctx_dump_iter()
1128 prof_tctx_finish_iter(prof_tctx_tree_t *tctxs, prof_tctx_t *tctx, void *arg) in prof_tctx_finish_iter() argument
1132 switch (tctx->state) { in prof_tctx_finish_iter()
1137 tctx->state = prof_tctx_state_nominal; in prof_tctx_finish_iter()
1140 ret = tctx; in prof_tctx_finish_iter()
1241 } tctx; in prof_tdata_merge_iter() local
1246 &tctx.v);) in prof_tdata_merge_iter()
1247 prof_tctx_merge_tdata(tctx.p, tdata); in prof_tdata_merge_iter()