9 /* This configuration will test mostly inserting of new elements since
10 the number of repeats is 1. It should also do a lot of rehashing */
12 /* This test case may fail depending on the system configuration.
13 Check the value of /proc/sys/vm/max_map_count and fix by doing
14 Ex: sudo sh -c "echo 131060 > /proc/sys/vm/max_map_count" */
16 #define NUM_MAPS 40000
17 #define ELEMENTS_PER_MAP 100
20 #define KEY_TYPE_FIXED_SIZE 8
21 void *key_buffer
= malloc (17);
22 typedef char * name_string
;
23 name_string fake_names
[NUM_MAPS
];
25 /* This variable has to be put in rel.ro */
26 void * maps
[NUM_MAPS
] VTV_PROTECTED_VAR
;
31 void * fake_vts
[NUM_MAPS
* ELEMENTS_PER_MAP
];
39 for (i
= 0; i
< NUM_MAPS
; ++i
)
41 fake_names
[i
] = (char *) malloc (9 * sizeof (char));
42 snprintf (fake_names
[i
], 9, "name%d", i
);
47 vtv_string_hash(const char *in
)
59 __VLTChangePermission(__VLTP_READ_WRITE
);
63 for (int k
= 0; k
< NUM_REPEATS
; k
++)
66 for (int i
= 0; i
< NUM_MAPS
; i
++)
68 uint32_t *value_ptr
= (uint32_t *) key_buffer
;
69 uint32_t len1
= strlen (fake_names
[i
]);
70 uint32_t hash_value
= vtv_string_hash (fake_names
[i
]);
71 void *temp_array
[ELEMENTS_PER_MAP
];
75 *value_ptr
= hash_value
;
77 memcpy ((char *) key_buffer
+ KEY_TYPE_FIXED_SIZE
, fake_names
[i
],
82 __VLTRegisterPairDebug (&maps
[i
], (char *) key_buffer
, 128,
83 &fake_vts
[curr_fake_vt
], "", "");
85 __VLTRegisterPair (&maps
[i
], (char *) key_buffer
, 128,
86 &fake_vts
[curr_fake_vt
]);
88 for (int j
= 0; j
< ELEMENTS_PER_MAP
; j
++)
90 temp_array
[j
] = &fake_vts
[curr_fake_vt
];
94 __VLTRegisterSetDebug (&maps
[i
], (char *) key_buffer
, 128, 100,
95 (void **) &temp_array
);
97 __VLTRegisterSet (&maps
[i
], (char *) key_buffer
, 128, 100,
98 (void **) &temp_array
);
103 __VLTChangePermission(__VLTP_READ_ONLY
);