From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CD72CA0551; Fri, 26 Aug 2022 04:27:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6818740143; Fri, 26 Aug 2022 04:27:05 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 07C16400D6 for ; Fri, 26 Aug 2022 04:27:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661480824; x=1693016824; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=hIq+lc5OuzvsAjP/ysonGo76lU3xkg9RxgYaGddskEo=; b=NcpiO5y9ww/ZMyrnKxRqY+9W5W+RiHeJfQ2JX4V2Jfg9f/ouJlRHSmE7 3f7JOXGmIdncZTrrZRjXLavo0u3wWtwIWTDjTcf6gXkSmtVYssOnAG6gm miMwI2HMFBwUblDkn+2P9XJK0YvhgCRRV1XnT7yxDDvNRyVl+dX6toTxW G7QdmUPvyPaqaVl6drsK53s8pfDcH9V4sI625ItjMN0Vn1AE8SyilI0Q/ wcnLhN6b50lC9ZHDF+M4+ifi/kgBDPQbcG7a3NVirxQaEQXXQx4xjQbzI xyX5AQVnZvL2trEAEVtaE+1v3aVNJx9yXjJY5X3kOr2GBhuCEPgzczJc8 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10450"; a="356122204" X-IronPort-AV: E=Sophos;i="5.93,264,1654585200"; d="scan'208";a="356122204" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 19:27:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,264,1654585200"; d="scan'208";a="606617910" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga007.jf.intel.com with ESMTP; 25 Aug 2022 19:27:02 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 25 Aug 2022 19:27:02 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 25 Aug 2022 19:27:02 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Thu, 25 Aug 2022 19:27:02 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.171) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Thu, 25 Aug 2022 19:27:01 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hy4jbqCPoNrcK/Cjsb/MCAUSOR3ROYcOQh68iVExAJgvKw7607eD1+UDCqiNr1BISFxqnFli+6wIfQ0bu1iCBdkbeMs0mnOL298SMb/UnvIzokUmrjE7WaXrjNVUzWuYqtKeHYPqF1iH6v/imfb5ABQOjhAAUtSunbHBZaaQ2GtQyIpwQielHUDukCznGFI/zwimYp+4pzi5HYQmZB628r6To6a+XUmzABu4SKBzbjxMGp0N8eBSdxWgUgNXPZHOOpspDTdBmvXt+MKBMZXtTyHlr/hklpdW7491EnkdihxfZZw/0SUKRur672Xs6ox4EN/AaD/pRclpEZcV5LyTNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OKwXMDxhGXND+DRoyKUhYs3NCFEmaXLzHqUr8cNrqTY=; b=oMsQcg9s87qU4eb46BoJsBrebd6TlQpmG2EewO0L2mm9YBhnLxH8HZ3mqtbdbgkST5pUt323/4LBX66rebBMlSc22RclA1OCP3pyJQTm3tvwGZ4vc7IPIXvQdfOWfEiv3sdhaUG+WU6ecyRbr37gV5lehhByYkhjF7LaiUbdkNHImmW8Sa2N9PWCKoz4uYugajrwjOttO1wAIs4EMYgxS+7efN+NkMVUQhZSgVgi+HgZIbND1jJHUXZZsAoRUPHpwoILR2JsjtjxIbczvfHDHgyVsfWxJhAMfNm6wnk3TOsZDvKJI8SUyLEyLLKgRcmuF4mwDYtCZkAnSPASOuTwSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from MW4PR11MB5774.namprd11.prod.outlook.com (2603:10b6:303:182::16) by BYAPR11MB3302.namprd11.prod.outlook.com (2603:10b6:a03:7b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.22; Fri, 26 Aug 2022 02:26:59 +0000 Received: from MW4PR11MB5774.namprd11.prod.outlook.com ([fe80::d986:2075:e95f:7c2e]) by MW4PR11MB5774.namprd11.prod.outlook.com ([fe80::d986:2075:e95f:7c2e%6]) with mapi id 15.20.5566.015; Fri, 26 Aug 2022 02:26:58 +0000 From: "Rong, Leyi" To: Suanming Mou , "Wang, Yipeng1" , "zaoxingliu@gmail.com" , "Gobriel, Sameh" CC: "dev@dpdk.org" Subject: RE: [PATCH 2/2] test/member: add functional and perf tests for sketch Thread-Topic: [PATCH 2/2] test/member: add functional and perf tests for sketch Thread-Index: AQHYrI0tGeV9LANs9kW5HTbQtHxR3K2o/FmAgBZIafA= Date: Fri, 26 Aug 2022 02:26:58 +0000 Message-ID: References: <20220810074518.1695013-1-leyi.rong@intel.com> <20220810074518.1695013-3-leyi.rong@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.500.17 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 54208251-791b-4bd1-b277-08da870a73ca x-ms-traffictypediagnostic: BYAPR11MB3302:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: O66DzGjWD37PnTpgaETN23V6VVyaIMYdrfKh1aY5jYtps1APWKIXR5KgEVOOGMgvekYZsqZPg3NiqAwTHzinzMeC2qZ7B47sHG7EjbHzBAMw9vvhQJ/Q3jfW/kjfvGb7XzkEWFUqSUD7OUmwrVZQx3nNpywIEBFPEFCEcuneyqx/GsyZHS5BYbWzXmsAsBxwIVwzkawPGXPOj/m3IBp+BJNjMMb5Ye1TuBg8rJ7H8uS2IKqEAWXroG62x2M+vvXiUZV8ZWX3q3ftvkG6e7oHRSntNag0A3GtgZyq1p0hZAo6jVEm3ea+hiV9n6O5LqbTBf+qvGl+B3ZAGBj1LIWbF/WnClHVp+AUm7mlkPH9kPa2jlhIE4ygIdE1ynMP458d3rE9MAfKTfq8J5yKFeL4CTguYmrmx6IwZTleTqP1QNLjVn4C2HXsduMSmTj9FuQyCpQhZODgtgixuoHB4oXwHR9m6i2PigNvntAucjspl6gHQq76rLnYEqGOFyoQDquK8L2ryFWPccsvVv6SXixZEjx+1VssfqjWbVwSB8ve0Vel9k0paF+RwIHxJjpirXyiluQK/UzOzzv+lR7wQUr2xfFEMo4vc7CZbelqTGzBrj1Da8SDeQ/Wo+JncABoCNvVqBEQjtPQb/7dZlJuXNBe6kwYH7QX+r0VhLLUnzFhyv1bqRJjcuYa3cskpK+ondIfT1/wkC6AQuOdJwmnlfjVEh6dlDUuAV/1toDaqUxjOv8X0hrhsUsizwtgccibJ/LVqt0Q/ewDLyk+GX/BalXhdQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR11MB5774.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(346002)(39860400002)(366004)(396003)(376002)(136003)(2906002)(53546011)(38070700005)(186003)(41300700001)(6636002)(26005)(82960400001)(83380400001)(9686003)(110136005)(5660300002)(7696005)(6506007)(316002)(66946007)(76116006)(66556008)(4326008)(8676002)(66446008)(64756008)(478600001)(122000001)(66476007)(38100700002)(71200400001)(55016003)(86362001)(52536014)(8936002)(33656002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Xezji3FrmN5//gf6Gn/hChqGXGeeFGLgWrdJFeYEZhMk8ozm1fVCk7Xbwdoc?= =?us-ascii?Q?0MDsH8G2I3hRhDIoV1lx8/jXlKe99Foxel3FxsQFGDu8fvDnsjA+OLo3Kg6l?= =?us-ascii?Q?dwR+AGMNvtaXUw3noXlT6C9rKa+tWyT+3yl+Jg5rkHn7bx7Wi4bfXFQZzYMo?= =?us-ascii?Q?XBHRVEwwvCEVWnr3yQGsRkMTzqBrsNCLM48npe9v/7KlL7dhMOtcdUMbEt0p?= =?us-ascii?Q?60Z7KNXwV6/NL8MhUDcb145wszgXWliQbU/n0jkhdn034PdU0uA0Ok9eWVcU?= =?us-ascii?Q?Cb7XZ/GmF3nnwTbjxfvOluT8osNxHzmOiboOqgdbwMOZwedBss457TjpN7nr?= =?us-ascii?Q?ps/sfNe1A/AKXf1nN6dy+YwfxxRBq42OPKUbvf7a6HAzakePVvQJA6h3K6VI?= =?us-ascii?Q?GJcGiq1prqrbSA9BqqG8BSh0dj/Cf3RCJE9DjZml6kV4nebqcixF85bf26ub?= =?us-ascii?Q?CnnNlAz+foW5FjIxDlFvSS5uPohsUsLHZ6zCMAZE0KqoKPkeNYnqoWxTq/Ks?= =?us-ascii?Q?uTiSaZp9rpo6xfHfLE4W5Q9mLqupYf0Zb4QNp3Om4DSgjoDBGyN1IJIzxRBY?= =?us-ascii?Q?8Zgk53yHry/vGwalbKsyniyXJoDFwqptgvfejsIY8AmbSQ9YyTZFkyCKgspe?= =?us-ascii?Q?qf7R+drCt92HxyHhX6qswqVeOoSnee8Q2xmo2Cre/xY3DBHvvmXKD0c7iXgZ?= =?us-ascii?Q?P9XHV8Sk+AYXvdp5SkpLk9gOVRqXCIyLAldcRS3fEUssBtCuUQ1fOjPNBOiI?= =?us-ascii?Q?P9OojIJcwA25a0S0WMfBHxdYHxNpeMU3mCo5ZLz4Zni63TT86rqNS1SIVxCj?= =?us-ascii?Q?I16Oa30QZodOqrreT0i1Jf6CRjEnUHuhuNsSXxjEVWKkrsCg1YNFmwYwTLnN?= =?us-ascii?Q?ezwBY3MX1wwq7sSf81RyTcveRdoVyYFrtRZaM0/B1oyedgbyzY7uvm9ObWnM?= =?us-ascii?Q?ZCHbROXHdJn/jG1Ob+dfVfD4MCi9T8ELTUlrRaXZS0Vns3geu24hL4EkE2v0?= =?us-ascii?Q?lQB23OaMRpnH5m5smPuBYSGhP7J/3jYDfUG6RCxhW5AqZcQISzjXVVYZfs2t?= =?us-ascii?Q?YwWsQpal0T31R4qFTyO431PYNNbd3P0pZCQGXpk97RLa6aypNgHQaMXvPHxU?= =?us-ascii?Q?Bl3NAuQpe3Mlne4vVfIqybKXUNpNTzXWF4n34iQDw2Ro76Ww/6gzNT+pxO1n?= =?us-ascii?Q?1KWRdbjMJzdreg4asXhHYt4BLEFptBohz0SWwRdbAS2PQQDslxt01tYTnC7S?= =?us-ascii?Q?fg4o/aWEJlFl7oD8+dp5cmxw0iSJqHIN/9tdpmeyPLOZO0Jrao1Ylvblsa5P?= =?us-ascii?Q?Ev04hvmxGl9QV8q9cFHS9BbMiPH6XIWFl0wayemphPOsHwAK/VfKwTS2TBp/?= =?us-ascii?Q?HsLbu7WbTJ/c4WQ7CRC6yeTzkoZ960+jazHsnnhRW6AYX9KLvOzUW4lwKmKW?= =?us-ascii?Q?fFf4iz+MIsAQCHh0AzRrZc7HhPJMnPSUtWW9DaamsgXsJWVUK0T6od6OAzDs?= =?us-ascii?Q?hRDWArMNSoXwKxsv/DYydXVPTtfHaOAkzslqxvvntK2C6GC67dkdbtvOlct/?= =?us-ascii?Q?7GuEei2swDtIyFIQam8xyhdkOAIHaQai2VYxkwgC?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5774.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54208251-791b-4bd1-b277-08da870a73ca X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Aug 2022 02:26:58.7808 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: KTUvu9kxSOovDue0AgtW4lL2O+uUqz9HanqGNDJkC6hpQ4v5A2Pgo17HjTGoz/yaylKgV4dcGj9UeyPqFBqvkA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3302 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi Suanming, The issues you've mentioned will be fixed in v2, thanks! > -----Original Message----- > From: Suanming Mou > Sent: Thursday, August 11, 2022 10:33 AM > To: Rong, Leyi ; Wang, Yipeng1 > ; zaoxingliu@gmail.com; Gobriel, Sameh > > Cc: dev@dpdk.org > Subject: RE: [PATCH 2/2] test/member: add functional and perf tests for s= ketch >=20 > Hi, >=20 > > -----Original Message----- > > From: Leyi Rong > > Sent: Wednesday, August 10, 2022 3:45 PM > > To: yipeng1.wang@intel.com; zaoxingliu@gmail.com; > > sameh.gobriel@intel.com > > Cc: dev@dpdk.org; Leyi Rong > > Subject: [PATCH 2/2] test/member: add functional and perf tests for > > sketch > > > > This patch adds functional and performance tests for sketch mode of > > membership library. > > > > Signed-off-by: Yipeng Wang > > Signed-off-by: Leyi Rong > > --- > > app/test/test_member.c | 258 ++++++++++++++++++++++++++++++++++++ > > app/test/test_member_perf.c | 153 ++++++++++++++++++++- > > 2 files changed, 407 insertions(+), 4 deletions(-) > > > > diff --git a/app/test/test_member.c b/app/test/test_member.c index > > 26a712439f..abe59bb9f8 100644 > > --- a/app/test/test_member.c > > +++ b/app/test/test_member.c > > @@ -4,6 +4,7 @@ > > > > /* This test is for membership library's simple feature test */ > > > > +#include > > #include "test.h" > > > > #include > > @@ -28,6 +29,7 @@ test_member(void) > > struct rte_member_setsum *setsum_ht; > > struct rte_member_setsum *setsum_cache; struct rte_member_setsum > > *setsum_vbf; > > +struct rte_member_setsum *setsum_sketch; > > > > /* 5-tuple key type */ > > struct flow_key { > > @@ -108,6 +110,21 @@ static struct rte_member_parameters params =3D { > > .socket_id =3D 0 /* NUMA Socket ID for > > memory. */ > > }; > > > > +/* for sketch definitions */ > > +#define TOP_K 10 > > +#define HH_PKT_SIZE 16 > > +#define SKETCH_ERROR_RATE 0.05 > > +#define SKETCH_SAMPLE_RATE 0.001 > > +#define PRINT_OUT_COUNT 20 > > + > > +#define SKETCH_LARGEST_KEY_SIZE 1000000 #define SKETCH_TOTAL_KEY > 500 > > +#define NUM_OF_KEY(key) {\ > > + (unsigned int)ceil(SKETCH_LARGEST_KEY_SIZE / (key + 1)) \ } > > + > > +void *heavy_hitters[TOP_K]; > > + > > /* > > * Sequence of operations for find existing setsummary > > * > > @@ -684,6 +701,243 @@ perform_free(void) > > rte_member_free(setsum_vbf); > > } > > > > +static void > > +print_out_sketch_results(uint64_t *count_result, member_set_t *heavy_s= et, > > + uint32_t print_num, bool count_byte) { > > + uint32_t i; > > + > > + for (i =3D 0; i < print_num; i++) { > > + if (count_byte) > > + printf("key %2u, count %8lu, real count %8u, " > > + "heavy_set %u, deviation rate [%.04f]\n", > > + i, count_result[i], > > + (unsigned int)ceil(SKETCH_LARGEST_KEY_SIZE / > > (i + 1)) * > > + HH_PKT_SIZE, > > + heavy_set[i], > > + fabs((float)count_result[i] - > > (float)NUM_OF_KEY(i) * HH_PKT_SIZE) / > > + ((float)NUM_OF_KEY(i) * HH_PKT_SIZE)); > > + else > > + printf("key %2u, count %8lu, real count %8u, " > > + "heavy_set %u, deviation rate [%.04f]\n", > > + i, count_result[i], > > + (unsigned int)ceil(SKETCH_LARGEST_KEY_SIZE / > > (i + 1)), > > + heavy_set[i], > > + fabs((float)count_result[i] - > > (float)NUM_OF_KEY(i)) / > > + (float)NUM_OF_KEY(i)); > > + } > > +} > > + > > +static int > > +sketch_test(uint32_t *keys, uint32_t total_pkt, int count_byte, int > > +reset_test) { > > + uint32_t i; > > + uint64_t result_count[SKETCH_TOTAL_KEY]; > > + member_set_t heavy_set[SKETCH_TOTAL_KEY]; > > + uint64_t count[TOP_K]; > > + int ret; > > + int hh_cnt; > > + > > + setsum_sketch =3D rte_member_create(¶ms); > > + if (setsum_sketch =3D=3D NULL) { > > + printf("Creation of setsums fail\n"); > > + return -1; > > + } > > + > > + for (i =3D 0; i < total_pkt; i++) { > > + if (count_byte) > > + ret =3D rte_member_add_byte_count(setsum_sketch, > > &keys[i], HH_PKT_SIZE); > > + else > > + ret =3D rte_member_add(setsum_sketch, &keys[i], 1); > > + > > + if (ret < 0) { > > + printf("rte_member_add Failed! Error [%d]\n", ret); >=20 > I'm afraid rte_member_free(setsum_sketch) is missing here. > Same code below with "return -1;" should be checked. >=20 > > + > > + return -1; > > + } > > + } > > + > > + for (i =3D 0; i < SKETCH_TOTAL_KEY; i++) { > > + uint32_t tmp_key =3D i; > > + > > + rte_member_query_count(setsum_sketch, (void *)&tmp_key, > > &result_count[i]); > > + rte_member_lookup(setsum_sketch, (void *)&tmp_key, > > &heavy_set[i]); > > + } > > + > > + print_out_sketch_results(result_count, heavy_set, PRINT_OUT_COUNT, > > +count_byte); > > + > > + hh_cnt =3D rte_member_report_heavyhitter(setsum_sketch, heavy_hitters= , > > count); > > + if (hh_cnt < 0) { > > + printf("sketch report heavy hitter error!"); > > + > > + return -1; > > + } > > + > > + printf("Report heavy hitters:"); > > + for (i =3D 0; i < (unsigned int)hh_cnt; i++) { > > + printf("%u: %lu\t", > > + *((uint32_t *)heavy_hitters[i]), count[i]); > > + } > > + printf("\n"); > > + > > + if (reset_test) { > > + printf("\nEntering Sketch Reset Test Process!\n"); > > + rte_member_reset(setsum_sketch); > > + > > + /* after reset, check some key's count */ > > + for (i =3D 0; i < SKETCH_TOTAL_KEY; i++) { > > + uint32_t tmp_key =3D i; > > + > > + rte_member_query_count(setsum_sketch, (void > > *)&tmp_key, &result_count[i]); > > + rte_member_lookup(setsum_sketch, (void *)&tmp_key, > > &heavy_set[i]); > > + } > > + > > + print_out_sketch_results(result_count, heavy_set, > > PRINT_OUT_COUNT, > > +count_byte); > > + > > + printf("\nReinsert keys after Sketch Reset!\n"); > > + for (i =3D 0; i < total_pkt; i++) { > > + if (count_byte) > > + ret =3D rte_member_add_byte_count > > + (setsum_sketch, &keys[i], > > HH_PKT_SIZE); > > + else > > + ret =3D rte_member_add(setsum_sketch, &keys[i], > > 1); > > + > > + if (ret < 0) { > > + printf("rte_member_add Failed! Error [%d]\n", > > ret); > > + > > + return -1; > > + } > > + } > > + > > + for (i =3D 0; i < SKETCH_TOTAL_KEY; i++) { > > + uint32_t tmp_key =3D i; > > + > > + rte_member_query_count(setsum_sketch, (void > > *)&tmp_key, &result_count[i]); > > + rte_member_lookup(setsum_sketch, (void *)&tmp_key, > > &heavy_set[i]); > > + } > > + > > + print_out_sketch_results(result_count, heavy_set, > > PRINT_OUT_COUNT, > > +count_byte); > > + > > + hh_cnt =3D rte_member_report_heavyhitter(setsum_sketch, > > heavy_hitters, count); > > + if (hh_cnt < 0) { > > + printf("sketch report heavy hitter error!"); > > + > > + return -1; > > + } > > + printf("Report heavy hitters:"); > > + for (i =3D 0; i < (unsigned int)hh_cnt; i++) { > > + printf("%u: %lu\t", > > + *((uint32_t *)heavy_hitters[i]), count[i]); > > + } > > + printf("\n"); > > + > > + printf("\nDelete some keys!\n"); > > + uint32_t tmp_key =3D 0; > > + > > + rte_member_delete(setsum_sketch, (void *)&tmp_key, 0); > > + tmp_key =3D 1; > > + rte_member_delete(setsum_sketch, (void *)&tmp_key, 0); > > + > > + for (i =3D 0; i < SKETCH_TOTAL_KEY; i++) { > > + uint32_t tmp_key =3D i; > > + > > + rte_member_query_count(setsum_sketch, (void > > *)&tmp_key, &result_count[i]); > > + rte_member_lookup(setsum_sketch, (void *)&tmp_key, > > &heavy_set[i]); > > + } > > + > > + print_out_sketch_results(result_count, heavy_set, > > PRINT_OUT_COUNT, > > +count_byte); > > + > > + hh_cnt =3D rte_member_report_heavyhitter(setsum_sketch, > > heavy_hitters, count); > > + if (hh_cnt < 0) { > > + printf("sketch report heavy hitter error!"); > > + > > + return -1; > > + } > > + printf("Report heavy hitters:"); > > + for (i =3D 0; i < (unsigned int)hh_cnt; i++) { > > + printf("%u: %lu\t", > > + *((uint32_t *)heavy_hitters[i]), count[i]); > > + } > > + printf("\n"); > > + } > > + > > + rte_member_free(setsum_sketch); > > + return 0; > > +} > > + > > +static int > > +test_member_sketch(void) > > +{ > > + unsigned int i, j, index; > > + uint32_t total_pkt =3D 0; > > + uint32_t *keys; > > + int count_byte =3D 0; > > + > > + for (i =3D 0; i < SKETCH_TOTAL_KEY; i++) > > + total_pkt +=3D ceil(SKETCH_LARGEST_KEY_SIZE / (i + 1)); > > + > > + printf("\nTotal key count [%u] in Sketch Autotest\n", total_pkt); > > + > > + keys =3D rte_zmalloc(NULL, sizeof(uint32_t) * total_pkt, 0); > > + > > + if (keys =3D=3D NULL) { > > + printf("RTE_ZMALLOC failed\n"); > > + return -1; > > + } > > + > > + index =3D 0; > > + for (i =3D 0; i < SKETCH_TOTAL_KEY; i++) { > > + for (j =3D 0; j < ceil(SKETCH_LARGEST_KEY_SIZE / (i + 1)); j++) > > + keys[index++] =3D i; > > + } > > + > > + /* shuffle the keys */ > > + for (i =3D index - 1; i > 0; i--) { > > + uint32_t swap_idx =3D rte_rand() % i; > > + uint32_t tmp_key =3D keys[i]; > > + > > + keys[i] =3D keys[swap_idx]; > > + keys[swap_idx] =3D tmp_key; > > + } > > + > > + params.key_len =3D 4; > > + params.name =3D "test_member_sketch"; > > + params.type =3D RTE_MEMBER_TYPE_SKETCH; > > + params.error_rate =3D SKETCH_ERROR_RATE; > > + params.sample_rate =3D SKETCH_SAMPLE_RATE; > > + params.extra_flag =3D 0; > > + params.top_k =3D TOP_K; > > + params.prim_hash_seed =3D rte_rdtsc(); > > + int reset_test =3D 0; > > + > > + printf("Default sketching params: Error Rate: [%f]\tSample Rate: > > [%f]\tTopK: [%d]\n", > > + SKETCH_ERROR_RATE, SKETCH_SAMPLE_RATE, TOP_K); > > + > > + printf("\n[Sketch with Fixed Sampling Rate Mode]\n"); > > + if (sketch_test(keys, total_pkt, count_byte, reset_test) < 0) >=20 > Same here, will keys memory allocated by rte_zmalloc be freed in other pl= ace? >=20 > > + return -1; > > + > > + params.extra_flag |=3D RTE_MEMBER_SKETCH_ALWAYS_BOUNDED; > > + printf("\n[Sketch with Always Bounded Mode]\n"); > > + if (sketch_test(keys, total_pkt, count_byte, reset_test) < 0) > > + return -1; > > + > > + count_byte =3D 1; > > + params.extra_flag |=3D RTE_MEMBER_SKETCH_COUNT_BYTE; > > + printf("\n[Sketch with Packet Size Mode]\n"); > > + if (sketch_test(keys, total_pkt, count_byte, reset_test) < 0) > > + return -1; > > + > > + count_byte =3D 0; > > + params.extra_flag =3D 0; >=20 >=20 > snip