forked from GitHub/gf-core
debug messages for revision handling
This commit is contained in:
@@ -403,13 +403,16 @@ void PgfDB::register_revision(object o)
|
|||||||
revision_entry *free_entry = NULL;
|
revision_entry *free_entry = NULL;
|
||||||
|
|
||||||
for (size_t i = 0; i < ms->n_revisions; i++) {
|
for (size_t i = 0; i < ms->n_revisions; i++) {
|
||||||
if (ms->revisions[i].ref_count == 0) {
|
revision_entry *entry = &ms->revisions[i];
|
||||||
|
if (entry->ref_count == 0) {
|
||||||
if (free_entry == NULL)
|
if (free_entry == NULL)
|
||||||
free_entry = &ms->revisions[i];
|
free_entry = entry;
|
||||||
} else if (ms->revisions[i].pid == pid &&
|
} else {
|
||||||
ms->revisions[i].o == o) {
|
if (entry->pid == pid &&
|
||||||
ms->revisions[i].ref_count++;
|
entry->o == o) {
|
||||||
goto done;
|
entry->ref_count++;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,12 +451,21 @@ void PgfDB::unregister_revision(object o)
|
|||||||
WaitForSingleObject(hMutex, INFINITE);
|
WaitForSingleObject(hMutex, INFINITE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
revision_entry *free_entry = NULL;
|
#ifdef DEBUG_MEMORY_ALLOCATOR
|
||||||
|
fprintf(stderr, "revisions");
|
||||||
|
#endif
|
||||||
|
|
||||||
ms->min_txn_id = SIZE_MAX;
|
ms->min_txn_id = SIZE_MAX;
|
||||||
for (size_t i = 0; i < ms->n_revisions; i++) {
|
for (size_t i = 0; i < ms->n_revisions; i++) {
|
||||||
revision_entry *entry = &ms->revisions[i];
|
revision_entry *entry = &ms->revisions[i];
|
||||||
if (entry->ref_count > 0) {
|
if (entry->ref_count > 0) {
|
||||||
|
#ifdef DEBUG_MEMORY_ALLOCATOR
|
||||||
|
fprintf(stderr, " %ld:%s(%016lx):%ld",
|
||||||
|
entry->txn_id,
|
||||||
|
((entry->o & MALLOC_ALIGN_MASK) == PgfPGF::tag) ? "pgf" : "concr",
|
||||||
|
entry->o & ~MALLOC_ALIGN_MASK,
|
||||||
|
entry->ref_count);
|
||||||
|
#endif
|
||||||
if (entry->pid == pid && entry->o == o) {
|
if (entry->pid == pid && entry->o == o) {
|
||||||
if (--entry->ref_count == 0) {
|
if (--entry->ref_count == 0) {
|
||||||
// Maybe this was the last revision in the list.
|
// Maybe this was the last revision in the list.
|
||||||
@@ -470,7 +482,9 @@ void PgfDB::unregister_revision(object o)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "minimal revision %ld\n", ms->min_txn_id);
|
#ifdef DEBUG_MEMORY_ALLOCATOR
|
||||||
|
fprintf(stderr, " minimal %ld\n", ms->min_txn_id);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
pthread_mutex_unlock(&ms->mutex);
|
pthread_mutex_unlock(&ms->mutex);
|
||||||
@@ -487,6 +501,10 @@ void PgfDB::cleanup_revisions()
|
|||||||
WaitForSingleObject(hMutex, INFINITE);
|
WaitForSingleObject(hMutex, INFINITE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG_MEMORY_ALLOCATOR
|
||||||
|
fprintf(stderr, "revisions");
|
||||||
|
#endif
|
||||||
|
|
||||||
ms->min_txn_id = SIZE_MAX;
|
ms->min_txn_id = SIZE_MAX;
|
||||||
// If there are dead processes, set their reference counts to 0.
|
// If there are dead processes, set their reference counts to 0.
|
||||||
for (size_t i = 0; i < ms->n_revisions; i++) {
|
for (size_t i = 0; i < ms->n_revisions; i++) {
|
||||||
@@ -507,6 +525,13 @@ void PgfDB::cleanup_revisions()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (alive) {
|
if (alive) {
|
||||||
|
#ifdef DEBUG_MEMORY_ALLOCATOR
|
||||||
|
fprintf(stderr, " %ld:%s(%016lx):%ld",
|
||||||
|
entry->txn_id,
|
||||||
|
((entry->o & MALLOC_ALIGN_MASK) == PgfPGF::tag) ? "pgf" : "concr",
|
||||||
|
entry->o & ~MALLOC_ALIGN_MASK,
|
||||||
|
entry->ref_count);
|
||||||
|
#endif
|
||||||
if (ms->min_txn_id > entry->txn_id)
|
if (ms->min_txn_id > entry->txn_id)
|
||||||
ms->min_txn_id = entry->txn_id;
|
ms->min_txn_id = entry->txn_id;
|
||||||
} else {
|
} else {
|
||||||
@@ -515,6 +540,10 @@ void PgfDB::cleanup_revisions()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_MEMORY_ALLOCATOR
|
||||||
|
fprintf(stderr, " minimal %ld\n", ms->min_txn_id);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
pthread_mutex_unlock(&ms->mutex);
|
pthread_mutex_unlock(&ms->mutex);
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user