From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 621521B262 for ; Mon, 2 Oct 2017 18:20:59 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP; 02 Oct 2017 09:20:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,470,1500966000"; d="scan'208";a="1020707968" Received: from irsmsx107.ger.corp.intel.com ([163.33.3.99]) by orsmga003.jf.intel.com with ESMTP; 02 Oct 2017 09:20:47 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.167]) by IRSMSX107.ger.corp.intel.com ([169.254.10.65]) with mapi id 14.03.0319.002; Mon, 2 Oct 2017 17:20:45 +0100 From: "De Lara Guarch, Pablo" To: "Wang, Yipeng1" , "dev@dpdk.org" CC: "thomas@monjalon.net" , "Tai, Charlie" , "Gobriel, Sameh" , "Mcnamara, John" Thread-Topic: [PATCH v4 6/7] test/member: add functional and perf tests Thread-Index: AQHTN7hN52LvkOiUjk2gxest7YUoBqLQQQRg Date: Mon, 2 Oct 2017 16:20:45 +0000 Message-ID: References: <1504655989-1518-1-git-send-email-yipeng1.wang@intel.com> <1506534034-39433-1-git-send-email-yipeng1.wang@intel.com> <1506534034-39433-7-git-send-email-yipeng1.wang@intel.com> In-Reply-To: <1506534034-39433-7-git-send-email-yipeng1.wang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMGY4MzcxNGQtYmUxNy00NjZjLWIzYzItMTEyMTdlN2FjYWI1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IlNCQ0czd0VjT1VmN2hWdmgwTVBvZG1XdEk1WDJVVG9tNytLZjBJVkxSRmc9In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v4 6/7] test/member: add functional and perf tests X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Oct 2017 16:21:01 -0000 > -----Original Message----- > From: Wang, Yipeng1 > Sent: Wednesday, September 27, 2017 6:41 PM > To: dev@dpdk.org > Cc: thomas@monjalon.net; Tai, Charlie ; Gobriel, > Sameh ; De Lara Guarch, Pablo > ; Mcnamara, John > ; Wang, Yipeng1 > Subject: [PATCH v4 6/7] test/member: add functional and perf tests >=20 > This patch adds functional and performance tests for membership library. >=20 > Signed-off-by: Yipeng Wang ... > +++ 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 =3D { > + .num_keys =3D MAX_ENTRIES, /* Total hash table entries. > */ > + .key_len =3D 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 =3D 32, > + .false_positive_rate =3D 0.03, > + .prim_hash_seed =3D 1, > + .sec_hash_seed =3D 11, > + .socket_id =3D 0 /* NUMA Socket ID for memory. */ > +}; > +static int test_member_insert(void) > +{ > + int ret_ht, ret_cache, ret_vbf, i; > + > + for (i =3D 0; i < 5; i++) { Use macro for the value 5, used here and other functions. > + ret_ht =3D rte_member_add(setsum_ht, &keys[i], test_set[i]); > + ret_cache =3D rte_member_add(setsum_cache, &keys[i], > + test_set[i]); > + ret_vbf =3D rte_member_add(setsum_vbf, &keys[i], > test_set[i]); > + TEST_ASSERT(ret_ht >=3D 0 && ret_cache >=3D 0 && ret_vbf >=3D > 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] =3D {0}; Same comment about the value 5 applies here, for the value 32. > + member_set_t set_ids_vbf[32] =3D {0}; > + member_set_t set_ids_cache[32] =3D {0}; > + > + member_set_t set_ids_ht_m[5][32] =3D {{0} }; > + member_set_t set_ids_vbf_m[5][32] =3D {{0} }; > + member_set_t set_ids_cache_m[5][32] =3D {{0} }; > + > + uint32_t match_count_ht[5]; > + uint32_t match_count_vbf[5]; > + uint32_t match_count_cache[5]; > + > + uint32_t num_key_ht =3D 5; > + uint32_t num_key_vbf =3D 5; > + uint32_t num_key_cache =3D 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 =3D 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] =3D {0}; > + const void *keys_burst[BURST_SIZE]; > + int ret; > + > + false_data_bulk[type][params->cycle] =3D 0; > + > + const uint64_t start_tsc =3D rte_rdtsc(); > + > + for (i =3D 0; i < NUM_LOOKUPS / KEYS_TO_ADD; i++) { > + for (j =3D 0; j < KEYS_TO_ADD / BURST_SIZE; j++) { > + for (k =3D 0; k < BURST_SIZE; k++) > + keys_burst[k] =3D keys[j * BURST_SIZE + k]; > + > + ret =3D 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] =3D {0}; > + int ret; > + false_data_multi[type][params->cycle] =3D 0; > + > + const uint64_t start_tsc =3D rte_rdtsc(); > + > + for (i =3D 0; i < NUM_LOOKUPS / KEYS_TO_ADD; i++) { > + for (j =3D 0; j < KEYS_TO_ADD; j++) { > + ret =3D rte_member_lookup_multi(params- > >setsum[type], > + &keys[j], RTE_MEMBER_BUCKET_ENTRIES, > result); > + if (type !=3D CACHE && ret <=3D 0) { > + printf("lookup multi has wrong return value > %d," > + "type %d\n", ret, type); > + } > + if (result[0] !=3D data[type][j]) Why using always result[0]? A comment would be good.