Lines Matching refs:tctx

236 static bool	prof_tctx_should_destroy(tsdn_t *tsdn, prof_tctx_t *tctx);
237 static void prof_tctx_destroy(tsd_t *tsd, prof_tctx_t *tctx);
313 prof_alloc_rollback(tsd_t *tsd, prof_tctx_t *tctx, bool updated) { in rb_gen()
331 if ((uintptr_t)tctx > (uintptr_t)1U) { in rb_gen()
332 malloc_mutex_lock(tsd_tsdn(tsd), tctx->tdata->lock); in rb_gen()
333 tctx->prepared = false; in rb_gen()
334 if (prof_tctx_should_destroy(tsd_tsdn(tsd), tctx)) { in rb_gen()
335 prof_tctx_destroy(tsd, tctx); in rb_gen()
337 malloc_mutex_unlock(tsd_tsdn(tsd), tctx->tdata->lock); in rb_gen()
344 prof_tctx_t *tctx) { in prof_malloc_sample_object() argument
345 prof_tctx_set(tsdn, ptr, usize, NULL, tctx); in prof_malloc_sample_object()
353 malloc_mutex_lock(tsdn, tctx->tdata->lock); in prof_malloc_sample_object()
354 tctx->cnts.curobjs++; in prof_malloc_sample_object()
355 tctx->cnts.curbytes += usize; in prof_malloc_sample_object()
357 tctx->cnts.accumobjs++; in prof_malloc_sample_object()
358 tctx->cnts.accumbytes += usize; in prof_malloc_sample_object()
360 tctx->prepared = false; in prof_malloc_sample_object()
361 malloc_mutex_unlock(tsdn, tctx->tdata->lock); in prof_malloc_sample_object()
444 prof_try_log(tsd_t *tsd, const void *ptr, size_t usize, prof_tctx_t *tctx) { in prof_try_log() argument
445 malloc_mutex_assert_owner(tsd_tsdn(tsd), tctx->tdata->lock); in prof_try_log()
484 const char *prod_thr_name = (tctx->tdata->thread_name == NULL)? in prof_try_log()
485 "" : tctx->tdata->thread_name; in prof_try_log()
495 prof_bt_t *prod_bt = &tctx->gctx->bt; in prof_try_log()
498 new_node->alloc_thr_ind = prof_log_thr_index(tsd, tctx->tdata->thr_uid, in prof_try_log()
522 prof_tctx_t *tctx) { in prof_free_sampled_object() argument
523 malloc_mutex_lock(tsd_tsdn(tsd), tctx->tdata->lock); in prof_free_sampled_object()
525 assert(tctx->cnts.curobjs > 0); in prof_free_sampled_object()
526 assert(tctx->cnts.curbytes >= usize); in prof_free_sampled_object()
527 tctx->cnts.curobjs--; in prof_free_sampled_object()
528 tctx->cnts.curbytes -= usize; in prof_free_sampled_object()
530 prof_try_log(tsd, ptr, usize, tctx); in prof_free_sampled_object()
532 if (prof_tctx_should_destroy(tsd_tsdn(tsd), tctx)) { in prof_free_sampled_object()
533 prof_tctx_destroy(tsd, tctx); in prof_free_sampled_object()
535 malloc_mutex_unlock(tsd_tsdn(tsd), tctx->tdata->lock); in prof_free_sampled_object()
882 prof_tctx_should_destroy(tsdn_t *tsdn, prof_tctx_t *tctx) { in prof_tctx_should_destroy() argument
883 malloc_mutex_assert_owner(tsdn, tctx->tdata->lock); in prof_tctx_should_destroy()
888 if (tctx->cnts.curobjs != 0) { in prof_tctx_should_destroy()
891 if (tctx->prepared) { in prof_tctx_should_destroy()
912 prof_tctx_destroy(tsd_t *tsd, prof_tctx_t *tctx) { in prof_tctx_destroy() argument
913 prof_tdata_t *tdata = tctx->tdata; in prof_tctx_destroy()
914 prof_gctx_t *gctx = tctx->gctx; in prof_tctx_destroy()
917 malloc_mutex_assert_owner(tsd_tsdn(tsd), tctx->tdata->lock); in prof_tctx_destroy()
919 assert(tctx->cnts.curobjs == 0); in prof_tctx_destroy()
920 assert(tctx->cnts.curbytes == 0); in prof_tctx_destroy()
922 assert(tctx->cnts.accumobjs == 0); in prof_tctx_destroy()
923 assert(tctx->cnts.accumbytes == 0); in prof_tctx_destroy()
930 switch (tctx->state) { in prof_tctx_destroy()
932 tctx_tree_remove(&gctx->tctxs, tctx); in prof_tctx_destroy()
961 tctx->state = prof_tctx_state_purgatory; in prof_tctx_destroy()
976 malloc_mutex_assert_not_owner(tsd_tsdn(tsd), tctx->tdata->lock); in prof_tctx_destroy()
983 idalloctm(tsd_tsdn(tsd), tctx, NULL, NULL, true, true); in prof_tctx_destroy()
1327 prof_tctx_merge_tdata(tsdn_t *tsdn, prof_tctx_t *tctx, prof_tdata_t *tdata) { in prof_tctx_merge_tdata() argument
1328 malloc_mutex_assert_owner(tsdn, tctx->tdata->lock); in prof_tctx_merge_tdata()
1330 malloc_mutex_lock(tsdn, tctx->gctx->lock); in prof_tctx_merge_tdata()
1332 switch (tctx->state) { in prof_tctx_merge_tdata()
1334 malloc_mutex_unlock(tsdn, tctx->gctx->lock); in prof_tctx_merge_tdata()
1337 tctx->state = prof_tctx_state_dumping; in prof_tctx_merge_tdata()
1338 malloc_mutex_unlock(tsdn, tctx->gctx->lock); in prof_tctx_merge_tdata()
1340 memcpy(&tctx->dump_cnts, &tctx->cnts, sizeof(prof_cnt_t)); in prof_tctx_merge_tdata()
1342 tdata->cnt_summed.curobjs += tctx->dump_cnts.curobjs; in prof_tctx_merge_tdata()
1343 tdata->cnt_summed.curbytes += tctx->dump_cnts.curbytes; in prof_tctx_merge_tdata()
1346 tctx->dump_cnts.accumobjs; in prof_tctx_merge_tdata()
1348 tctx->dump_cnts.accumbytes; in prof_tctx_merge_tdata()
1358 prof_tctx_merge_gctx(tsdn_t *tsdn, prof_tctx_t *tctx, prof_gctx_t *gctx) { in prof_tctx_merge_gctx() argument
1361 gctx->cnt_summed.curobjs += tctx->dump_cnts.curobjs; in prof_tctx_merge_gctx()
1362 gctx->cnt_summed.curbytes += tctx->dump_cnts.curbytes; in prof_tctx_merge_gctx()
1364 gctx->cnt_summed.accumobjs += tctx->dump_cnts.accumobjs; in prof_tctx_merge_gctx()
1365 gctx->cnt_summed.accumbytes += tctx->dump_cnts.accumbytes; in prof_tctx_merge_gctx()
1370 prof_tctx_merge_iter(prof_tctx_tree_t *tctxs, prof_tctx_t *tctx, void *arg) { in prof_tctx_merge_iter() argument
1373 malloc_mutex_assert_owner(tsdn, tctx->gctx->lock); in prof_tctx_merge_iter()
1375 switch (tctx->state) { in prof_tctx_merge_iter()
1381 prof_tctx_merge_gctx(tsdn, tctx, tctx->gctx); in prof_tctx_merge_iter()
1396 prof_tctx_dump_iter(prof_tctx_tree_t *tctxs, prof_tctx_t *tctx, void *opaque) { in prof_tctx_dump_iter() argument
1400 malloc_mutex_assert_owner(arg->tsdn, tctx->gctx->lock); in prof_tctx_dump_iter()
1402 switch (tctx->state) { in prof_tctx_dump_iter()
1411 "%"FMTu64"]\n", tctx->thr_uid, tctx->dump_cnts.curobjs, in prof_tctx_dump_iter()
1412 tctx->dump_cnts.curbytes, tctx->dump_cnts.accumobjs, in prof_tctx_dump_iter()
1413 tctx->dump_cnts.accumbytes)) { in prof_tctx_dump_iter()
1414 return tctx; in prof_tctx_dump_iter()
1424 prof_tctx_finish_iter(prof_tctx_tree_t *tctxs, prof_tctx_t *tctx, void *arg) { in prof_tctx_finish_iter() argument
1428 malloc_mutex_assert_owner(tsdn, tctx->gctx->lock); in prof_tctx_finish_iter()
1430 switch (tctx->state) { in prof_tctx_finish_iter()
1435 tctx->state = prof_tctx_state_nominal; in prof_tctx_finish_iter()
1438 ret = tctx; in prof_tctx_finish_iter()
1552 } tctx; in prof_tdata_merge_iter() local
1557 &tctx.v);) { in prof_tdata_merge_iter()
1558 prof_tctx_merge_tdata(arg->tsdn, tctx.p, tdata); in prof_tdata_merge_iter()