Restructure setters for profiling info

Explicitly define three setters:

- `prof_tctx_reset()`: set `prof_tctx` to `1U`, if we don't know in
advance whether the allocation is large or not;
- `prof_tctx_reset_sampled()`: set `prof_tctx` to `1U`, if we already
know in advance that the allocation is large;
- `prof_info_set()`: set a real `prof_tctx`, and also set other
profiling info e.g. the allocation time.

Code structure wise, the prof level is kept as a thin wrapper, the
large level only provides low level setter APIs, and the arena level
carries out the main logic.
This commit is contained in:
Yinan Zhang 2019-12-13 16:48:03 -08:00
parent 1d01e4c770
commit 4afd709d1f
5 changed files with 29 additions and 35 deletions

View file

@ -372,7 +372,7 @@ large_prof_info_get(const extent_t *extent, prof_info_t *prof_info) {
extent_prof_info_get(extent, prof_info);
}
void
static void
large_prof_tctx_set(extent_t *extent, prof_tctx_t *tctx) {
extent_prof_tctx_set(extent, tctx);
}
@ -383,6 +383,9 @@ large_prof_tctx_reset(extent_t *extent) {
}
void
large_prof_alloc_time_set(extent_t *extent, nstime_t *t) {
extent_prof_alloc_time_set(extent, t);
large_prof_info_set(extent_t *extent, prof_tctx_t *tctx) {
large_prof_tctx_set(extent, tctx);
nstime_t t;
nstime_init_update(&t);
extent_prof_alloc_time_set(extent, &t);
}