> -----Original Message-----
> From: Wang, Yipeng1
> Sent: Wednesday, September 27, 2017 6:41 PM
> To: dev@dpdk.org
> Cc: tho...@monjalon.net; Tai, Charlie <charlie....@intel.com>; Gobriel,
> Sameh <sameh.gobr...@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.gua...@intel.com>; Mcnamara, John
> <john.mcnam...@intel.com>; Wang, Yipeng1 <yipeng1.w...@intel.com>
> Subject: [PATCH v4 6/7] test/member: add functional and perf tests
> 
> This patch adds functional and performance tests for membership library.
> 
> Signed-off-by: Yipeng Wang <yipeng1.w...@intel.com>

...

> +++ b/test/test/test_member.c

...

> +
> +#define MAX_ENTRIES (1 << 16)
> +uint8_t gened_keys[MAX_ENTRIES][KEY_SIZE];

Gened? Is this "generated"? Maybe it is worth using the full word.


> +
> +static struct rte_member_parameters params = {
> +             .num_keys = MAX_ENTRIES,       /* Total hash table entries.
> */
> +             .key_len = KEY_SIZE,       /* Length of hash key. */

Align comments with tabs.

> +
> +             /*num_set and false_positive_rate only relevant to vBF
> setsum*/

Add whitespaces around comment.

> +             .num_set = 32,
> +             .false_positive_rate = 0.03,
> +             .prim_hash_seed = 1,
> +             .sec_hash_seed = 11,
> +             .socket_id = 0          /* NUMA Socket ID for memory. */
> +};


> +static int test_member_insert(void)
> +{
> +     int ret_ht, ret_cache, ret_vbf, i;
> +
> +     for (i = 0; i < 5; i++) {

Use macro for the value 5, used here and other functions.

> +             ret_ht = rte_member_add(setsum_ht, &keys[i], test_set[i]);
> +             ret_cache = rte_member_add(setsum_cache, &keys[i],
> +                                             test_set[i]);
> +             ret_vbf = rte_member_add(setsum_vbf, &keys[i],
> test_set[i]);
> +             TEST_ASSERT(ret_ht >= 0 && ret_cache >= 0 && ret_vbf >=
> 0,
> +                             "insert error");
> +     }
> +     printf("insert key success\n");
> +     return 0;
> +}

...

> +static int test_member_multimatch(void) {
> +     int ret_ht, ret_vbf, ret_cache;
> +     member_set_t set_ids_ht[32] = {0};

Same comment about the value 5 applies here, for the value 32.

> +     member_set_t set_ids_vbf[32] = {0};
> +     member_set_t set_ids_cache[32] = {0};
> +
> +     member_set_t set_ids_ht_m[5][32] = {{0} };
> +     member_set_t set_ids_vbf_m[5][32] = {{0} };
> +     member_set_t set_ids_cache_m[5][32] = {{0} };
> +
> +     uint32_t match_count_ht[5];
> +     uint32_t match_count_vbf[5];
> +     uint32_t match_count_cache[5];
> +
> +     uint32_t num_key_ht = 5;
> +     uint32_t num_key_vbf = 5;
> +     uint32_t num_key_cache = 5;
> +
> +     const void *key_array[5];
> +
> +     uint32_t i, j;
> +
> +     /* same key at most inserted 2*entry_per_bucket times for HT
> mode */
> +     for (i = 1; i < 33; i++) {

This 33 can be expressed as 32 + 1 (using macro for 32).
Also, add a comment explaining why you are skipping value 0.

...

> --- /dev/null
> +++ b/test/test/test_member_perf.c
> @@ -0,0 +1,630 @@

...

> +static int
> +timed_lookups_bulk(struct member_perf_params *params, int type) {
> +     unsigned int i, j, k;
> +     member_set_t result[BURST_SIZE] = {0};
> +     const void *keys_burst[BURST_SIZE];
> +     int ret;
> +
> +     false_data_bulk[type][params->cycle] = 0;
> +
> +     const uint64_t start_tsc = rte_rdtsc();
> +
> +     for (i = 0; i < NUM_LOOKUPS / KEYS_TO_ADD; i++) {
> +             for (j = 0; j < KEYS_TO_ADD / BURST_SIZE; j++) {
> +                     for (k = 0; k < BURST_SIZE; k++)
> +                             keys_burst[k] = keys[j * BURST_SIZE + k];
> +
> +                     ret = rte_member_lookup_bulk(params-
> >setsum[type],
> +                             &keys_burst[0],

Using keys_burst directly is equivalent to this, right?

...

> +static int
> +timed_lookups_multimatch(struct member_perf_params *params, int
> type) {
> +     unsigned int i, j;
> +     member_set_t result[RTE_MEMBER_BUCKET_ENTRIES] = {0};
> +     int ret;
> +     false_data_multi[type][params->cycle] = 0;
> +
> +     const uint64_t start_tsc = rte_rdtsc();
> +
> +     for (i = 0; i < NUM_LOOKUPS / KEYS_TO_ADD; i++) {
> +             for (j = 0; j < KEYS_TO_ADD; j++) {
> +                     ret = rte_member_lookup_multi(params-
> >setsum[type],
> +                             &keys[j], RTE_MEMBER_BUCKET_ENTRIES,
> result);
> +                     if (type != CACHE && ret <= 0) {
> +                             printf("lookup multi has wrong return value
> %d,"
> +                                     "type %d\n", ret, type);
> +                     }
> +                     if (result[0] != data[type][j])

Why using always result[0]? A comment would be good.

Reply via email to