aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/test_vec.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-07-04 10:56:23 -0400
committerDamjan Marion <dmarion@me.com>2018-07-18 12:09:42 +0000
commit6a5adc369591fcac2447e9809deaa22f56b53911 (patch)
treec9a56b1ed0d5e8eb2f21a843552c6c0bc6df5597 /src/vppinfra/test_vec.c
parent2a3fb1a28b170ac1d37815983611e83d148811d4 (diff)
Add config option to use dlmalloc instead of mheap
Configure w/ --enable-dlmalloc, see .../build-data/platforms/vpp.mk src/vppinfra/dlmalloc.[ch] are slightly modified versions of the well-known Doug Lea malloc. Main advantage: dlmalloc mspaces have no inherent size limit. Change-Id: I19b3f43f3c65bcfb82c1a265a97922d01912446e Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vppinfra/test_vec.c')
-rw-r--r--src/vppinfra/test_vec.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/vppinfra/test_vec.c b/src/vppinfra/test_vec.c
index f0497ac640e..ee17ef14244 100644
--- a/src/vppinfra/test_vec.c
+++ b/src/vppinfra/test_vec.c
@@ -47,7 +47,6 @@
#endif
#include <vppinfra/clib.h>
-#include <vppinfra/mheap.h>
#include <vppinfra/format.h>
#include <vppinfra/error.h>
#include <vppinfra/random.h>
@@ -1068,11 +1067,18 @@ prob_free (void)
}
int
+vl (void *v)
+{
+ return vec_len (v);
+}
+
+int
test_vec_main (unformat_input_t * input)
{
uword iter = 1000;
uword help = 0;
uword big = 0;
+ uword align = 0;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
@@ -1082,7 +1088,8 @@ test_vec_main (unformat_input_t * input)
&& 0 == unformat (input, "set %d", &g_set_verbose_at)
&& 0 == unformat (input, "dump %d", &g_dump_period)
&& 0 == unformat (input, "help %=", &help, 1)
- && 0 == unformat (input, "big %=", &big, 1))
+ && 0 == unformat (input, "big %=", &big, 1)
+ && 0 == unformat (input, "align %=", &align, 1))
{
clib_error ("unknown input `%U'", format_unformat_error, input);
goto usage;
@@ -1106,6 +1113,16 @@ test_vec_main (unformat_input_t * input)
return 0;
}
+ if (align)
+ {
+ u8 *v = 0;
+
+ vec_validate_aligned (v, 9, CLIB_CACHE_LINE_BYTES);
+ fformat (stdout, "v = 0x%llx, aligned %llx\n",
+ v, ((uword) v) & ~(CLIB_CACHE_LINE_BYTES - 1));
+ vec_free (v);
+ }
+
if (help)
goto usage;
@@ -1139,7 +1156,9 @@ main (int argc, char *argv[])
unformat_input_t i;
int ret;
- mheap_alloc (0, (uword) 10ULL << 30);
+ clib_mem_init (0, 3ULL << 30);
+
+ // mheap_alloc (0, (uword) 10ULL << 30);
verbose = (argc > 1);
unformat_init_command_line (&i, argv);