From: Artur Trybula <arturx.trybula@intel.com>
To: dev@dpdk.org, fiona.trahe@intel.com, akhil.goyal@nxp.com,
adamx.dybkowski@intel.com, arturx.trybula@intel.com,
tjozwiakgm@gmail.com
Cc: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Subject: [dpdk-dev] [PATCH v6 6/6] app/test-compress-perf: add force process termination
Date: Wed, 3 Jul 2019 17:24:18 +0200 [thread overview]
Message-ID: <20190703152418.8601-7-arturx.trybula@intel.com> (raw)
In-Reply-To: <20190703152418.8601-1-arturx.trybula@intel.com>
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
This patch adds a possibility to force controlled process termination
as a result of two signals: SIGTERM and SIGINT
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
app/test-compress-perf/comp_perf_options.h | 1 +
.../comp_perf_test_benchmark.c | 13 ++++++++++
.../comp_perf_test_verify.c | 14 ++++++++++
app/test-compress-perf/main.c | 26 +++++++++++++++++--
4 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h
index 0aa29a599..532fb964e 100644
--- a/app/test-compress-perf/comp_perf_options.h
+++ b/app/test-compress-perf/comp_perf_options.h
@@ -67,6 +67,7 @@ struct comp_test_data {
double ratio;
enum cleanup_st cleanup;
+ int perf_comp_force_stop;
};
int
diff --git a/app/test-compress-perf/comp_perf_test_benchmark.c b/app/test-compress-perf/comp_perf_test_benchmark.c
index e0f852bf0..aa1f8eea2 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.c
+++ b/app/test-compress-perf/comp_perf_test_benchmark.c
@@ -184,6 +184,9 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
@@ -242,6 +245,9 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
@@ -306,6 +312,13 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
return res;
}
diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c
index 7be30ee13..37ac38da6 100644
--- a/app/test-compress-perf/comp_perf_test_verify.c
+++ b/app/test-compress-perf/comp_perf_test_verify.c
@@ -188,6 +188,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
@@ -268,6 +271,9 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
@@ -346,6 +352,14 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
+
return res;
}
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index dd6ef9a6d..e746e4708 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -2,6 +2,10 @@
* Copyright(c) 2018 Intel Corporation
*/
+#include <signal.h>
+#include <sys/types.h>
+#include <unistd.h>
+
#include <rte_malloc.h>
#include <rte_eal.h>
#include <rte_log.h>
@@ -36,6 +40,8 @@ static const struct cperf_test cperf_testmap[] = {
}
};
+static struct comp_test_data *test_data;
+
static int
comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id)
{
@@ -277,12 +283,24 @@ comp_perf_dump_input_data(struct comp_test_data *test_data)
return ret;
}
+static void
+comp_perf_cleanup_on_signal(int signalNumber __rte_unused)
+{
+ test_data->perf_comp_force_stop = 1;
+}
+
+static void
+comp_perf_register_cleanup_on_signal(void)
+{
+ signal(SIGTERM, comp_perf_cleanup_on_signal);
+ signal(SIGINT, comp_perf_cleanup_on_signal);
+}
+
int
main(int argc, char **argv)
{
uint8_t level_idx = 0;
int ret, i;
- struct comp_test_data *test_data;
void *ctx[RTE_MAX_LCORE] = {};
uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
int nb_compressdevs = 0;
@@ -304,6 +322,8 @@ main(int argc, char **argv)
rte_exit(EXIT_FAILURE, "Cannot reserve memory in socket %d\n",
rte_socket_id());
+ comp_perf_register_cleanup_on_signal();
+
ret = EXIT_SUCCESS;
test_data->cleanup = ST_TEST_DATA;
comp_perf_options_default(test_data);
@@ -424,8 +444,10 @@ main(int argc, char **argv)
/* fallthrough */
case ST_COMPDEV:
for (i = 0; i < nb_compressdevs &&
- i < RTE_COMPRESS_MAX_DEVS; i++)
+ i < RTE_COMPRESS_MAX_DEVS; i++) {
rte_compressdev_stop(enabled_cdevs[i]);
+ rte_compressdev_close(enabled_cdevs[i]);
+ }
/* fallthrough */
case ST_TEST_DATA:
rte_free(test_data);
--
2.17.1
next prev parent reply other threads:[~2019-07-03 15:26 UTC|newest]
Thread overview: 87+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-30 8:06 [dpdk-dev] [PATCH v1 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 1/7] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 2/7] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
2019-06-03 13:35 ` [dpdk-dev] [EXT] " Shally Verma
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 3/7] app/test-compress-perf: add verification test case Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 4/7] app/test-compress-perf: add benchmark " Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 5/7] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 6/7] app/test-compress-perf: add force process termination Tomasz Jozwiak
2019-05-30 8:06 ` [dpdk-dev] [PATCH v1 7/7] doc: update release notes for 19.08 Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 1/7] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 2/7] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 3/7] app/test-compress-perf: add verification test case Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 4/7] app/test-compress-perf: add benchmark " Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 5/7] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 6/7] app/test-compress-perf: add force process termination Tomasz Jozwiak
2019-06-08 22:22 ` [dpdk-dev] [PATCH v2 7/7] doc: update release notes for 19.08 Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 0/7] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 1/7] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 2/7] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
2019-06-26 17:13 ` [dpdk-dev] [EXT] " Shally Verma
2019-06-26 17:34 ` Tomasz Jozwiak
2019-06-27 4:41 ` Shally Verma
2019-06-27 21:27 ` Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 3/7] app/test-compress-perf: add verification test case Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 4/7] app/test-compress-perf: add benchmark " Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 5/7] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 6/7] app/test-compress-perf: add force process termination Tomasz Jozwiak
2019-06-26 16:30 ` [dpdk-dev] [PATCH v3 7/7] doc: update release notes for 19.08 Tomasz Jozwiak
2019-06-26 21:26 ` Thomas Monjalon
2019-06-27 21:25 ` Tomasz Jozwiak
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 1/6] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 2/6] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
2019-06-30 14:41 ` [dpdk-dev] [EXT] " Shally Verma
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 3/6] app/test-compress-perf: add verification test case Tomasz Jozwiak
2019-06-30 14:55 ` [dpdk-dev] [EXT] " Shally Verma
2019-06-30 21:02 ` Tomasz Jozwiak
2019-07-01 4:29 ` Shally Verma
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 4/6] app/test-compress-perf: add benchmark " Tomasz Jozwiak
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 5/6] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
2019-06-30 14:56 ` [dpdk-dev] [EXT] " Shally Verma
2019-06-27 22:25 ` [dpdk-dev] [PATCH v4 6/6] app/test-compress-perf: add force process termination Tomasz Jozwiak
2019-06-30 15:00 ` [dpdk-dev] [EXT] " Shally Verma
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 0/6] add multiple cores feature to test-compress-perf Tomasz Jozwiak
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 1/6] app/test-compress-perf: add weak functions for multi-cores test Tomasz Jozwiak
2019-07-02 10:03 ` Trybula, ArturX
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 1/6] app/test-compress-perf: add weak functions for multi-cores test Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 2/6] app/test-compress-perf: add ptest command line option Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 3/6] app/test-compress-perf: add verification test case Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 4/6] app/test-compress-perf: add benchmark " Artur Trybula
2019-07-03 15:24 ` [dpdk-dev] [PATCH v6 5/6] doc: update dpdk-test-compress-perf description Artur Trybula
2019-07-03 15:24 ` Artur Trybula [this message]
2019-07-05 9:50 ` [dpdk-dev] [PATCH v6 0/6] add multiple cores feature to test-compress-perf Shally Verma
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 " Fiona Trahe
2019-07-06 9:36 ` [dpdk-dev] [EXT] " Shally Verma
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 1/6] app/test-compress-perf: add weak functions for multi-cores test Fiona Trahe
2019-07-06 9:31 ` [dpdk-dev] [EXT] " Shally Verma
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 0/7] add multiple cores feature to test-compress-perf Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 1/7] app/test-compress-perf: add weak functions for multi-cores test Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 2/7] app/test-compress-perf: add ptest command line option Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 3/7] app/test-compress-perf: add verification test case Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 4/7] app/test-compress-perf: add benchmark " Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 5/7] doc: update dpdk-test-compress-perf description Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 6/7] app/test-compress-perf: add force process termination Artur Trybula
2019-07-08 18:16 ` [dpdk-dev] [PATCH v8 7/7] app/test-compress-perf: 'magic numbers' removed Artur Trybula
2019-07-15 10:03 ` Trahe, Fiona
2019-07-15 13:12 ` [dpdk-dev] [PATCH v8 0/7] add multiple cores feature to test-compress-perf Akhil Goyal
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 2/6] app/test-compress-perf: add ptest command line option Fiona Trahe
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 3/6] app/test-compress-perf: add verification test case Fiona Trahe
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 4/6] app/test-compress-perf: add benchmark " Fiona Trahe
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 5/6] doc: update dpdk-test-compress-perf description Fiona Trahe
2019-07-05 11:15 ` [dpdk-dev] [PATCH v7 6/6] app/test-compress-perf: add force process termination Fiona Trahe
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 2/6] app/test-compress-perf: add ptest command line option Tomasz Jozwiak
2019-07-02 10:05 ` Trybula, ArturX
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 3/6] app/test-compress-perf: add verification test case Tomasz Jozwiak
2019-07-02 10:02 ` Trybula, ArturX
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 4/6] app/test-compress-perf: add benchmark " Tomasz Jozwiak
2019-07-02 10:02 ` Trybula, ArturX
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 5/6] doc: update dpdk-test-compress-perf description Tomasz Jozwiak
2019-07-02 10:04 ` Trybula, ArturX
2019-07-01 11:26 ` [dpdk-dev] [PATCH v5 6/6] app/test-compress-perf: add force process termination Tomasz Jozwiak
2019-07-02 10:02 ` Trybula, ArturX
2019-07-03 10:21 ` [dpdk-dev] [PATCH v5 0/6] add multiple cores feature to test-compress-perf Akhil Goyal
2019-07-03 12:20 ` Tomasz Jóźwiak
[not found] ` <1560031175-13787-1-git-send-email-tjozwiakgm@gmail.com>
2019-06-09 4:53 ` [dpdk-dev] [EXT] [PATCH v2 0/7] " Shally Verma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190703152418.8601-7-arturx.trybula@intel.com \
--to=arturx.trybula@intel.com \
--cc=adamx.dybkowski@intel.com \
--cc=akhil.goyal@nxp.com \
--cc=dev@dpdk.org \
--cc=fiona.trahe@intel.com \
--cc=tjozwiakgm@gmail.com \
--cc=tomaszx.jozwiak@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).