mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-06-02 10:14:15 +03:00
Move te_prof_sample_event_lookahead into src/jemalloc.c
The function only had production callers in src/jemalloc.c. It was parked in prof_inlines.h because its body uses tsd accessors that aren't visible from prof.h. Moving it to file scope in jemalloc.c gets it out of the shared header without losing inlining, and the name drops the misleading te_ prefix -- it isn't a thread_event facility, just a one-off prof helper. Renamed prof_sample_lookahead for clarity.
This commit is contained in:
parent
2502195964
commit
5b834df66c
2 changed files with 22 additions and 30 deletions
|
|
@ -9,32 +9,6 @@
|
|||
#include "jemalloc/internal/sz.h"
|
||||
#include "jemalloc/internal/thread_event.h"
|
||||
|
||||
/*
|
||||
* The lookahead functionality facilitates events to be able to lookahead, i.e.
|
||||
* without touching the event counters, to determine whether an event would be
|
||||
* triggered. The event counters are not advanced until the end of the
|
||||
* allocation / deallocation calls, so the lookahead can be useful if some
|
||||
* preparation work for some event must be done early in the allocation /
|
||||
* deallocation calls.
|
||||
*
|
||||
* Currently only the profiling sampling event needs the lookahead
|
||||
* functionality, so we don't yet define general purpose lookahead functions.
|
||||
*
|
||||
* Defined here rather than prof.h because the inline body depends on tsd
|
||||
* accessors that aren't visible until tsd inlines are loaded.
|
||||
*/
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE bool
|
||||
te_prof_sample_event_lookahead(tsd_t *tsd, size_t usize) {
|
||||
if (unlikely(!tsd_nominal(tsd) || tsd_reentrancy_level_get(tsd) > 0)) {
|
||||
return false;
|
||||
}
|
||||
/* The subtraction is intentionally susceptible to underflow. */
|
||||
uint64_t accumbytes = tsd_thread_allocated_get(tsd) + usize
|
||||
- tsd_thread_allocated_last_event_get(tsd);
|
||||
return accumbytes >= tsd_prof_sample_event_wait_get(tsd);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void
|
||||
prof_active_assert(void) {
|
||||
cassert(config_prof);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue