Fix a profiling bootstrap bug.
Bootstrap profiling in three stages, so that it is usable by the time the first application allocation occurs.
This commit is contained in:
parent
b27805b363
commit
3383af6c2d
@ -135,6 +135,7 @@ void prof_mdump(void);
|
||||
void prof_udump(void);
|
||||
void prof_boot0(void);
|
||||
bool prof_boot1(void);
|
||||
void prof_boot2(void);
|
||||
|
||||
#endif /* JEMALLOC_H_EXTERNS */
|
||||
/******************************************************************************/
|
||||
|
@ -636,10 +636,6 @@ MALLOC_OUT:
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef JEMALLOC_PROF
|
||||
prof_boot0();
|
||||
#endif
|
||||
|
||||
/* Register fork handlers. */
|
||||
if (pthread_atfork(jemalloc_prefork, jemalloc_postfork,
|
||||
jemalloc_postfork) != 0) {
|
||||
@ -682,6 +678,10 @@ MALLOC_OUT:
|
||||
return (true);
|
||||
}
|
||||
|
||||
#ifdef JEMALLOC_PROF
|
||||
prof_boot0();
|
||||
#endif
|
||||
|
||||
if (arena_boot()) {
|
||||
malloc_mutex_unlock(&init_lock);
|
||||
return (true);
|
||||
@ -725,6 +725,13 @@ MALLOC_OUT:
|
||||
|
||||
malloc_mutex_init(&arenas_lock);
|
||||
|
||||
#ifdef JEMALLOC_PROF
|
||||
if (prof_boot1()) {
|
||||
malloc_mutex_unlock(&init_lock);
|
||||
return (true);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Get number of CPUs. */
|
||||
malloc_initializer = pthread_self();
|
||||
malloc_mutex_unlock(&init_lock);
|
||||
@ -816,10 +823,7 @@ MALLOC_OUT:
|
||||
#endif
|
||||
|
||||
#ifdef JEMALLOC_PROF
|
||||
if (prof_boot1()) {
|
||||
malloc_mutex_unlock(&init_lock);
|
||||
return (true);
|
||||
}
|
||||
prof_boot2();
|
||||
#endif
|
||||
|
||||
/* Allocate and initialize arenas. */
|
||||
|
@ -1043,11 +1043,6 @@ prof_boot1(void)
|
||||
{
|
||||
|
||||
if (opt_prof) {
|
||||
/*
|
||||
* Finish initializing prof_interval, now that narenas is set.
|
||||
*/
|
||||
prof_interval /= narenas;
|
||||
|
||||
if (ckh_new(&bt2ctx, PROF_CKH_MINITEMS, prof_bt_hash,
|
||||
prof_bt_keycomp))
|
||||
return (true);
|
||||
@ -1090,5 +1085,17 @@ prof_boot1(void)
|
||||
return (false);
|
||||
}
|
||||
|
||||
void
|
||||
prof_boot2(void)
|
||||
{
|
||||
|
||||
if (opt_prof) {
|
||||
/*
|
||||
* Finish initializing prof_interval, now that narenas is set.
|
||||
*/
|
||||
prof_interval /= narenas;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
#endif /* JEMALLOC_PROF */
|
||||
|
Loading…
Reference in New Issue
Block a user