| 404 | } |
| 405 | } |
| 406 | static size_t |
| 407 | prof_log_thr_index(tsd_t *tsd, uint64_t thr_uid, const char *name) { |
| 408 | assert(prof_logging_state == prof_logging_state_started); |
| 409 | malloc_mutex_assert_owner(tsd_tsdn(tsd), &log_mtx); |
| 410 | |
| 411 | prof_thr_node_t dummy_node; |
| 412 | dummy_node.thr_uid = thr_uid; |
| 413 | prof_thr_node_t *node; |
| 414 | |
| 415 | /* See if this thread is already cached in the table. */ |
| 416 | if (ckh_search(&log_thr_node_set, (void *)(&dummy_node), |
| 417 | (void **)(&node), NULL)) { |
| 418 | size_t sz = offsetof(prof_thr_node_t, name) + strlen(name) + 1; |
| 419 | prof_thr_node_t *new_node = (prof_thr_node_t *) |
| 420 | iallocztm(tsd_tsdn(tsd), sz, sz_size2index(sz), false, NULL, |
| 421 | true, arena_get(TSDN_NULL, 0, true), true); |
| 422 | if (log_thr_first == NULL) { |
| 423 | log_thr_first = new_node; |
| 424 | log_thr_last = new_node; |
| 425 | } else { |
| 426 | log_thr_last->next = new_node; |
| 427 | log_thr_last = new_node; |
| 428 | } |
| 429 | |
| 430 | new_node->next = NULL; |
| 431 | new_node->index = log_thr_index; |
| 432 | new_node->thr_uid = thr_uid; |
| 433 | strcpy(new_node->name, name); |
| 434 | |
| 435 | log_thr_index++; |
| 436 | ckh_insert(tsd, &log_thr_node_set, (void *)new_node, NULL); |
| 437 | return new_node->index; |
| 438 | } else { |
| 439 | return node->index; |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | static void |
| 444 | prof_try_log(tsd_t *tsd, const void *ptr, size_t usize, prof_tctx_t *tctx) { |
no test coverage detected