1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

hash_table: do not use printf() in hash_table_dump()

This commit is contained in:
Steffen Vogel 2018-08-13 15:26:43 +02:00
parent 14656232ad
commit 743d1dd22b
5 changed files with 14 additions and 13 deletions

View file

@ -79,4 +79,4 @@ struct hook_type * hook_type_lookup(const char *name);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -30,8 +30,9 @@
extern "C" {
#endif
/* Forward declaratio */
/* Forward declarations */
struct memory_type;
struct node;
typedef struct memory_allocation * (*memory_allocator_t)(struct memory_type *mem, size_t len, size_t alignment);
typedef int (*memory_deallocator_t)(struct memory_type *mem, struct memory_allocation * ma);
@ -58,10 +59,6 @@ struct memory_type {
extern struct memory_type memory_heap;
extern struct memory_type memory_hugepage;
struct ibv_mr * memory_type_ib_mr(void *ptr);
struct node;
struct memory_type * memory_ib(struct node *n, struct memory_type *parent);
struct memory_type * memory_managed(void *ptr, size_t len);

View file

@ -45,12 +45,13 @@ struct sample;
struct node_type {
int vectorize; /**< Maximal vector length supported by this node type. Zero is unlimited. */
enum state state; /**< State of this node-type. */
struct list instances; /**< A list of all existing nodes of this type. */
size_t size; /**< Size of private data bock. @see node::_vd */
size_t pool_size;
enum state state;
struct {
/** Global initialization per node type.
*
@ -172,7 +173,7 @@ struct node_type {
/** Return a file descriptor which can be used by poll / select to detect the availability of new data. */
int (*fd)(struct node *n);
/** */
/** Return a memory allocator which should be used for sample pools passed to this node. */
struct memory_type * (*memory_type)(struct node *n, struct memory_type *parent);
};

View file

@ -62,7 +62,7 @@ struct queue {
atomic_state state;
size_t buffer_mask;
off_t buffer_off; /**< Relative pointer to struct queue_cell[] */
off_t buffer_off; /**< Relative pointer to struct queue_cell[] */
cacheline_pad_t _pad1; /**< Producer area: only producers read & write */

View file

@ -192,10 +192,13 @@ void hash_table_dump(struct hash_table *ht)
pthread_mutex_lock(&ht->lock);
for (int i = 0; i < ht->size; i++) {
printf("%i: ", i);
char *strlst = NULL;
for (hte = ht->table[i]; hte; hte = hte->next)
printf("%p->%p ", hte->key, hte->data);
printf("\n");
strcatf(&strlst, "%p->%p ", hte->key, hte->data);
info("%i: %s", i, strlst);
free(strlst);
}
pthread_mutex_unlock(&ht->lock);