From patchwork Thu Feb 25 12:35:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 62883 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp136265lbc; Thu, 25 Feb 2016 04:36:20 -0800 (PST) X-Received: by 10.140.81.51 with SMTP id e48mr15158817qgd.27.1456403780115; Thu, 25 Feb 2016 04:36:20 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id p64si7885443qgd.28.2016.02.25.04.36.19; Thu, 25 Feb 2016 04:36:20 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id B2BEF62F79; Thu, 25 Feb 2016 12:36:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 306E465089; Thu, 25 Feb 2016 12:35:26 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 0308762FEF; Thu, 25 Feb 2016 12:35:19 +0000 (UTC) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by lists.linaro.org (Postfix) with ESMTPS id DD57B62EF6 for ; Thu, 25 Feb 2016 12:35:13 +0000 (UTC) Received: by mail-lb0-f177.google.com with SMTP id x1so27998804lbj.3 for ; Thu, 25 Feb 2016 04:35:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HUM3hQ/L/zbFlroFVYR3uU3lv+Ew7GG34A8dRC6k+W8=; b=gUM2gumOdnpBDM2WelV0ZGlQaTYnG7Huc3RtjbcA+TdDiBVMcWXCzZhAlEiE71lMlo nui7wYXjJcI3NOauSqdeUguoikOeYkpJrMDDbGN2LYGJJtfHbfUhfNa3PCNC3GkuBxFO xRMYkMSAOFEpK7dRHHmvVEX+7s3rTvAwRNqMERVIVRz++uvfIL16SL0czC0K0gWUdU/P tFZKg6NnpKcqb5ogx8felk8msEsdH83Qhrhk48CAl63nBSeReqz88VE4UpArU9e+suAU ej6Mzp7gCJcDrJUSxbWiMfm2RfgDejyihVQdMuY20KoA7V0wBnEZ0GMRhCO149LfazAp 7dUQ== X-Gm-Message-State: AG10YOTyaFEoYOUb+37NhBXg4jgXpuzNp6W/1gblLDhErwe8OcF2zF9JsoSQVwRsCNS/Mpolrwg= X-Received: by 10.112.14.39 with SMTP id m7mr16712417lbc.20.1456403712831; Thu, 25 Feb 2016 04:35:12 -0800 (PST) Received: from localhost.localdomain (ppp91-76-173-134.pppoe.mtu-net.ru. [91.76.173.134]) by smtp.gmail.com with ESMTPSA id t12sm1109039lfe.46.2016.02.25.04.35.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 Feb 2016 04:35:12 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 25 Feb 2016 15:35:05 +0300 Message-Id: <1456403706-13309-2-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 2.7.1.250.gff4ea60 In-Reply-To: <1456403706-13309-1-git-send-email-maxim.uvarov@linaro.org> References: <1456403706-13309-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv2 1/2] performance: scheduling: cleanly destroy resources X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Signed-off-by: Maxim Uvarov --- test/performance/odp_scheduling.c | 52 ++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index d785878..6a94cb0 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -806,13 +806,15 @@ int main(int argc, char *argv[]) int num_workers; odp_cpumask_t cpumask; odp_pool_t pool; - odp_queue_t queue; + odp_queue_t plain_queue; int i, j; int prios; odp_shm_t shm; test_globals_t *globals; char cpumaskstr[ODP_CPUMASK_STR_SIZE]; odp_pool_param_t params; + int ret = 0; + char name[] = "sched_XX_YY"; printf("\nODP example starts\n\n"); @@ -870,14 +872,12 @@ int main(int argc, char *argv[]) shm = odp_shm_reserve("test_globals", sizeof(test_globals_t), ODP_CACHE_LINE_SIZE, 0); - - globals = odp_shm_addr(shm); - - if (globals == NULL) { + if (shm == ODP_SHM_INVALID) { LOG_ERR("Shared memory reserve failed.\n"); return -1; } + globals = odp_shm_addr(shm); memset(globals, 0, sizeof(test_globals_t)); /* @@ -902,9 +902,9 @@ int main(int argc, char *argv[]) /* * Create a queue for plain queue test */ - queue = odp_queue_create("plain_queue", NULL); + plain_queue = odp_queue_create("plain_queue", NULL); - if (queue == ODP_QUEUE_INVALID) { + if (plain_queue == ODP_QUEUE_INVALID) { LOG_ERR("Plain queue create failed.\n"); return -1; } @@ -915,12 +915,12 @@ int main(int argc, char *argv[]) prios = odp_schedule_num_prio(); for (i = 0; i < prios; i++) { - if (i != ODP_SCHED_PRIO_HIGHEST && - i != ODP_SCHED_PRIO_LOWEST) - continue; - + odp_queue_t queue; odp_queue_param_t param; - char name[] = "sched_XX_YY"; + + if (i != ODP_SCHED_PRIO_HIGHEST && + i != ODP_SCHED_PRIO_LOWEST) + continue; name[6] = '0' + i/10; name[7] = '0' + i - 10*(i/10); @@ -950,7 +950,6 @@ int main(int argc, char *argv[]) odp_barrier_init(&globals->barrier, num_workers); if (args.proc_mode) { - int ret; odph_linux_process_t proc[MAX_WORKERS]; /* Fork worker processes */ @@ -981,5 +980,30 @@ int main(int argc, char *argv[]) printf("ODP example complete\n\n"); } - return 0; + for (i = 0; i < prios; i++) { + odp_queue_t queue; + + if (i != ODP_SCHED_PRIO_HIGHEST && + i != ODP_SCHED_PRIO_LOWEST) + continue; + + name[6] = '0' + i / 10; + name[7] = '0' + i - 10 * (i / 10); + + for (j = 0; j < QUEUES_PER_PRIO; j++) { + name[9] = '0' + j / 10; + name[10] = '0' + j - 10 * (j / 10); + + queue = odp_queue_lookup(name); + odp_queue_destroy(queue); + } + } + + odp_shm_free(shm); + odp_queue_destroy(plain_queue); + odp_pool_destroy(pool); + odp_term_local(); + odp_term_global(); + + return ret; }