summaryrefslogtreecommitdiff
path: root/ufdt_node_pool.c
diff options
context:
space:
mode:
authorSzuWei Lin <szuweilin@google.com>2017-06-09 16:44:23 +0800
committerSzuWei Lin <szuweilin@google.com>2017-06-15 10:50:01 +0800
commit79ba2aefbbc7fcf8f8b60b5efab417e5684b13b6 (patch)
treee2c61de445d9054bc08291095225e29399e2df67 /ufdt_node_pool.c
parent3f56fa74b40f290caac761bd03350ec1607dc3d8 (diff)
downloadlibufdt-79ba2aefbbc7fcf8f8b60b5efab417e5684b13b6.tar.gz
Add stress test case and some debug symbols
- A test case run_stress_tests.sh with a larger DTO test case - A flag to test with enabling valgrind - A flag to dump dtb when testing - A flag to disable memory pool machanism Bug: 62474732 Test: tests/run_stress_tests.sh with enabling flags Change-Id: Ibe4c3d1098bc732d21218e1bdc01eed49cf9e440
Diffstat (limited to 'ufdt_node_pool.c')
-rw-r--r--ufdt_node_pool.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ufdt_node_pool.c b/ufdt_node_pool.c
index dabb285..9f72b71 100644
--- a/ufdt_node_pool.c
+++ b/ufdt_node_pool.c
@@ -19,6 +19,9 @@
#include "libufdt_sysdeps.h"
#include "ufdt_types.h"
+/* Define DEBUG_DISABLE_POOL to use dto_malloc and dto_free directly */
+/* #define DEBUG_DISABLE_POOL */
+
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define UFDT_NODE_POOL_ENTRIES_PER_BLOCK 1024
@@ -171,6 +174,10 @@ static void _ufdt_node_pool_remove_block(
}
void *ufdt_node_pool_alloc(struct ufdt_node_pool *pool) {
+#ifdef DEBUG_DISABLE_POOL
+ return dto_malloc(UFDT_NODE_POOL_ENTRY_SIZE);
+#endif
+
// return dto_malloc(UFDT_NODE_POOL_ENTRY_SIZE);
// If there is no free block, create a new one
struct ufdt_node_pool_block_header *block = pool->first_block;
@@ -209,6 +216,10 @@ static struct ufdt_node_pool_block_header **_ufdt_node_pool_search_block(
}
void ufdt_node_pool_free(struct ufdt_node_pool *pool, void *node) {
+#ifdef DEBUG_DISABLE_POOL
+ return dto_free(node);
+#endif
+
struct ufdt_node_pool_block_header **block_ptr =
_ufdt_node_pool_search_block(pool, node);
if (*block_ptr == NULL) {