MCPcopy Create free account
hub / github.com/F-Stack/f-stack / timed_adds

Function timed_adds

dpdk/app/test/test_hash_perf.c:250–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250static int
251timed_adds(unsigned int with_hash, unsigned int with_data,
252 unsigned int table_index, unsigned int ext)
253{
254 unsigned i;
255 const uint64_t start_tsc = rte_rdtsc();
256 void *data;
257 int32_t ret;
258 unsigned int keys_to_add;
259 if (!ext)
260 keys_to_add = KEYS_TO_ADD * ADD_PERCENT;
261 else
262 keys_to_add = KEYS_TO_ADD;
263
264 for (i = 0; i < keys_to_add; i++) {
265 data = (void *) ((uintptr_t) signatures[i]);
266 if (with_hash && with_data) {
267 ret = rte_hash_add_key_with_hash_data(h[table_index],
268 (const void *) keys[i],
269 signatures[i], data);
270 if (ret < 0) {
271 printf("H+D: Failed to add key number %u\n", i);
272 return -1;
273 }
274 } else if (with_hash && !with_data) {
275 ret = rte_hash_add_key_with_hash(h[table_index],
276 (const void *) keys[i],
277 signatures[i]);
278 if (ret >= 0)
279 positions[i] = ret;
280 else {
281 printf("H: Failed to add key number %u\n", i);
282 return -1;
283 }
284 } else if (!with_hash && with_data) {
285 ret = rte_hash_add_key_data(h[table_index],
286 (const void *) keys[i],
287 data);
288 if (ret < 0) {
289 printf("D: Failed to add key number %u\n", i);
290 return -1;
291 }
292 } else {
293 ret = rte_hash_add_key(h[table_index], keys[i]);
294 if (ret >= 0)
295 positions[i] = ret;
296 else {
297 printf("Failed to add key number %u\n", i);
298 return -1;
299 }
300 }
301 }
302
303 const uint64_t end_tsc = rte_rdtsc();
304 const uint64_t time_taken = end_tsc - start_tsc;
305
306 cycles[table_index][OP_ADD][with_hash][with_data] = time_taken/keys_to_add;
307

Callers 1

run_all_tbl_perf_testsFunction · 0.70

Calls 6

rte_hash_add_key_dataFunction · 0.85
rte_hash_add_keyFunction · 0.85
rte_rdtscFunction · 0.50
printfFunction · 0.50

Tested by

no test coverage detected