mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-08-06 18:36:14 +03:00
Initialization utilities for nstime
This commit is contained in:
parent
dd649c9485
commit
1d01e4c770
12 changed files with 46 additions and 41 deletions
|
|
@ -46,7 +46,7 @@ JEMALLOC_EXPORT int _pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex,
|
|||
void
|
||||
malloc_mutex_lock_slow(malloc_mutex_t *mutex) {
|
||||
mutex_prof_data_t *data = &mutex->prof_data;
|
||||
nstime_t before = NSTIME_ZERO_INITIALIZER;
|
||||
nstime_t before;
|
||||
|
||||
if (ncpus == 1) {
|
||||
goto label_spin_done;
|
||||
|
|
@ -68,7 +68,7 @@ malloc_mutex_lock_slow(malloc_mutex_t *mutex) {
|
|||
return;
|
||||
}
|
||||
label_spin_done:
|
||||
nstime_update(&before);
|
||||
nstime_init_update(&before);
|
||||
/* Copy before to after to avoid clock skews. */
|
||||
nstime_t after;
|
||||
nstime_copy(&after, &before);
|
||||
|
|
@ -104,8 +104,8 @@ label_spin_done:
|
|||
static void
|
||||
mutex_prof_data_init(mutex_prof_data_t *data) {
|
||||
memset(data, 0, sizeof(mutex_prof_data_t));
|
||||
nstime_init(&data->max_wait_time, 0);
|
||||
nstime_init(&data->tot_wait_time, 0);
|
||||
nstime_init_zero(&data->max_wait_time);
|
||||
nstime_init_zero(&data->tot_wait_time);
|
||||
data->prev_owner = NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue