Skip to content

Commit

Permalink
Add extra debugging output concerning binsearch (debug.shmem)
Browse files Browse the repository at this point in the history
Signed-off-by: DL6ER <[email protected]>
  • Loading branch information
DL6ER committed Nov 16, 2024
1 parent 26d1dd3 commit c27bff9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lookup-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ bool lookup_insert(const enum memory_type type, const unsigned int id, const uin
// We do not check the return value as we are inserting a new element
// and don't care if elements with the same hash value exist already
struct lookup_table *try = table;
log_debug(DEBUG_SHMEM, "Inserting element with ID %u and hash %u into %s lookup table (%p, %u)",
id, hash, name, table, *size);
binsearch(table, hash, *size, &try);

// Calculate the position where the element would be inserted
Expand Down Expand Up @@ -254,6 +256,8 @@ bool lookup_remove(const enum memory_type type, const unsigned int id, const uin

// Find the correct position in the lookup_table array
struct lookup_table *try = NULL;
log_debug(DEBUG_SHMEM, "Removing element with ID %u and hash %u from %s lookup table (%p, %u)",
id, hash, name, table, *size);
if(!binsearch(table, hash, *size, &try))
{
// The element is not in the array
Expand Down Expand Up @@ -334,6 +338,8 @@ bool lookup_find_id(const enum memory_type type, const uint32_t hash, const stru

// Find the correct position in the lookup_table array
struct lookup_table *try = NULL;
log_debug(DEBUG_SHMEM, "Looking for element with hash %u in %s lookup table (%p, %u)",
hash, name, table, *size);
if(!binsearch(table, hash, *size, &try))
return false;

Expand Down

0 comments on commit c27bff9

Please sign in to comment.