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

Function test_hash_multiwriter

dpdk/app/test/test_hash_multiwriter.c:98–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96
97
98static int
99test_hash_multiwriter(void)
100{
101 unsigned int i, rounded_nb_total_tsx_insertion;
102 static unsigned calledCount = 1;
103 uint16_t enabled_core_ids[RTE_MAX_LCORE];
104 uint16_t core_id;
105
106 uint32_t *keys;
107 uint32_t *found;
108
109 struct rte_hash_parameters hash_params = {
110 .entries = nb_entries,
111 .key_len = sizeof(uint32_t),
112 .hash_func = rte_jhash,
113 .hash_func_init_val = 0,
114 .socket_id = rte_socket_id(),
115 };
116 if (use_htm)
117 hash_params.extra_flag =
118 RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT
119 | RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD;
120 else
121 hash_params.extra_flag =
122 RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD;
123
124 struct rte_hash *handle;
125 char name[RTE_HASH_NAMESIZE];
126
127 const void *next_key;
128 void *next_data;
129 uint32_t iter = 0;
130
131 uint32_t duplicated_keys = 0;
132 uint32_t lost_keys = 0;
133 uint32_t count;
134
135 snprintf(name, 32, "test%u", calledCount++);
136 hash_params.name = name;
137
138 handle = rte_hash_create(&hash_params);
139 RETURN_IF_ERROR(handle == NULL, "hash creation failed");
140
141 tbl_multiwriter_test_params.h = handle;
142 tbl_multiwriter_test_params.nb_tsx_insertion =
143 nb_total_tsx_insertion / rte_lcore_count();
144
145 rounded_nb_total_tsx_insertion = (nb_total_tsx_insertion /
146 tbl_multiwriter_test_params.nb_tsx_insertion)
147 * tbl_multiwriter_test_params.nb_tsx_insertion;
148
149 rte_srand(rte_rdtsc());
150
151 keys = rte_malloc(NULL, sizeof(uint32_t) * nb_entries, 0);
152
153 if (keys == NULL) {
154 printf("RTE_MALLOC failed\n");
155 goto err1;

Callers 1

Calls 15

rte_socket_idFunction · 0.85
snprintfFunction · 0.85
rte_hash_createFunction · 0.85
rte_lcore_countFunction · 0.85
rte_srandFunction · 0.85
rte_mallocFunction · 0.85
rte_zmallocFunction · 0.85
rte_lcore_is_enabledFunction · 0.85
rte_eal_mp_remote_launchFunction · 0.85
rte_eal_mp_wait_lcoreFunction · 0.85
rte_hash_countFunction · 0.85
rte_hash_iterateFunction · 0.85

Tested by

no test coverage detected