mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-16 00:44:31 +08:00
mdbx: сбор затрат на pnl_merge()
при включении MDBX_ENABLE_PROFGC
.
This commit is contained in:
parent
6ed4dcb4ea
commit
5168c80be8
6
mdbx.h
6
mdbx.h
@ -4139,6 +4139,12 @@ struct MDBX_commit_latency {
|
|||||||
/** \brief Количество страничных промахов (page faults) внутри GC
|
/** \brief Количество страничных промахов (page faults) внутри GC
|
||||||
* при выделении и подготовки страниц для самой GC. */
|
* при выделении и подготовки страниц для самой GC. */
|
||||||
uint32_t self_majflt;
|
uint32_t self_majflt;
|
||||||
|
/* Для разборок с pnl_merge() */
|
||||||
|
struct {
|
||||||
|
uint32_t time;
|
||||||
|
uint64_t volume;
|
||||||
|
uint32_t calls;
|
||||||
|
} pnl_merge_work, pnl_merge_self;
|
||||||
} gc_prof;
|
} gc_prof;
|
||||||
};
|
};
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
|
@ -1064,7 +1064,15 @@ next_gc:;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Merge in descending sorted order */
|
/* Merge in descending sorted order */
|
||||||
|
#if MDBX_ENABLE_PROFGC
|
||||||
|
const uint64_t merge_begin = osal_monotime();
|
||||||
|
#endif /* MDBX_ENABLE_PROFGC */
|
||||||
pnl_merge(txn->tw.relist, gc_pnl);
|
pnl_merge(txn->tw.relist, gc_pnl);
|
||||||
|
#if MDBX_ENABLE_PROFGC
|
||||||
|
prof->pnl_merge.calls += 1;
|
||||||
|
prof->pnl_merge.volume += MDBX_PNL_GETSIZE(txn->tw.relist);
|
||||||
|
prof->pnl_merge.time += osal_monotime() - merge_begin;
|
||||||
|
#endif /* MDBX_ENABLE_PROFGC */
|
||||||
flags |= ALLOC_SHOULD_SCAN;
|
flags |= ALLOC_SHOULD_SCAN;
|
||||||
if (AUDIT_ENABLED()) {
|
if (AUDIT_ENABLED()) {
|
||||||
if (unlikely(!pnl_check(txn->tw.relist, txn->geo.first_unallocated))) {
|
if (unlikely(!pnl_check(txn->tw.relist, txn->geo.first_unallocated))) {
|
||||||
|
@ -50,6 +50,12 @@ typedef struct gc_prof_stat {
|
|||||||
uint32_t spe_counter;
|
uint32_t spe_counter;
|
||||||
/* page faults (hard page faults) */
|
/* page faults (hard page faults) */
|
||||||
uint32_t majflt;
|
uint32_t majflt;
|
||||||
|
/* Для разборок с pnl_merge() */
|
||||||
|
struct {
|
||||||
|
uint64_t time;
|
||||||
|
uint64_t volume;
|
||||||
|
uint32_t calls;
|
||||||
|
} pnl_merge;
|
||||||
} gc_prof_stat_t;
|
} gc_prof_stat_t;
|
||||||
|
|
||||||
/* Statistics of pages operations for all transactions,
|
/* Statistics of pages operations for all transactions,
|
||||||
|
@ -418,6 +418,14 @@ static void take_gcprof(MDBX_txn *txn, MDBX_commit_latency *latency) {
|
|||||||
latency->gc_prof.wipes = ptr->gc_prof.wipes;
|
latency->gc_prof.wipes = ptr->gc_prof.wipes;
|
||||||
latency->gc_prof.flushes = ptr->gc_prof.flushes;
|
latency->gc_prof.flushes = ptr->gc_prof.flushes;
|
||||||
latency->gc_prof.kicks = ptr->gc_prof.kicks;
|
latency->gc_prof.kicks = ptr->gc_prof.kicks;
|
||||||
|
|
||||||
|
latency->gc_prof.pnl_merge_work.time = osal_monotime_to_16dot16(ptr->gc_prof.work.pnl_merge.time);
|
||||||
|
latency->gc_prof.pnl_merge_work.calls = ptr->gc_prof.work.pnl_merge.calls;
|
||||||
|
latency->gc_prof.pnl_merge_work.volume = ptr->gc_prof.work.pnl_merge.volume;
|
||||||
|
latency->gc_prof.pnl_merge_self.time = osal_monotime_to_16dot16(ptr->gc_prof.self.pnl_merge.time);
|
||||||
|
latency->gc_prof.pnl_merge_self.calls = ptr->gc_prof.self.pnl_merge.calls;
|
||||||
|
latency->gc_prof.pnl_merge_self.volume = ptr->gc_prof.self.pnl_merge.volume;
|
||||||
|
|
||||||
if (txn == env->basal_txn)
|
if (txn == env->basal_txn)
|
||||||
memset(&ptr->gc_prof, 0, sizeof(ptr->gc_prof));
|
memset(&ptr->gc_prof, 0, sizeof(ptr->gc_prof));
|
||||||
} else
|
} else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user