Lines Matching refs:prof_tdata
17 malloc_tsd_data(, prof_tdata, prof_tdata_t *, NULL)
126 prof_enter(prof_tdata_t *prof_tdata)
131 assert(prof_tdata->enq == false);
132 prof_tdata->enq = true;
138 prof_leave(prof_tdata_t *prof_tdata)
146 assert(prof_tdata->enq);
147 prof_tdata->enq = false;
148 idump = prof_tdata->enq_idump;
149 prof_tdata->enq_idump = false;
150 gdump = prof_tdata->enq_gdump;
151 prof_tdata->enq_gdump = false;
410 prof_tdata_t *prof_tdata;
421 prof_tdata = prof_tdata_get(false);
422 assert((uintptr_t)prof_tdata > (uintptr_t)PROF_TDATA_STATE_MAX);
423 prof_enter(prof_tdata);
433 prof_leave(prof_tdata);
445 prof_leave(prof_tdata);
488 prof_lookup_global(prof_bt_t *bt, prof_tdata_t *prof_tdata, void **p_btkey,
501 prof_enter(prof_tdata);
506 prof_leave(prof_tdata);
511 prof_leave(prof_tdata);
518 prof_leave(prof_tdata);
534 prof_leave(prof_tdata);
549 prof_tdata_t *prof_tdata;
553 prof_tdata = prof_tdata_get(false);
554 if ((uintptr_t)prof_tdata <= (uintptr_t)PROF_TDATA_STATE_MAX)
557 if (ckh_search(&prof_tdata->bt2cnt, bt, NULL, &ret.v)) {
566 if (prof_lookup_global(bt, prof_tdata, &btkey, &ctx, &new_ctx))
570 if (ckh_count(&prof_tdata->bt2cnt) == PROF_TCMAX) {
571 assert(ckh_count(&prof_tdata->bt2cnt) > 0);
576 ret.p = ql_last(&prof_tdata->lru_ql, lru_link);
578 if (ckh_remove(&prof_tdata->bt2cnt, ret.p->ctx->bt,
581 ql_remove(&prof_tdata->lru_ql, ret.p, lru_link);
585 assert(ckh_count(&prof_tdata->bt2cnt) < PROF_TCMAX);
600 if (ckh_insert(&prof_tdata->bt2cnt, btkey, ret.v)) {
606 ql_head_insert(&prof_tdata->lru_ql, ret.p, lru_link);
613 ql_remove(&prof_tdata->lru_ql, ret.p, lru_link);
614 ql_head_insert(&prof_tdata->lru_ql, ret.p, lru_link);
622 prof_sample_threshold_update(prof_tdata_t *prof_tdata)
644 if (prof_tdata == NULL)
645 prof_tdata = prof_tdata_get(false);
648 prof_tdata->bytes_until_sample = 0;
658 * prof_tdata->threshold = | -------- |, where p = -------------------
670 prng64(r, 53, prof_tdata->prng_state,
673 prof_tdata->bytes_until_sample = (uint64_t)(log(u) /
685 prof_tdata_t *prof_tdata;
687 prof_tdata = prof_tdata_get(false);
688 if ((uintptr_t)prof_tdata <= (uintptr_t)PROF_TDATA_STATE_MAX)
691 prof_enter(prof_tdata);
693 prof_leave(prof_tdata);
1030 prof_tdata_t *prof_tdata;
1042 prof_tdata = prof_tdata_get(false);
1043 if ((uintptr_t)prof_tdata <= (uintptr_t)PROF_TDATA_STATE_MAX)
1052 prof_enter(prof_tdata);
1055 prof_leave(prof_tdata);
1136 prof_tdata_t *prof_tdata;
1143 prof_tdata = prof_tdata_get(false);
1144 if ((uintptr_t)prof_tdata <= (uintptr_t)PROF_TDATA_STATE_MAX)
1146 if (prof_tdata->enq) {
1147 prof_tdata->enq_idump = true;
1186 prof_tdata_t *prof_tdata;
1193 prof_tdata = prof_tdata_get(false);
1194 if ((uintptr_t)prof_tdata <= (uintptr_t)PROF_TDATA_STATE_MAX)
1196 if (prof_tdata->enq) {
1197 prof_tdata->enq_gdump = true;
1236 prof_tdata_t *prof_tdata;
1241 prof_tdata = (prof_tdata_t *)imalloc(sizeof(prof_tdata_t));
1242 if (prof_tdata == NULL)
1245 if (ckh_new(&prof_tdata->bt2cnt, PROF_CKH_MINITEMS,
1247 idalloc(prof_tdata);
1250 ql_new(&prof_tdata->lru_ql);
1252 prof_tdata->vec = imalloc(sizeof(void *) * PROF_BT_MAX);
1253 if (prof_tdata->vec == NULL) {
1254 ckh_delete(&prof_tdata->bt2cnt);
1255 idalloc(prof_tdata);
1259 prof_tdata->prng_state = (uint64_t)(uintptr_t)prof_tdata;
1260 prof_sample_threshold_update(prof_tdata);
1262 prof_tdata->enq = false;
1263 prof_tdata->enq_idump = false;
1264 prof_tdata->enq_gdump = false;
1266 prof_tdata_tsd_set(&prof_tdata);
1268 return (prof_tdata);
1275 prof_tdata_t *prof_tdata = *(prof_tdata_t **)arg;
1279 if (prof_tdata == PROF_TDATA_STATE_REINCARNATED) {
1282 * was called. Reset prof_tdata to PROF_TDATA_STATE_PURGATORY
1285 prof_tdata = PROF_TDATA_STATE_PURGATORY;
1286 prof_tdata_tsd_set(&prof_tdata);
1287 } else if (prof_tdata == PROF_TDATA_STATE_PURGATORY) {
1291 * wouldn't cause re-creation of the prof_tdata. This time, do
1294 } else if (prof_tdata != NULL) {
1299 ckh_delete(&prof_tdata->bt2cnt);
1304 while ((cnt = ql_last(&prof_tdata->lru_ql, lru_link)) != NULL) {
1305 ql_remove(&prof_tdata->lru_ql, cnt, lru_link);
1309 idalloc(prof_tdata->vec);
1310 idalloc(prof_tdata);
1311 prof_tdata = PROF_TDATA_STATE_PURGATORY;
1312 prof_tdata_tsd_set(&prof_tdata);