2 * Copyright (c) 2015 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 Copyright (c) 2001, 2002, 2003 Eliot Dresselhaus
17 Written by Fred Delley <fdelley@cisco.com> .
19 Permission is hereby granted, free of charge, to any person obtaining
20 a copy of this software and associated documentation files (the
21 "Software"), to deal in the Software without restriction, including
22 without limitation the rights to use, copy, modify, merge, publish,
23 distribute, sublicense, and/or sell copies of the Software, and to
24 permit persons to whom the Software is furnished to do so, subject to
25 the following conditions:
27 The above copyright notice and this permission notice shall be
28 included in all copies or substantial portions of the Software.
30 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
34 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
35 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39 #ifdef CLIB_LINUX_KERNEL
40 #include <linux/unistd.h>
49 #include <vppinfra/clib.h>
50 #include <vppinfra/mheap.h>
51 #include <vppinfra/format.h>
52 #include <vppinfra/error.h>
53 #include <vppinfra/random.h>
54 #include <vppinfra/time.h>
59 #define if_verbose(format,args...) \
60 if (verbose) { clib_warning(format, ## args); }
62 #define MAX_CHANGE 100
67 /* Values have to be sequential and start with 0. */
73 OP_IS_VEC_INSERT_ELTS,
85 /* Operations on vectors with custom headers. */
92 #define FIRST_VEC_OP OP_IS_VEC_RESIZE
93 #define LAST_VEC_OP OP_IS_VEC_PREPEND
94 #define FIRST_VEC_HDR_OP OP_IS_VEC_INIT_H
95 #define LAST_VEC_HDR_OP OP_IS_VEC_FREE_H
97 uword g_prob_ratio[] = {
98 [OP_IS_VEC_RESIZE] = 5,
100 [OP_IS_VEC_ADD2] = 5,
102 [OP_IS_VEC_INSERT] = 5,
103 [OP_IS_VEC_INSERT_ELTS] = 5,
104 [OP_IS_VEC_DELETE] = 30,
106 [OP_IS_VEC_IS_EQUAL] = 5,
107 [OP_IS_VEC_ZERO] = 2,
109 [OP_IS_VEC_VALIDATE] = 5,
110 [OP_IS_VEC_FREE] = 5,
111 [OP_IS_VEC_INIT] = 5,
112 [OP_IS_VEC_CLONE] = 5,
113 [OP_IS_VEC_APPEND] = 5,
114 [OP_IS_VEC_PREPEND] = 5,
115 /* Operations on vectors with custom headers. */
116 [OP_IS_VEC_INIT_H] = 5,
117 [OP_IS_VEC_RESIZE_H] = 5,
118 [OP_IS_VEC_FREE_H] = 5,
124 uword g_call_stats[OP_MAX];
127 /* A structure for both vector headers and vector elements might be useful to
128 uncover potential alignement issues. */
133 CLIB_PACKED (u32 field2);
139 CLIB_PACKED (u32 field2);
143 u32 g_seed = 0xdeadbabe;
148 uword g_set_verbose_at = ~0;
149 uword g_dump_period = ~0;
153 format_vec_op_type (u8 * s, va_list * args)
155 op_t op = va_arg (*args, int);
161 s = format (s, "OP_IS_" #n); \
186 s = format (s, "Unknown vec op (%d)", op);
196 dump_call_stats (uword * stats)
200 fformat (stdout, "Call Stats\n----------\n");
202 for (i = 0; i < OP_MAX; i++)
203 fformat (stdout, "%-8d %U\n", stats[i], format_vec_op_type, i);
207 /* XXX - Purposely low value for debugging the validator. Will be set it to a
208 more sensible value later. */
209 #define MAX_VEC_LEN 10
211 #define create_random_vec_wh(elt_type, len, hdr_bytes, seed) \
213 elt_type * _v(v) = NULL; \
214 uword _v(l) = (len); \
215 uword _v(h) = (hdr_bytes); \
221 /* ~0 means select random length between 0 and MAX_VEC_LEN. */ \
223 _v(l) = bounded_random_u32 (&(seed), 0, MAX_VEC_LEN); \
225 _v(v) = _vec_resize (NULL, _v(l), _v(l) * sizeof (elt_type), _v(h), 0); \
226 fill_with_random_data (_v(v), vec_bytes (_v(v)), (seed)); \
228 /* Fill header with random data as well. */ \
231 _v(hdr) = vec_header (_v(v), _v(h)); \
232 fill_with_random_data (_v(hdr), _v(h), (seed)); \
239 #define create_random_vec(elt_type, len, seed) \
240 create_random_vec_wh (elt_type, len, 0, seed)
242 #define compute_vec_hash(hash, vec) \
244 u8 * _v(v) = (u8 *) (vec); \
245 uword _v(n) = vec_len (vec) * sizeof ((vec)[0]); \
246 u8 _v(hh) = (u8) (hash); \
248 compute_mem_hash (_v(hh), _v(v), _v(n)); \
252 validate_vec_free (elt_t * vec)
255 ASSERT (vec == NULL);
260 validate_vec_free_h (elt_t * vec, uword hdr_bytes)
262 vec_free_h (vec, hdr_bytes);
263 ASSERT (vec == NULL);
268 validate_vec_hdr (elt_t * vec, uword hdr_bytes)
277 vh = _vec_find (vec);
278 hdr = vec_header (vec, hdr_bytes);
279 hdr_end = vec_header_end (hdr, hdr_bytes);
281 ASSERT (hdr_end == (u8 *) vec);
282 ASSERT ((u8 *) vh - (u8 *) hdr >= hdr_bytes);
286 validate_vec_len (elt_t * vec)
299 end = (u8 *) vec_end (vec);
301 bytes = sizeof (vec[0]) * len;
303 ASSERT (bytes == vec_bytes (vec));
304 ASSERT ((ptr + bytes) == end);
308 /* XXX - TODO: confirm that auto-incrementing in vec_is_member() would not
309 have the expected result. */
310 while (vec_is_member (vec, (__typeof__ (vec[0]) *) ptr))
321 vec_foreach (elt, vec) i++;
327 validate_vec (elt_t * vec, uword hdr_bytes)
329 validate_vec_hdr (vec, hdr_bytes);
330 validate_vec_len (vec);
332 if (!vec || vec_len (vec) == 0)
334 VERBOSE3 ("Vector at %p has zero elements.\n\n", vec);
339 VERBOSE3 ("Header: %U\n",
340 format_hex_bytes, vec_header (vec, sizeof (vec[0])),
344 format_hex_bytes, vec, vec_len (vec) * sizeof (vec[0]));
349 validate_vec_resize (elt_t * vec, uword num_elts)
351 uword len1 = vec_len (vec);
353 u8 hash = compute_vec_hash (0, vec);
355 vec_resize (vec, num_elts);
356 len2 = vec_len (vec);
358 ASSERT (len2 == len1 + num_elts);
359 ASSERT (compute_vec_hash (hash, vec) == 0);
360 validate_vec (vec, 0);
365 validate_vec_resize_h (elt_t * vec, uword num_elts, uword hdr_bytes)
372 len1 = vec_len (vec);
375 hdr = vec_header (vec, hdr_bytes);
377 hash = compute_vec_hash (0, vec);
378 hdr_hash = compute_mem_hash (0, hdr, hdr_bytes);
380 vec_resize_ha (vec, num_elts, hdr_bytes, 0);
381 len2 = vec_len (vec);
383 ASSERT (len2 == len1 + num_elts);
385 end1 = (u8 *) (vec + len1);
386 end2 = (u8 *) vec_end (vec);
395 hdr = vec_header (vec, hdr_bytes);
397 ASSERT (compute_vec_hash (hash, vec) == 0);
398 ASSERT (compute_mem_hash (hdr_hash, hdr, hdr_bytes) == 0);
399 validate_vec (vec, 1);
404 generic_validate_vec_add (elt_t * vec, uword num_elts, uword is_add2)
406 uword len1 = vec_len (vec);
408 u8 hash = compute_vec_hash (0, vec);
413 vec_add2 (vec, new, num_elts);
417 new = create_random_vec (elt_t, num_elts, g_seed);
419 VERBOSE3 ("%U\n", format_hex_bytes, new,
420 vec_len (new) * sizeof (new[0]));
422 /* Add the hash value of the new elements to that of the old vector. */
423 hash = compute_vec_hash (hash, new);
426 vec_add1 (vec, new[0]);
427 else if (num_elts > 1)
428 vec_add (vec, new, num_elts);
433 len2 = vec_len (vec);
434 ASSERT (len2 == len1 + num_elts);
436 ASSERT (compute_vec_hash (hash, vec) == 0);
437 validate_vec (vec, 0);
442 validate_vec_add1 (elt_t * vec)
444 return generic_validate_vec_add (vec, 1, 0);
448 validate_vec_add2 (elt_t * vec, uword num_elts)
450 return generic_validate_vec_add (vec, num_elts, 1);
454 validate_vec_add (elt_t * vec, uword num_elts)
456 return generic_validate_vec_add (vec, num_elts, 0);
460 validate_vec_insert (elt_t * vec, uword num_elts, uword start_elt)
462 uword len1 = vec_len (vec);
466 /* vec_insert() would not handle it properly. */
467 if (start_elt > len1 || num_elts == 0)
470 hash = compute_vec_hash (0, vec);
471 vec_insert (vec, num_elts, start_elt);
472 len2 = vec_len (vec);
474 ASSERT (len2 == len1 + num_elts);
475 ASSERT (compute_vec_hash (hash, vec) == 0);
476 validate_vec (vec, 0);
481 validate_vec_insert_elts (elt_t * vec, uword num_elts, uword start_elt)
483 uword len1 = vec_len (vec);
488 /* vec_insert_elts() would not handle it properly. */
489 if (start_elt > len1 || num_elts == 0)
492 new = create_random_vec (elt_t, num_elts, g_seed);
494 VERBOSE3 ("%U\n", format_hex_bytes, new, vec_len (new) * sizeof (new[0]));
496 /* Add the hash value of the new elements to that of the old vector. */
497 hash = compute_vec_hash (0, vec);
498 hash = compute_vec_hash (hash, new);
500 vec_insert_elts (vec, new, num_elts, start_elt);
501 len2 = vec_len (vec);
505 ASSERT (len2 == len1 + num_elts);
506 ASSERT (compute_vec_hash (hash, vec) == 0);
507 validate_vec (vec, 0);
512 validate_vec_delete (elt_t * vec, uword num_elts, uword start_elt)
514 uword len1 = vec_len (vec);
520 /* vec_delete() would not handle it properly. */
521 if (start_elt + num_elts > len1)
524 start = (u8 *) vec + (start_elt * sizeof (vec[0]));
526 hash = compute_vec_hash (0, vec);
527 hash_del = compute_mem_hash (0, start, num_elts * sizeof (vec[0]));
530 vec_delete (vec, num_elts, start_elt);
531 len2 = vec_len (vec);
533 ASSERT (len2 == len1 - num_elts);
534 ASSERT (compute_vec_hash (hash, vec) == 0);
535 validate_vec (vec, 0);
540 validate_vec_dup (elt_t * vec)
545 hash = compute_vec_hash (0, vec);
548 ASSERT (compute_vec_hash (hash, new) == 0);
550 validate_vec (new, 0);
555 validate_vec_zero (elt_t * vec)
563 end = (u8 *) (vec + vec_len (vec));
567 ASSERT (ptr < (u8 *) vec_end (vec));
568 ASSERT (ptr[0] == 0);
572 validate_vec (vec, 0);
577 validate_vec_is_equal (elt_t * vec)
581 if (vec_len (vec) <= 0)
585 ASSERT (vec_is_equal (new, vec));
590 validate_vec_set (elt_t * vec)
593 uword len = vec_len (vec);
599 new = create_random_vec (elt_t, 1, g_seed);
601 VERBOSE3 ("%U\n", format_hex_bytes, new, vec_len (new) * sizeof (new[0]));
603 vec_set (vec, new[0]);
605 for (i = 0; i < len; i++)
606 ASSERT (memcmp (&vec[i], &new[0], sizeof (vec[0])) == 0);
609 validate_vec (vec, 0);
614 validate_vec_validate (elt_t * vec, uword index)
616 uword len = vec_len (vec);
617 word num_new = index - len + 1;
620 u8 hash = compute_vec_hash (0, vec);
625 vec_validate (vec, index);
627 /* Old len but new vec pointer! */
628 ptr = (u8 *) (vec + len);
629 end = (u8 *) (vec + len + num_new);
631 ASSERT (len + num_new == vec_len (vec));
632 ASSERT (compute_vec_hash (hash, vec) == 0);
636 ASSERT (ptr < (u8 *) vec_end (vec));
637 ASSERT (ptr[0] == 0);
641 validate_vec (vec, 0);
646 validate_vec_init (uword num_elts)
653 new = vec_new (elt_t, num_elts);
656 ASSERT (len == num_elts);
659 end = (u8 *) (new + len);
663 ASSERT (ptr < (u8 *) vec_end (new));
664 ASSERT (ptr[0] == 0);
668 validate_vec (new, 0);
673 validate_vec_init_h (uword num_elts, uword hdr_bytes)
681 new = vec_new_ha (elt_t, num_elts, hdr_bytes, 0);
684 ASSERT (len == num_elts);
686 /* We have 2 zero-regions to check: header & vec data (skip _VEC struct). */
687 for (i = 0; i < 2; i++)
691 ptr = (u8 *) vec_header (new, hdr_bytes);
692 end = ptr + hdr_bytes;
697 end = (u8 *) (new + len);
702 ASSERT (ptr < (u8 *) vec_end (new));
703 ASSERT (ptr[0] == 0);
708 validate_vec (new, 1);
712 /* XXX - I don't understand the purpose of the vec_clone() call. */
714 validate_vec_clone (elt_t * vec)
718 vec_clone (new, vec);
720 ASSERT (vec_len (new) == vec_len (vec));
721 ASSERT (compute_vec_hash (0, new) == 0);
722 validate_vec (new, 0);
727 validate_vec_append (elt_t * vec)
730 uword num_elts = bounded_random_u32 (&g_seed, 0, MAX_CHANGE);
734 new = create_random_vec (elt_t, num_elts, g_seed);
736 len = vec_len (vec) + vec_len (new);
737 hash = compute_vec_hash (0, vec);
738 hash = compute_vec_hash (hash, new);
740 vec_append (vec, new);
743 ASSERT (vec_len (vec) == len);
744 ASSERT (compute_vec_hash (hash, vec) == 0);
745 validate_vec (vec, 0);
750 validate_vec_prepend (elt_t * vec)
753 uword num_elts = bounded_random_u32 (&g_seed, 0, MAX_CHANGE);
757 new = create_random_vec (elt_t, num_elts, g_seed);
759 len = vec_len (vec) + vec_len (new);
760 hash = compute_vec_hash (0, vec);
761 hash = compute_vec_hash (hash, new);
763 vec_prepend (vec, new);
766 ASSERT (vec_len (vec) == len);
767 ASSERT (compute_vec_hash (hash, vec) == 0);
768 validate_vec (vec, 0);
773 run_validator_wh (uword iter)
781 f64 time[3]; /* [0]: start, [1]: last, [2]: current */
783 vec = create_random_vec_wh (elt_t, ~0, sizeof (hdr_t), g_seed);
784 validate_vec (vec, 0);
785 VERBOSE2 ("Start with len %d\n", vec_len (vec));
787 time[0] = unix_time_now ();
789 dump_time = g_dump_period;
791 for (i = 1; i <= iter; i++)
793 if (i >= g_set_verbose_at)
796 op = bounded_random_u32 (&g_seed, 0, vec_len (g_prob_wh) - 1);
801 case OP_IS_VEC_INIT_H:
802 num_elts = bounded_random_u32 (&g_seed, 0, MAX_CHANGE);
803 vec_free_h (vec, sizeof (hdr_t));
804 VERBOSE2 ("vec_init_h(), new elts %d\n", num_elts);
805 vec = validate_vec_init_h (num_elts, sizeof (hdr_t));
808 case OP_IS_VEC_RESIZE_H:
810 num_elts = bounded_random_u32 (&g_seed, len, len + MAX_CHANGE);
811 VERBOSE2 ("vec_resize_h(), %d new elts.\n", num_elts);
812 vec = validate_vec_resize_h (vec, num_elts, sizeof (hdr_t));
815 case OP_IS_VEC_FREE_H:
816 VERBOSE2 ("vec_free_h()\n");
817 vec = validate_vec_free_h (vec, sizeof (hdr_t));
829 time[2] = unix_time_now ();
830 VERBOSE1 ("%d vec ops in %f secs. (last %d in %f secs.).\n",
831 i, time[2] - time[0], g_dump_period, time[2] - time[1]);
833 dump_time += g_dump_period;
835 VERBOSE1 ("vec len %d\n", vec_len (vec));
837 format_hex_bytes, vec, vec_len (vec) * sizeof (vec[0]));
840 VERBOSE2 ("len %d\n", vec_len (vec));
843 validate_vec (vec, sizeof (hdr_t));
844 vec_free_h (vec, sizeof (hdr_t));
848 run_validator (uword iter)
858 f64 time[3]; /* [0]: start, [1]: last, [2]: current */
860 vec = create_random_vec (elt_t, ~0, g_seed);
861 validate_vec (vec, 0);
862 VERBOSE2 ("Start with len %d\n", vec_len (vec));
864 time[0] = unix_time_now ();
866 dump_time = g_dump_period;
868 for (i = 1; i <= iter; i++)
870 if (i >= g_set_verbose_at)
873 op = bounded_random_u32 (&g_seed, 0, vec_len (g_prob) - 1);
878 case OP_IS_VEC_RESIZE:
880 num_elts = bounded_random_u32 (&g_seed, len, len + MAX_CHANGE);
881 VERBOSE2 ("vec_resize(), %d new elts.\n", num_elts);
882 vec = validate_vec_resize (vec, num_elts);
886 VERBOSE2 ("vec_add1()\n");
887 vec = validate_vec_add1 (vec);
891 num_elts = bounded_random_u32 (&g_seed, 0, MAX_CHANGE);
892 VERBOSE2 ("vec_add2(), %d new elts.\n", num_elts);
893 vec = validate_vec_add2 (vec, num_elts);
897 num_elts = bounded_random_u32 (&g_seed, 0, MAX_CHANGE);
898 VERBOSE2 ("vec_add(), %d new elts.\n", num_elts);
899 vec = validate_vec_add (vec, num_elts);
902 case OP_IS_VEC_INSERT:
904 num_elts = bounded_random_u32 (&g_seed, 0, MAX_CHANGE);
905 index = bounded_random_u32 (&g_seed, 0,
906 (len > 0) ? (len - 1) : (0));
907 VERBOSE2 ("vec_insert(), %d new elts, index %d.\n", num_elts,
909 vec = validate_vec_insert (vec, num_elts, index);
912 case OP_IS_VEC_INSERT_ELTS:
914 num_elts = bounded_random_u32 (&g_seed, 0, MAX_CHANGE);
915 index = bounded_random_u32 (&g_seed, 0,
916 (len > 0) ? (len - 1) : (0));
917 VERBOSE2 ("vec_insert_elts(), %d new elts, index %d.\n",
919 vec = validate_vec_insert_elts (vec, num_elts, index);
922 case OP_IS_VEC_DELETE:
924 index = bounded_random_u32 (&g_seed, 0, len - 1);
925 num_elts = bounded_random_u32 (&g_seed, 0,
926 (len > index) ? (len - index) : (0));
927 VERBOSE2 ("vec_delete(), %d elts, index %d.\n", num_elts, index);
928 vec = validate_vec_delete (vec, num_elts, index);
932 VERBOSE2 ("vec_dup()\n");
933 new = validate_vec_dup (vec);
937 case OP_IS_VEC_IS_EQUAL:
938 VERBOSE2 ("vec_is_equal()\n");
939 validate_vec_is_equal (vec);
943 VERBOSE2 ("vec_zero()\n");
944 vec = validate_vec_zero (vec);
948 VERBOSE2 ("vec_set()\n");
949 vec = validate_vec_set (vec);
952 case OP_IS_VEC_VALIDATE:
954 index = bounded_random_u32 (&g_seed, 0, len - 1 + MAX_CHANGE);
955 VERBOSE2 ("vec_validate(), index %d\n", index);
956 vec = validate_vec_validate (vec, index);
960 VERBOSE2 ("vec_free()\n");
961 vec = validate_vec_free (vec);
965 num_elts = bounded_random_u32 (&g_seed, 0, MAX_CHANGE);
967 VERBOSE2 ("vec_init(), new elts %d\n", num_elts);
968 vec = validate_vec_init (num_elts);
971 case OP_IS_VEC_CLONE:
972 VERBOSE2 ("vec_clone()\n");
973 new = validate_vec_clone (vec);
977 case OP_IS_VEC_APPEND:
978 VERBOSE2 ("vec_append()\n");
979 vec = validate_vec_append (vec);
982 case OP_IS_VEC_PREPEND:
983 VERBOSE2 ("vec_prepend()\n");
984 vec = validate_vec_prepend (vec);
996 time[2] = unix_time_now ();
997 VERBOSE1 ("%d vec ops in %f secs. (last %d in %f secs.).\n",
998 i, time[2] - time[0], g_dump_period, time[2] - time[1]);
1000 dump_time += g_dump_period;
1002 VERBOSE1 ("vec len %d\n", vec_len (vec));
1004 format_hex_bytes, vec, vec_len (vec) * sizeof (vec[0]));
1007 VERBOSE2 ("len %d\n", vec_len (vec));
1010 validate_vec (vec, 0);
1017 uword i, j, ratio, len, index;
1019 /* Create the vector to implement the statistical profile:
1020 vec [ op1 op1 op1 op2 op3 op3 op3 op4 op4 .... ] */
1021 for (i = FIRST_VEC_OP; i <= LAST_VEC_OP; i++)
1023 ratio = g_prob_ratio[i];
1027 len = vec_len (g_prob);
1028 index = len - 1 + ratio;
1029 ASSERT (index >= 0);
1031 /* Pre-allocate new elements. */
1032 vec_validate (g_prob, index);
1034 for (j = len; j <= index; j++)
1038 /* Operations on vectors with headers. */
1039 for (i = FIRST_VEC_HDR_OP; i <= LAST_VEC_HDR_OP; i++)
1041 ratio = g_prob_ratio[i];
1045 len = vec_len (g_prob_wh);
1046 index = len - 1 + ratio;
1047 ASSERT (index >= 0);
1049 /* Pre-allocate new elements. */
1050 vec_validate (g_prob_wh, index);
1052 for (j = len; j <= index; j++)
1056 VERBOSE3 ("prob_vec, len %d\n%U\n", vec_len (g_prob),
1057 format_hex_bytes, g_prob, vec_len (g_prob) * sizeof (g_prob[0]));
1058 VERBOSE3 ("prob_vec_wh, len %d\n%U\n", vec_len (g_prob_wh),
1059 format_hex_bytes, g_prob_wh,
1060 vec_len (g_prob_wh) * sizeof (g_prob_wh[0]));
1067 vec_free (g_prob_wh);
1071 test_vec_main (unformat_input_t * input)
1077 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
1079 if (0 == unformat (input, "iter %d", &iter)
1080 && 0 == unformat (input, "seed %d", &g_seed)
1081 && 0 == unformat (input, "verbose %d", &g_verbose)
1082 && 0 == unformat (input, "set %d", &g_set_verbose_at)
1083 && 0 == unformat (input, "dump %d", &g_dump_period)
1084 && 0 == unformat (input, "help %=", &help, 1)
1085 && 0 == unformat (input, "big %=", &big, 1))
1087 clib_error ("unknown input `%U'", format_unformat_error, input);
1095 u64 one_gig = (1 << 30);
1099 fformat (stdout, "giant vector test...");
1100 size = 5ULL * one_gig;
1102 vec_validate (bigboy, size);
1104 for (index = size; index >= 0; index--)
1105 bigboy[index] = index & 0xff;
1114 run_validator (iter);
1115 run_validator_wh (iter);
1117 dump_call_stats (g_call_stats);
1127 fformat (stdout, "Usage: test_vec iter <N> seed <N> verbose <N> "
1128 "set <N> dump <N>\n");
1137 main (int argc, char *argv[])
1142 mheap_alloc (0, (uword) 10ULL << 30);
1144 verbose = (argc > 1);
1145 unformat_init_command_line (&i, argv);
1146 ret = test_vec_main (&i);
1151 #endif /* CLIB_UNIX */
1154 * fd.io coding-style-patch-verification: ON
1157 * eval: (c-set-style "gnu")