mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-29 08:58:48 +08:00
mdbx: отладка всплесков GC в Erigon.
This commit is contained in:
parent
c35f5c7517
commit
661372d66d
6
mdbx.h
6
mdbx.h
@ -4111,6 +4111,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
|
||||||
|
18
src/core.c
18
src/core.c
@ -8004,7 +8004,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 |= MDBX_ALLOC_SHOULD_SCAN;
|
flags |= MDBX_ALLOC_SHOULD_SCAN;
|
||||||
if (AUDIT_ENABLED()) {
|
if (AUDIT_ENABLED()) {
|
||||||
if (unlikely(!pnl_check(txn->tw.relist, txn->mt_next_pgno))) {
|
if (unlikely(!pnl_check(txn->tw.relist, txn->mt_next_pgno))) {
|
||||||
@ -12084,6 +12092,16 @@ 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->me_txn0)
|
if (txn == env->me_txn0)
|
||||||
memset(&ptr->gc_prof, 0, sizeof(ptr->gc_prof));
|
memset(&ptr->gc_prof, 0, sizeof(ptr->gc_prof));
|
||||||
} else
|
} else
|
||||||
|
@ -756,6 +756,12 @@ typedef struct profgc_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;
|
||||||
} profgc_stat_t;
|
} profgc_stat_t;
|
||||||
|
|
||||||
/* Statistics of page operations overall of all (running, completed and aborted)
|
/* Statistics of page operations overall of all (running, completed and aborted)
|
||||||
|
@ -89,7 +89,7 @@
|
|||||||
|
|
||||||
/** Controls profiling of GC search and updates. */
|
/** Controls profiling of GC search and updates. */
|
||||||
#ifndef MDBX_ENABLE_PROFGC
|
#ifndef MDBX_ENABLE_PROFGC
|
||||||
#define MDBX_ENABLE_PROFGC 0
|
#define MDBX_ENABLE_PROFGC 1
|
||||||
#elif !(MDBX_ENABLE_PROFGC == 0 || MDBX_ENABLE_PROFGC == 1)
|
#elif !(MDBX_ENABLE_PROFGC == 0 || MDBX_ENABLE_PROFGC == 1)
|
||||||
#error MDBX_ENABLE_PROFGC must be defined as 0 or 1
|
#error MDBX_ENABLE_PROFGC must be defined as 0 or 1
|
||||||
#endif /* MDBX_ENABLE_PROFGC */
|
#endif /* MDBX_ENABLE_PROFGC */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user