Message ID | 1419460572-5701-1-git-send-email-mike.holmes@linaro.org |
---|---|
State | Accepted |
Commit | fcb2c9cb40ed5524b6c9915d09221b89e01de2ce |
Headers | show |
Looks good, we need to do the same for other functions. Might be for packet i/o. Maxim. On 12/25/2014 01:36 AM, Mike Holmes wrote: > odp_example is too complex to be an example, and is not a unit test, > instead it is a performance oriented test application. > > Signed-off-by: Mike Holmes <mike.holmes@linaro.org> > --- > configure.ac | 2 +- > example/Makefile.am | 2 +- > example/odp_example/.gitignore | 1 - > example/odp_example/Makefile.am | 10 --- > test/Makefile.am | 2 +- > test/performance/.gitignore | 1 + > test/performance/Makefile.am | 10 +++ > .../performance/odp_scheduling.c | 76 +++++++++++----------- > 8 files changed, 52 insertions(+), 52 deletions(-) > delete mode 100644 example/odp_example/.gitignore > delete mode 100644 example/odp_example/Makefile.am > create mode 100644 test/performance/.gitignore > create mode 100644 test/performance/Makefile.am > rename example/odp_example/odp_example.c => test/performance/odp_scheduling.c (92%) > > diff --git a/configure.ac b/configure.ac > index 377e8be..01644f6 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -198,13 +198,13 @@ AC_CONFIG_FILES([Makefile > example/generator/Makefile > example/ipsec/Makefile > example/l2fwd/Makefile > - example/odp_example/Makefile > example/packet/Makefile > example/timer/Makefile > doc/Makefile > test/Makefile > test/api_test/Makefile > test/validation/Makefile > + test/performance/Makefile > pkgconfig/libodp.pc]) > > AC_SEARCH_LIBS([timer_create],[rt posix4]) > diff --git a/example/Makefile.am b/example/Makefile.am > index b2a22a3..3021571 100644 > --- a/example/Makefile.am > +++ b/example/Makefile.am > @@ -1 +1 @@ > -SUBDIRS = generator ipsec l2fwd odp_example packet timer > +SUBDIRS = generator ipsec l2fwd packet timer > diff --git a/example/odp_example/.gitignore b/example/odp_example/.gitignore > deleted file mode 100644 > index 59ca8c8..0000000 > --- a/example/odp_example/.gitignore > +++ /dev/null > @@ -1 +0,0 @@ > -odp_example > diff --git a/example/odp_example/Makefile.am b/example/odp_example/Makefile.am > deleted file mode 100644 > index 8252424..0000000 > --- a/example/odp_example/Makefile.am > +++ /dev/null > @@ -1,10 +0,0 @@ > -include $(top_srcdir)/example/Makefile.inc > - > -bin_PROGRAMS = odp_example > -odp_example_LDFLAGS = $(AM_LDFLAGS) -static > -odp_example_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example > - > -noinst_HEADERS = \ > - $(top_srcdir)/example/example_debug.h > - > -dist_odp_example_SOURCES = odp_example.c > diff --git a/test/Makefile.am b/test/Makefile.am > index 90598bf..afaa1d0 100644 > --- a/test/Makefile.am > +++ b/test/Makefile.am > @@ -1 +1 @@ > -SUBDIRS = api_test validation > +SUBDIRS = api_test validation performance > diff --git a/test/performance/.gitignore b/test/performance/.gitignore > new file mode 100644 > index 0000000..a229e10 > --- /dev/null > +++ b/test/performance/.gitignore > @@ -0,0 +1 @@ > +odp_scheduling > diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am > new file mode 100644 > index 0000000..359c4f0 > --- /dev/null > +++ b/test/performance/Makefile.am > @@ -0,0 +1,10 @@ > +include $(top_srcdir)/test/Makefile.inc > + > +bin_PROGRAMS = odp_scheduling > +odp_scheduling_LDFLAGS = $(AM_LDFLAGS) -static > +odp_scheduling_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test > + > +noinst_HEADERS = \ > + $(top_srcdir)/test/test_debug.h > + > +dist_odp_scheduling_SOURCES = odp_scheduling.c > diff --git a/example/odp_example/odp_example.c b/test/performance/odp_scheduling.c > similarity index 92% > rename from example/odp_example/odp_example.c > rename to test/performance/odp_scheduling.c > index 8373f12..a18e858 100644 > --- a/example/odp_example/odp_example.c > +++ b/test/performance/odp_scheduling.c > @@ -13,7 +13,7 @@ > #include <string.h> > #include <stdlib.h> > > -#include <example_debug.h> > +#include <test_debug.h> > > /* ODP main header */ > #include <odp.h> > @@ -95,7 +95,7 @@ static int create_queue(int thr, odp_buffer_pool_t msg_pool, int prio) > buf = odp_buffer_alloc(msg_pool); > > if (!odp_buffer_is_valid(buf)) { > - EXAMPLE_ERR(" [%i] msg_pool alloc failed\n", thr); > + LOG_ERR(" [%i] msg_pool alloc failed\n", thr); > return -1; > } > > @@ -105,12 +105,12 @@ static int create_queue(int thr, odp_buffer_pool_t msg_pool, int prio) > queue = odp_queue_lookup(name); > > if (queue == ODP_QUEUE_INVALID) { > - EXAMPLE_ERR(" [%i] Queue %s lookup failed.\n", thr, name); > + LOG_ERR(" [%i] Queue %s lookup failed.\n", thr, name); > return -1; > } > > if (odp_queue_enq(queue, buf)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > > @@ -144,20 +144,20 @@ static int create_queues(int thr, odp_buffer_pool_t msg_pool, int prio) > queue = odp_queue_lookup(name); > > if (queue == ODP_QUEUE_INVALID) { > - EXAMPLE_ERR(" [%i] Queue %s lookup failed.\n", thr, > - name); > + LOG_ERR(" [%i] Queue %s lookup failed.\n", thr, > + name); > return -1; > } > > buf = odp_buffer_alloc(msg_pool); > > if (!odp_buffer_is_valid(buf)) { > - EXAMPLE_ERR(" [%i] msg_pool alloc failed\n", thr); > + LOG_ERR(" [%i] msg_pool alloc failed\n", thr); > return -1; > } > > if (odp_queue_enq(queue, buf)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -186,7 +186,7 @@ static int test_alloc_single(int thr, odp_buffer_pool_t pool) > temp_buf = odp_buffer_alloc(pool); > > if (!odp_buffer_is_valid(temp_buf)) { > - EXAMPLE_ERR(" [%i] alloc_single failed\n", thr); > + LOG_ERR(" [%i] alloc_single failed\n", thr); > return -1; > } > > @@ -224,7 +224,7 @@ static int test_alloc_multi(int thr, odp_buffer_pool_t pool) > temp_buf[j] = odp_buffer_alloc(pool); > > if (!odp_buffer_is_valid(temp_buf[j])) { > - EXAMPLE_ERR(" [%i] alloc_multi failed\n", thr); > + LOG_ERR(" [%i] alloc_multi failed\n", thr); > return -1; > } > } > @@ -266,7 +266,7 @@ static int test_poll_queue(int thr, odp_buffer_pool_t msg_pool) > buf = odp_buffer_alloc(msg_pool); > > if (!odp_buffer_is_valid(buf)) { > - EXAMPLE_ERR(" [%i] msg_pool alloc failed\n", thr); > + LOG_ERR(" [%i] msg_pool alloc failed\n", thr); > return -1; > } > > @@ -287,14 +287,14 @@ static int test_poll_queue(int thr, odp_buffer_pool_t msg_pool) > > for (i = 0; i < QUEUE_ROUNDS; i++) { > if (odp_queue_enq(queue, buf)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > > buf = odp_queue_deq(queue); > > if (!odp_buffer_is_valid(buf)) { > - EXAMPLE_ERR(" [%i] Queue empty.\n", thr); > + LOG_ERR(" [%i] Queue empty.\n", thr); > return -1; > } > } > @@ -343,7 +343,7 @@ static int test_schedule_one_single(const char *str, int thr, > buf = odp_schedule_one(&queue, ODP_SCHED_WAIT); > > if (odp_queue_enq(queue, buf)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -404,7 +404,7 @@ static int test_schedule_one_many(const char *str, int thr, > buf = odp_schedule_one(&queue, ODP_SCHED_WAIT); > > if (odp_queue_enq(queue, buf)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -462,7 +462,7 @@ static int test_schedule_single(const char *str, int thr, > buf = odp_schedule(&queue, ODP_SCHED_WAIT); > > if (odp_queue_enq(queue, buf)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -481,7 +481,7 @@ static int test_schedule_single(const char *str, int thr, > tot++; > > if (odp_queue_enq(queue, buf)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -541,7 +541,7 @@ static int test_schedule_many(const char *str, int thr, > buf = odp_schedule(&queue, ODP_SCHED_WAIT); > > if (odp_queue_enq(queue, buf)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -560,7 +560,7 @@ static int test_schedule_many(const char *str, int thr, > tot++; > > if (odp_queue_enq(queue, buf)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -619,8 +619,8 @@ static int test_schedule_multi(const char *str, int thr, > queue = odp_queue_lookup(name); > > if (queue == ODP_QUEUE_INVALID) { > - EXAMPLE_ERR(" [%i] Queue %s lookup failed.\n", thr, > - name); > + LOG_ERR(" [%i] Queue %s lookup failed.\n", thr, > + name); > return -1; > } > > @@ -628,14 +628,14 @@ static int test_schedule_multi(const char *str, int thr, > buf[j] = odp_buffer_alloc(msg_pool); > > if (!odp_buffer_is_valid(buf[j])) { > - EXAMPLE_ERR(" [%i] msg_pool alloc failed\n", > - thr); > + LOG_ERR(" [%i] msg_pool alloc failed\n", > + thr); > return -1; > } > } > > if (odp_queue_enq_multi(queue, buf, MULTI_BUFS_MAX)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -650,7 +650,7 @@ static int test_schedule_multi(const char *str, int thr, > tot += num; > > if (odp_queue_enq_multi(queue, buf, num)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -668,7 +668,7 @@ static int test_schedule_multi(const char *str, int thr, > tot += num; > > if (odp_queue_enq_multi(queue, buf, num)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -720,7 +720,7 @@ static void *run_thread(void *arg) > globals = odp_shm_addr(shm); > > if (globals == NULL) { > - EXAMPLE_ERR("Shared mem lookup failed\n"); > + LOG_ERR("Shared mem lookup failed\n"); > return NULL; > } > > @@ -740,7 +740,7 @@ static void *run_thread(void *arg) > msg_pool = odp_buffer_pool_lookup("msg_pool"); > > if (msg_pool == ODP_BUFFER_POOL_INVALID) { > - EXAMPLE_ERR(" [%i] msg_pool not found\n", thr); > + LOG_ERR(" [%i] msg_pool not found\n", thr); > return NULL; > } > > @@ -840,7 +840,7 @@ static void test_time(void) > double err; > > if (clock_gettime(CLOCK_MONOTONIC, &tp2)) { > - EXAMPLE_ERR("clock_gettime failed.\n"); > + LOG_ERR("clock_gettime failed.\n"); > return; > } > > @@ -848,7 +848,7 @@ static void test_time(void) > > do { > if (clock_gettime(CLOCK_MONOTONIC, &tp1)) { > - EXAMPLE_ERR("clock_gettime failed.\n"); > + LOG_ERR("clock_gettime failed.\n"); > return; > } > > @@ -858,7 +858,7 @@ static void test_time(void) > > do { > if (clock_gettime(CLOCK_MONOTONIC, &tp2)) { > - EXAMPLE_ERR("clock_gettime failed.\n"); > + LOG_ERR("clock_gettime failed.\n"); > return; > } > > @@ -976,7 +976,7 @@ int main(int argc, char *argv[]) > > /* ODP global init */ > if (odp_init_global(NULL, NULL)) { > - EXAMPLE_ERR("ODP global init failed.\n"); > + LOG_ERR("ODP global init failed.\n"); > return -1; > } > > @@ -985,7 +985,7 @@ int main(int argc, char *argv[]) > * setting up resources for worker threads. > */ > if (odp_init_local()) { > - EXAMPLE_ERR("ODP global init failed.\n"); > + LOG_ERR("ODP global init failed.\n"); > return -1; > } > > @@ -1033,7 +1033,7 @@ int main(int argc, char *argv[]) > globals = odp_shm_addr(shm); > > if (globals == NULL) { > - EXAMPLE_ERR("Shared memory reserve failed.\n"); > + LOG_ERR("Shared memory reserve failed.\n"); > return -1; > } > > @@ -1051,7 +1051,7 @@ int main(int argc, char *argv[]) > pool = odp_buffer_pool_create("msg_pool", ODP_SHM_NULL, ¶ms); > > if (pool == ODP_BUFFER_POOL_INVALID) { > - EXAMPLE_ERR("Pool create failed.\n"); > + LOG_ERR("Pool create failed.\n"); > return -1; > } > > @@ -1063,7 +1063,7 @@ int main(int argc, char *argv[]) > queue = odp_queue_create("poll_queue", ODP_QUEUE_TYPE_POLL, NULL); > > if (queue == ODP_QUEUE_INVALID) { > - EXAMPLE_ERR("Poll queue create failed.\n"); > + LOG_ERR("Poll queue create failed.\n"); > return -1; > } > > @@ -1095,7 +1095,7 @@ int main(int argc, char *argv[]) > ¶m); > > if (queue == ODP_QUEUE_INVALID) { > - EXAMPLE_ERR("Schedule queue create failed.\n"); > + LOG_ERR("Schedule queue create failed.\n"); > return -1; > } > } > @@ -1115,7 +1115,7 @@ int main(int argc, char *argv[]) > first_core); > > if (ret < 0) { > - EXAMPLE_ERR("Fork workers failed %i\n", ret); > + LOG_ERR("Fork workers failed %i\n", ret); > return -1; > } >
On 25 December 2014 at 05:55, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: > Looks good, we need to do the same for other functions. Might be for > packet i/o. > > Yes, Ola I think suggested he may have a timer performance app, and Petri had indicated he had ideas for reintroducing odp_example in a simpler form and we should try to get Victors crypto application in. > Maxim. > > > On 12/25/2014 01:36 AM, Mike Holmes wrote: > >> odp_example is too complex to be an example, and is not a unit test, >> instead it is a performance oriented test application. >> >> Signed-off-by: Mike Holmes <mike.holmes@linaro.org> >> --- >> configure.ac | 2 +- >> example/Makefile.am | 2 +- >> example/odp_example/.gitignore | 1 - >> example/odp_example/Makefile.am | 10 --- >> test/Makefile.am | 2 +- >> test/performance/.gitignore | 1 + >> test/performance/Makefile.am | 10 +++ >> .../performance/odp_scheduling.c | 76 >> +++++++++++----------- >> 8 files changed, 52 insertions(+), 52 deletions(-) >> delete mode 100644 example/odp_example/.gitignore >> delete mode 100644 example/odp_example/Makefile.am >> create mode 100644 test/performance/.gitignore >> create mode 100644 test/performance/Makefile.am >> rename example/odp_example/odp_example.c => test/performance/odp_scheduling.c >> (92%) >> >> diff --git a/configure.ac b/configure.ac >> index 377e8be..01644f6 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -198,13 +198,13 @@ AC_CONFIG_FILES([Makefile >> example/generator/Makefile >> example/ipsec/Makefile >> example/l2fwd/Makefile >> - example/odp_example/Makefile >> example/packet/Makefile >> example/timer/Makefile >> doc/Makefile >> test/Makefile >> test/api_test/Makefile >> test/validation/Makefile >> + test/performance/Makefile >> pkgconfig/libodp.pc]) >> AC_SEARCH_LIBS([timer_create],[rt posix4]) >> diff --git a/example/Makefile.am b/example/Makefile.am >> index b2a22a3..3021571 100644 >> --- a/example/Makefile.am >> +++ b/example/Makefile.am >> @@ -1 +1 @@ >> -SUBDIRS = generator ipsec l2fwd odp_example packet timer >> +SUBDIRS = generator ipsec l2fwd packet timer >> diff --git a/example/odp_example/.gitignore b/example/odp_example/. >> gitignore >> deleted file mode 100644 >> index 59ca8c8..0000000 >> --- a/example/odp_example/.gitignore >> +++ /dev/null >> @@ -1 +0,0 @@ >> -odp_example >> diff --git a/example/odp_example/Makefile.am b/example/odp_example/ >> Makefile.am >> deleted file mode 100644 >> index 8252424..0000000 >> --- a/example/odp_example/Makefile.am >> +++ /dev/null >> @@ -1,10 +0,0 @@ >> -include $(top_srcdir)/example/Makefile.inc >> - >> -bin_PROGRAMS = odp_example >> -odp_example_LDFLAGS = $(AM_LDFLAGS) -static >> -odp_example_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example >> - >> -noinst_HEADERS = \ >> - $(top_srcdir)/example/example_debug.h >> - >> -dist_odp_example_SOURCES = odp_example.c >> diff --git a/test/Makefile.am b/test/Makefile.am >> index 90598bf..afaa1d0 100644 >> --- a/test/Makefile.am >> +++ b/test/Makefile.am >> @@ -1 +1 @@ >> -SUBDIRS = api_test validation >> +SUBDIRS = api_test validation performance >> diff --git a/test/performance/.gitignore b/test/performance/.gitignore >> new file mode 100644 >> index 0000000..a229e10 >> --- /dev/null >> +++ b/test/performance/.gitignore >> @@ -0,0 +1 @@ >> +odp_scheduling >> diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am >> new file mode 100644 >> index 0000000..359c4f0 >> --- /dev/null >> +++ b/test/performance/Makefile.am >> @@ -0,0 +1,10 @@ >> +include $(top_srcdir)/test/Makefile.inc >> + >> +bin_PROGRAMS = odp_scheduling >> +odp_scheduling_LDFLAGS = $(AM_LDFLAGS) -static >> +odp_scheduling_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test >> + >> +noinst_HEADERS = \ >> + $(top_srcdir)/test/test_debug.h >> + >> +dist_odp_scheduling_SOURCES = odp_scheduling.c >> diff --git a/example/odp_example/odp_example.c b/test/performance/odp_ >> scheduling.c >> similarity index 92% >> rename from example/odp_example/odp_example.c >> rename to test/performance/odp_scheduling.c >> index 8373f12..a18e858 100644 >> --- a/example/odp_example/odp_example.c >> +++ b/test/performance/odp_scheduling.c >> @@ -13,7 +13,7 @@ >> #include <string.h> >> #include <stdlib.h> >> -#include <example_debug.h> >> +#include <test_debug.h> >> /* ODP main header */ >> #include <odp.h> >> @@ -95,7 +95,7 @@ static int create_queue(int thr, odp_buffer_pool_t >> msg_pool, int prio) >> buf = odp_buffer_alloc(msg_pool); >> if (!odp_buffer_is_valid(buf)) { >> - EXAMPLE_ERR(" [%i] msg_pool alloc failed\n", thr); >> + LOG_ERR(" [%i] msg_pool alloc failed\n", thr); >> return -1; >> } >> @@ -105,12 +105,12 @@ static int create_queue(int thr, >> odp_buffer_pool_t msg_pool, int prio) >> queue = odp_queue_lookup(name); >> if (queue == ODP_QUEUE_INVALID) { >> - EXAMPLE_ERR(" [%i] Queue %s lookup failed.\n", thr, >> name); >> + LOG_ERR(" [%i] Queue %s lookup failed.\n", thr, name); >> return -1; >> } >> if (odp_queue_enq(queue, buf)) { >> - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); >> + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); >> return -1; >> } >> @@ -144,20 +144,20 @@ static int create_queues(int thr, >> odp_buffer_pool_t msg_pool, int prio) >> queue = odp_queue_lookup(name); >> if (queue == ODP_QUEUE_INVALID) { >> - EXAMPLE_ERR(" [%i] Queue %s lookup failed.\n", >> thr, >> - name); >> + LOG_ERR(" [%i] Queue %s lookup failed.\n", thr, >> + name); >> return -1; >> } >> buf = odp_buffer_alloc(msg_pool); >> if (!odp_buffer_is_valid(buf)) { >> - EXAMPLE_ERR(" [%i] msg_pool alloc failed\n", >> thr); >> + LOG_ERR(" [%i] msg_pool alloc failed\n", thr); >> return -1; >> } >> if (odp_queue_enq(queue, buf)) { >> - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", >> thr); >> + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); >> return -1; >> } >> } >> @@ -186,7 +186,7 @@ static int test_alloc_single(int thr, >> odp_buffer_pool_t pool) >> temp_buf = odp_buffer_alloc(pool); >> if (!odp_buffer_is_valid(temp_buf)) { >> - EXAMPLE_ERR(" [%i] alloc_single failed\n", thr); >> + LOG_ERR(" [%i] alloc_single failed\n", thr); >> return -1; >> } >> @@ -224,7 +224,7 @@ static int test_alloc_multi(int thr, >> odp_buffer_pool_t pool) >> temp_buf[j] = odp_buffer_alloc(pool); >> if (!odp_buffer_is_valid(temp_buf[j])) { >> - EXAMPLE_ERR(" [%i] alloc_multi >> failed\n", thr); >> + LOG_ERR(" [%i] alloc_multi failed\n", >> thr); >> return -1; >> } >> } >> @@ -266,7 +266,7 @@ static int test_poll_queue(int thr, odp_buffer_pool_t >> msg_pool) >> buf = odp_buffer_alloc(msg_pool); >> if (!odp_buffer_is_valid(buf)) { >> - EXAMPLE_ERR(" [%i] msg_pool alloc failed\n", thr); >> + LOG_ERR(" [%i] msg_pool alloc failed\n", thr); >> return -1; >> } >> @@ -287,14 +287,14 @@ static int test_poll_queue(int thr, >> odp_buffer_pool_t msg_pool) >> for (i = 0; i < QUEUE_ROUNDS; i++) { >> if (odp_queue_enq(queue, buf)) { >> - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", >> thr); >> + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); >> return -1; >> } >> buf = odp_queue_deq(queue); >> if (!odp_buffer_is_valid(buf)) { >> - EXAMPLE_ERR(" [%i] Queue empty.\n", thr); >> + LOG_ERR(" [%i] Queue empty.\n", thr); >> return -1; >> } >> } >> @@ -343,7 +343,7 @@ static int test_schedule_one_single(const char *str, >> int thr, >> buf = odp_schedule_one(&queue, ODP_SCHED_WAIT); >> if (odp_queue_enq(queue, buf)) { >> - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", >> thr); >> + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); >> return -1; >> } >> } >> @@ -404,7 +404,7 @@ static int test_schedule_one_many(const char *str, >> int thr, >> buf = odp_schedule_one(&queue, ODP_SCHED_WAIT); >> if (odp_queue_enq(queue, buf)) { >> - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", >> thr); >> + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); >> return -1; >> } >> } >> @@ -462,7 +462,7 @@ static int test_schedule_single(const char *str, int >> thr, >> buf = odp_schedule(&queue, ODP_SCHED_WAIT); >> if (odp_queue_enq(queue, buf)) { >> - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", >> thr); >> + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); >> return -1; >> } >> } >> @@ -481,7 +481,7 @@ static int test_schedule_single(const char *str, int >> thr, >> tot++; >> if (odp_queue_enq(queue, buf)) { >> - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", >> thr); >> + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); >> return -1; >> } >> } >> @@ -541,7 +541,7 @@ static int test_schedule_many(const char *str, int >> thr, >> buf = odp_schedule(&queue, ODP_SCHED_WAIT); >> if (odp_queue_enq(queue, buf)) { >> - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", >> thr); >> + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); >> return -1; >> } >> } >> @@ -560,7 +560,7 @@ static int test_schedule_many(const char *str, int >> thr, >> tot++; >> if (odp_queue_enq(queue, buf)) { >> - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", >> thr); >> + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); >> return -1; >> } >> } >> @@ -619,8 +619,8 @@ static int test_schedule_multi(const char *str, int >> thr, >> queue = odp_queue_lookup(name); >> if (queue == ODP_QUEUE_INVALID) { >> - EXAMPLE_ERR(" [%i] Queue %s lookup failed.\n", >> thr, >> - name); >> + LOG_ERR(" [%i] Queue %s lookup failed.\n", thr, >> + name); >> return -1; >> } >> @@ -628,14 +628,14 @@ static int test_schedule_multi(const char *str, >> int thr, >> buf[j] = odp_buffer_alloc(msg_pool); >> if (!odp_buffer_is_valid(buf[j])) { >> - EXAMPLE_ERR(" [%i] msg_pool alloc >> failed\n", >> - thr); >> + LOG_ERR(" [%i] msg_pool alloc failed\n", >> + thr); >> return -1; >> } >> } >> if (odp_queue_enq_multi(queue, buf, MULTI_BUFS_MAX)) { >> - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", >> thr); >> + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); >> return -1; >> } >> } >> @@ -650,7 +650,7 @@ static int test_schedule_multi(const char *str, int >> thr, >> tot += num; >> if (odp_queue_enq_multi(queue, buf, num)) { >> - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", >> thr); >> + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); >> return -1; >> } >> } >> @@ -668,7 +668,7 @@ static int test_schedule_multi(const char *str, int >> thr, >> tot += num; >> if (odp_queue_enq_multi(queue, buf, num)) { >> - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", >> thr); >> + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); >> return -1; >> } >> } >> @@ -720,7 +720,7 @@ static void *run_thread(void *arg) >> globals = odp_shm_addr(shm); >> if (globals == NULL) { >> - EXAMPLE_ERR("Shared mem lookup failed\n"); >> + LOG_ERR("Shared mem lookup failed\n"); >> return NULL; >> } >> @@ -740,7 +740,7 @@ static void *run_thread(void *arg) >> msg_pool = odp_buffer_pool_lookup("msg_pool"); >> if (msg_pool == ODP_BUFFER_POOL_INVALID) { >> - EXAMPLE_ERR(" [%i] msg_pool not found\n", thr); >> + LOG_ERR(" [%i] msg_pool not found\n", thr); >> return NULL; >> } >> @@ -840,7 +840,7 @@ static void test_time(void) >> double err; >> if (clock_gettime(CLOCK_MONOTONIC, &tp2)) { >> - EXAMPLE_ERR("clock_gettime failed.\n"); >> + LOG_ERR("clock_gettime failed.\n"); >> return; >> } >> @@ -848,7 +848,7 @@ static void test_time(void) >> do { >> if (clock_gettime(CLOCK_MONOTONIC, &tp1)) { >> - EXAMPLE_ERR("clock_gettime failed.\n"); >> + LOG_ERR("clock_gettime failed.\n"); >> return; >> } >> @@ -858,7 +858,7 @@ static void test_time(void) >> do { >> if (clock_gettime(CLOCK_MONOTONIC, &tp2)) { >> - EXAMPLE_ERR("clock_gettime failed.\n"); >> + LOG_ERR("clock_gettime failed.\n"); >> return; >> } >> @@ -976,7 +976,7 @@ int main(int argc, char *argv[]) >> /* ODP global init */ >> if (odp_init_global(NULL, NULL)) { >> - EXAMPLE_ERR("ODP global init failed.\n"); >> + LOG_ERR("ODP global init failed.\n"); >> return -1; >> } >> @@ -985,7 +985,7 @@ int main(int argc, char *argv[]) >> * setting up resources for worker threads. >> */ >> if (odp_init_local()) { >> - EXAMPLE_ERR("ODP global init failed.\n"); >> + LOG_ERR("ODP global init failed.\n"); >> return -1; >> } >> @@ -1033,7 +1033,7 @@ int main(int argc, char *argv[]) >> globals = odp_shm_addr(shm); >> if (globals == NULL) { >> - EXAMPLE_ERR("Shared memory reserve failed.\n"); >> + LOG_ERR("Shared memory reserve failed.\n"); >> return -1; >> } >> @@ -1051,7 +1051,7 @@ int main(int argc, char *argv[]) >> pool = odp_buffer_pool_create("msg_pool", ODP_SHM_NULL, ¶ms); >> if (pool == ODP_BUFFER_POOL_INVALID) { >> - EXAMPLE_ERR("Pool create failed.\n"); >> + LOG_ERR("Pool create failed.\n"); >> return -1; >> } >> @@ -1063,7 +1063,7 @@ int main(int argc, char *argv[]) >> queue = odp_queue_create("poll_queue", ODP_QUEUE_TYPE_POLL, NULL); >> if (queue == ODP_QUEUE_INVALID) { >> - EXAMPLE_ERR("Poll queue create failed.\n"); >> + LOG_ERR("Poll queue create failed.\n"); >> return -1; >> } >> @@ -1095,7 +1095,7 @@ int main(int argc, char *argv[]) >> ¶m); >> if (queue == ODP_QUEUE_INVALID) { >> - EXAMPLE_ERR("Schedule queue create >> failed.\n"); >> + LOG_ERR("Schedule queue create >> failed.\n"); >> return -1; >> } >> } >> @@ -1115,7 +1115,7 @@ int main(int argc, char *argv[]) >> first_core); >> if (ret < 0) { >> - EXAMPLE_ERR("Fork workers failed %i\n", ret); >> + LOG_ERR("Fork workers failed %i\n", ret); >> return -1; >> } >> >> > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp >
On 12/25/2014 12:36 AM, Mike Holmes wrote: > odp_example is too complex to be an example, and is not a unit test, > instead it is a performance oriented test application. > > Signed-off-by: Mike Holmes <mike.holmes@linaro.org> Reviewed-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
On 24 December 2014 at 23:36, Mike Holmes <mike.holmes@linaro.org> wrote: > odp_example is too complex to be an example, and is not a unit test, > instead it is a performance oriented test application. > > Signed-off-by: Mike Holmes <mike.holmes@linaro.org> > --- > configure.ac | 2 +- > example/Makefile.am | 2 +- > example/odp_example/.gitignore | 1 - > example/odp_example/Makefile.am | 10 --- > test/Makefile.am | 2 +- > test/performance/.gitignore | 1 + > test/performance/Makefile.am | 10 +++ > .../performance/odp_scheduling.c | 76 +++++++++++----------- > 8 files changed, 52 insertions(+), 52 deletions(-) > delete mode 100644 example/odp_example/.gitignore > delete mode 100644 example/odp_example/Makefile.am > create mode 100644 test/performance/.gitignore > create mode 100644 test/performance/Makefile.am > rename example/odp_example/odp_example.c => test/performance/odp_scheduling.c (92%) > > diff --git a/configure.ac b/configure.ac > index 377e8be..01644f6 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -198,13 +198,13 @@ AC_CONFIG_FILES([Makefile > example/generator/Makefile > example/ipsec/Makefile > example/l2fwd/Makefile > - example/odp_example/Makefile > example/packet/Makefile > example/timer/Makefile > doc/Makefile > test/Makefile > test/api_test/Makefile > test/validation/Makefile > + test/performance/Makefile Nit: this should be in alphabetic order... Maybe Maxim can fix this before he push? Cheers, Anders
Merged with alphabetical order change in configure.ac as Anders suggested. Maxim. On 12/25/2014 01:36 AM, Mike Holmes wrote: > odp_example is too complex to be an example, and is not a unit test, > instead it is a performance oriented test application. > > Signed-off-by: Mike Holmes <mike.holmes@linaro.org> > --- > configure.ac | 2 +- > example/Makefile.am | 2 +- > example/odp_example/.gitignore | 1 - > example/odp_example/Makefile.am | 10 --- > test/Makefile.am | 2 +- > test/performance/.gitignore | 1 + > test/performance/Makefile.am | 10 +++ > .../performance/odp_scheduling.c | 76 +++++++++++----------- > 8 files changed, 52 insertions(+), 52 deletions(-) > delete mode 100644 example/odp_example/.gitignore > delete mode 100644 example/odp_example/Makefile.am > create mode 100644 test/performance/.gitignore > create mode 100644 test/performance/Makefile.am > rename example/odp_example/odp_example.c => test/performance/odp_scheduling.c (92%) > > diff --git a/configure.ac b/configure.ac > index 377e8be..01644f6 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -198,13 +198,13 @@ AC_CONFIG_FILES([Makefile > example/generator/Makefile > example/ipsec/Makefile > example/l2fwd/Makefile > - example/odp_example/Makefile > example/packet/Makefile > example/timer/Makefile > doc/Makefile > test/Makefile > test/api_test/Makefile > test/validation/Makefile > + test/performance/Makefile > pkgconfig/libodp.pc]) > > AC_SEARCH_LIBS([timer_create],[rt posix4]) > diff --git a/example/Makefile.am b/example/Makefile.am > index b2a22a3..3021571 100644 > --- a/example/Makefile.am > +++ b/example/Makefile.am > @@ -1 +1 @@ > -SUBDIRS = generator ipsec l2fwd odp_example packet timer > +SUBDIRS = generator ipsec l2fwd packet timer > diff --git a/example/odp_example/.gitignore b/example/odp_example/.gitignore > deleted file mode 100644 > index 59ca8c8..0000000 > --- a/example/odp_example/.gitignore > +++ /dev/null > @@ -1 +0,0 @@ > -odp_example > diff --git a/example/odp_example/Makefile.am b/example/odp_example/Makefile.am > deleted file mode 100644 > index 8252424..0000000 > --- a/example/odp_example/Makefile.am > +++ /dev/null > @@ -1,10 +0,0 @@ > -include $(top_srcdir)/example/Makefile.inc > - > -bin_PROGRAMS = odp_example > -odp_example_LDFLAGS = $(AM_LDFLAGS) -static > -odp_example_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example > - > -noinst_HEADERS = \ > - $(top_srcdir)/example/example_debug.h > - > -dist_odp_example_SOURCES = odp_example.c > diff --git a/test/Makefile.am b/test/Makefile.am > index 90598bf..afaa1d0 100644 > --- a/test/Makefile.am > +++ b/test/Makefile.am > @@ -1 +1 @@ > -SUBDIRS = api_test validation > +SUBDIRS = api_test validation performance > diff --git a/test/performance/.gitignore b/test/performance/.gitignore > new file mode 100644 > index 0000000..a229e10 > --- /dev/null > +++ b/test/performance/.gitignore > @@ -0,0 +1 @@ > +odp_scheduling > diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am > new file mode 100644 > index 0000000..359c4f0 > --- /dev/null > +++ b/test/performance/Makefile.am > @@ -0,0 +1,10 @@ > +include $(top_srcdir)/test/Makefile.inc > + > +bin_PROGRAMS = odp_scheduling > +odp_scheduling_LDFLAGS = $(AM_LDFLAGS) -static > +odp_scheduling_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test > + > +noinst_HEADERS = \ > + $(top_srcdir)/test/test_debug.h > + > +dist_odp_scheduling_SOURCES = odp_scheduling.c > diff --git a/example/odp_example/odp_example.c b/test/performance/odp_scheduling.c > similarity index 92% > rename from example/odp_example/odp_example.c > rename to test/performance/odp_scheduling.c > index 8373f12..a18e858 100644 > --- a/example/odp_example/odp_example.c > +++ b/test/performance/odp_scheduling.c > @@ -13,7 +13,7 @@ > #include <string.h> > #include <stdlib.h> > > -#include <example_debug.h> > +#include <test_debug.h> > > /* ODP main header */ > #include <odp.h> > @@ -95,7 +95,7 @@ static int create_queue(int thr, odp_buffer_pool_t msg_pool, int prio) > buf = odp_buffer_alloc(msg_pool); > > if (!odp_buffer_is_valid(buf)) { > - EXAMPLE_ERR(" [%i] msg_pool alloc failed\n", thr); > + LOG_ERR(" [%i] msg_pool alloc failed\n", thr); > return -1; > } > > @@ -105,12 +105,12 @@ static int create_queue(int thr, odp_buffer_pool_t msg_pool, int prio) > queue = odp_queue_lookup(name); > > if (queue == ODP_QUEUE_INVALID) { > - EXAMPLE_ERR(" [%i] Queue %s lookup failed.\n", thr, name); > + LOG_ERR(" [%i] Queue %s lookup failed.\n", thr, name); > return -1; > } > > if (odp_queue_enq(queue, buf)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > > @@ -144,20 +144,20 @@ static int create_queues(int thr, odp_buffer_pool_t msg_pool, int prio) > queue = odp_queue_lookup(name); > > if (queue == ODP_QUEUE_INVALID) { > - EXAMPLE_ERR(" [%i] Queue %s lookup failed.\n", thr, > - name); > + LOG_ERR(" [%i] Queue %s lookup failed.\n", thr, > + name); > return -1; > } > > buf = odp_buffer_alloc(msg_pool); > > if (!odp_buffer_is_valid(buf)) { > - EXAMPLE_ERR(" [%i] msg_pool alloc failed\n", thr); > + LOG_ERR(" [%i] msg_pool alloc failed\n", thr); > return -1; > } > > if (odp_queue_enq(queue, buf)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -186,7 +186,7 @@ static int test_alloc_single(int thr, odp_buffer_pool_t pool) > temp_buf = odp_buffer_alloc(pool); > > if (!odp_buffer_is_valid(temp_buf)) { > - EXAMPLE_ERR(" [%i] alloc_single failed\n", thr); > + LOG_ERR(" [%i] alloc_single failed\n", thr); > return -1; > } > > @@ -224,7 +224,7 @@ static int test_alloc_multi(int thr, odp_buffer_pool_t pool) > temp_buf[j] = odp_buffer_alloc(pool); > > if (!odp_buffer_is_valid(temp_buf[j])) { > - EXAMPLE_ERR(" [%i] alloc_multi failed\n", thr); > + LOG_ERR(" [%i] alloc_multi failed\n", thr); > return -1; > } > } > @@ -266,7 +266,7 @@ static int test_poll_queue(int thr, odp_buffer_pool_t msg_pool) > buf = odp_buffer_alloc(msg_pool); > > if (!odp_buffer_is_valid(buf)) { > - EXAMPLE_ERR(" [%i] msg_pool alloc failed\n", thr); > + LOG_ERR(" [%i] msg_pool alloc failed\n", thr); > return -1; > } > > @@ -287,14 +287,14 @@ static int test_poll_queue(int thr, odp_buffer_pool_t msg_pool) > > for (i = 0; i < QUEUE_ROUNDS; i++) { > if (odp_queue_enq(queue, buf)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > > buf = odp_queue_deq(queue); > > if (!odp_buffer_is_valid(buf)) { > - EXAMPLE_ERR(" [%i] Queue empty.\n", thr); > + LOG_ERR(" [%i] Queue empty.\n", thr); > return -1; > } > } > @@ -343,7 +343,7 @@ static int test_schedule_one_single(const char *str, int thr, > buf = odp_schedule_one(&queue, ODP_SCHED_WAIT); > > if (odp_queue_enq(queue, buf)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -404,7 +404,7 @@ static int test_schedule_one_many(const char *str, int thr, > buf = odp_schedule_one(&queue, ODP_SCHED_WAIT); > > if (odp_queue_enq(queue, buf)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -462,7 +462,7 @@ static int test_schedule_single(const char *str, int thr, > buf = odp_schedule(&queue, ODP_SCHED_WAIT); > > if (odp_queue_enq(queue, buf)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -481,7 +481,7 @@ static int test_schedule_single(const char *str, int thr, > tot++; > > if (odp_queue_enq(queue, buf)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -541,7 +541,7 @@ static int test_schedule_many(const char *str, int thr, > buf = odp_schedule(&queue, ODP_SCHED_WAIT); > > if (odp_queue_enq(queue, buf)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -560,7 +560,7 @@ static int test_schedule_many(const char *str, int thr, > tot++; > > if (odp_queue_enq(queue, buf)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -619,8 +619,8 @@ static int test_schedule_multi(const char *str, int thr, > queue = odp_queue_lookup(name); > > if (queue == ODP_QUEUE_INVALID) { > - EXAMPLE_ERR(" [%i] Queue %s lookup failed.\n", thr, > - name); > + LOG_ERR(" [%i] Queue %s lookup failed.\n", thr, > + name); > return -1; > } > > @@ -628,14 +628,14 @@ static int test_schedule_multi(const char *str, int thr, > buf[j] = odp_buffer_alloc(msg_pool); > > if (!odp_buffer_is_valid(buf[j])) { > - EXAMPLE_ERR(" [%i] msg_pool alloc failed\n", > - thr); > + LOG_ERR(" [%i] msg_pool alloc failed\n", > + thr); > return -1; > } > } > > if (odp_queue_enq_multi(queue, buf, MULTI_BUFS_MAX)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -650,7 +650,7 @@ static int test_schedule_multi(const char *str, int thr, > tot += num; > > if (odp_queue_enq_multi(queue, buf, num)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -668,7 +668,7 @@ static int test_schedule_multi(const char *str, int thr, > tot += num; > > if (odp_queue_enq_multi(queue, buf, num)) { > - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); > + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); > return -1; > } > } > @@ -720,7 +720,7 @@ static void *run_thread(void *arg) > globals = odp_shm_addr(shm); > > if (globals == NULL) { > - EXAMPLE_ERR("Shared mem lookup failed\n"); > + LOG_ERR("Shared mem lookup failed\n"); > return NULL; > } > > @@ -740,7 +740,7 @@ static void *run_thread(void *arg) > msg_pool = odp_buffer_pool_lookup("msg_pool"); > > if (msg_pool == ODP_BUFFER_POOL_INVALID) { > - EXAMPLE_ERR(" [%i] msg_pool not found\n", thr); > + LOG_ERR(" [%i] msg_pool not found\n", thr); > return NULL; > } > > @@ -840,7 +840,7 @@ static void test_time(void) > double err; > > if (clock_gettime(CLOCK_MONOTONIC, &tp2)) { > - EXAMPLE_ERR("clock_gettime failed.\n"); > + LOG_ERR("clock_gettime failed.\n"); > return; > } > > @@ -848,7 +848,7 @@ static void test_time(void) > > do { > if (clock_gettime(CLOCK_MONOTONIC, &tp1)) { > - EXAMPLE_ERR("clock_gettime failed.\n"); > + LOG_ERR("clock_gettime failed.\n"); > return; > } > > @@ -858,7 +858,7 @@ static void test_time(void) > > do { > if (clock_gettime(CLOCK_MONOTONIC, &tp2)) { > - EXAMPLE_ERR("clock_gettime failed.\n"); > + LOG_ERR("clock_gettime failed.\n"); > return; > } > > @@ -976,7 +976,7 @@ int main(int argc, char *argv[]) > > /* ODP global init */ > if (odp_init_global(NULL, NULL)) { > - EXAMPLE_ERR("ODP global init failed.\n"); > + LOG_ERR("ODP global init failed.\n"); > return -1; > } > > @@ -985,7 +985,7 @@ int main(int argc, char *argv[]) > * setting up resources for worker threads. > */ > if (odp_init_local()) { > - EXAMPLE_ERR("ODP global init failed.\n"); > + LOG_ERR("ODP global init failed.\n"); > return -1; > } > > @@ -1033,7 +1033,7 @@ int main(int argc, char *argv[]) > globals = odp_shm_addr(shm); > > if (globals == NULL) { > - EXAMPLE_ERR("Shared memory reserve failed.\n"); > + LOG_ERR("Shared memory reserve failed.\n"); > return -1; > } > > @@ -1051,7 +1051,7 @@ int main(int argc, char *argv[]) > pool = odp_buffer_pool_create("msg_pool", ODP_SHM_NULL, ¶ms); > > if (pool == ODP_BUFFER_POOL_INVALID) { > - EXAMPLE_ERR("Pool create failed.\n"); > + LOG_ERR("Pool create failed.\n"); > return -1; > } > > @@ -1063,7 +1063,7 @@ int main(int argc, char *argv[]) > queue = odp_queue_create("poll_queue", ODP_QUEUE_TYPE_POLL, NULL); > > if (queue == ODP_QUEUE_INVALID) { > - EXAMPLE_ERR("Poll queue create failed.\n"); > + LOG_ERR("Poll queue create failed.\n"); > return -1; > } > > @@ -1095,7 +1095,7 @@ int main(int argc, char *argv[]) > ¶m); > > if (queue == ODP_QUEUE_INVALID) { > - EXAMPLE_ERR("Schedule queue create failed.\n"); > + LOG_ERR("Schedule queue create failed.\n"); > return -1; > } > } > @@ -1115,7 +1115,7 @@ int main(int argc, char *argv[]) > first_core); > > if (ret < 0) { > - EXAMPLE_ERR("Fork workers failed %i\n", ret); > + LOG_ERR("Fork workers failed %i\n", ret); > return -1; > } >
diff --git a/configure.ac b/configure.ac index 377e8be..01644f6 100644 --- a/configure.ac +++ b/configure.ac @@ -198,13 +198,13 @@ AC_CONFIG_FILES([Makefile example/generator/Makefile example/ipsec/Makefile example/l2fwd/Makefile - example/odp_example/Makefile example/packet/Makefile example/timer/Makefile doc/Makefile test/Makefile test/api_test/Makefile test/validation/Makefile + test/performance/Makefile pkgconfig/libodp.pc]) AC_SEARCH_LIBS([timer_create],[rt posix4]) diff --git a/example/Makefile.am b/example/Makefile.am index b2a22a3..3021571 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -1 +1 @@ -SUBDIRS = generator ipsec l2fwd odp_example packet timer +SUBDIRS = generator ipsec l2fwd packet timer diff --git a/example/odp_example/.gitignore b/example/odp_example/.gitignore deleted file mode 100644 index 59ca8c8..0000000 --- a/example/odp_example/.gitignore +++ /dev/null @@ -1 +0,0 @@ -odp_example diff --git a/example/odp_example/Makefile.am b/example/odp_example/Makefile.am deleted file mode 100644 index 8252424..0000000 --- a/example/odp_example/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -include $(top_srcdir)/example/Makefile.inc - -bin_PROGRAMS = odp_example -odp_example_LDFLAGS = $(AM_LDFLAGS) -static -odp_example_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example - -noinst_HEADERS = \ - $(top_srcdir)/example/example_debug.h - -dist_odp_example_SOURCES = odp_example.c diff --git a/test/Makefile.am b/test/Makefile.am index 90598bf..afaa1d0 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1 +1 @@ -SUBDIRS = api_test validation +SUBDIRS = api_test validation performance diff --git a/test/performance/.gitignore b/test/performance/.gitignore new file mode 100644 index 0000000..a229e10 --- /dev/null +++ b/test/performance/.gitignore @@ -0,0 +1 @@ +odp_scheduling diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am new file mode 100644 index 0000000..359c4f0 --- /dev/null +++ b/test/performance/Makefile.am @@ -0,0 +1,10 @@ +include $(top_srcdir)/test/Makefile.inc + +bin_PROGRAMS = odp_scheduling +odp_scheduling_LDFLAGS = $(AM_LDFLAGS) -static +odp_scheduling_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test + +noinst_HEADERS = \ + $(top_srcdir)/test/test_debug.h + +dist_odp_scheduling_SOURCES = odp_scheduling.c diff --git a/example/odp_example/odp_example.c b/test/performance/odp_scheduling.c similarity index 92% rename from example/odp_example/odp_example.c rename to test/performance/odp_scheduling.c index 8373f12..a18e858 100644 --- a/example/odp_example/odp_example.c +++ b/test/performance/odp_scheduling.c @@ -13,7 +13,7 @@ #include <string.h> #include <stdlib.h> -#include <example_debug.h> +#include <test_debug.h> /* ODP main header */ #include <odp.h> @@ -95,7 +95,7 @@ static int create_queue(int thr, odp_buffer_pool_t msg_pool, int prio) buf = odp_buffer_alloc(msg_pool); if (!odp_buffer_is_valid(buf)) { - EXAMPLE_ERR(" [%i] msg_pool alloc failed\n", thr); + LOG_ERR(" [%i] msg_pool alloc failed\n", thr); return -1; } @@ -105,12 +105,12 @@ static int create_queue(int thr, odp_buffer_pool_t msg_pool, int prio) queue = odp_queue_lookup(name); if (queue == ODP_QUEUE_INVALID) { - EXAMPLE_ERR(" [%i] Queue %s lookup failed.\n", thr, name); + LOG_ERR(" [%i] Queue %s lookup failed.\n", thr, name); return -1; } if (odp_queue_enq(queue, buf)) { - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } @@ -144,20 +144,20 @@ static int create_queues(int thr, odp_buffer_pool_t msg_pool, int prio) queue = odp_queue_lookup(name); if (queue == ODP_QUEUE_INVALID) { - EXAMPLE_ERR(" [%i] Queue %s lookup failed.\n", thr, - name); + LOG_ERR(" [%i] Queue %s lookup failed.\n", thr, + name); return -1; } buf = odp_buffer_alloc(msg_pool); if (!odp_buffer_is_valid(buf)) { - EXAMPLE_ERR(" [%i] msg_pool alloc failed\n", thr); + LOG_ERR(" [%i] msg_pool alloc failed\n", thr); return -1; } if (odp_queue_enq(queue, buf)) { - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } } @@ -186,7 +186,7 @@ static int test_alloc_single(int thr, odp_buffer_pool_t pool) temp_buf = odp_buffer_alloc(pool); if (!odp_buffer_is_valid(temp_buf)) { - EXAMPLE_ERR(" [%i] alloc_single failed\n", thr); + LOG_ERR(" [%i] alloc_single failed\n", thr); return -1; } @@ -224,7 +224,7 @@ static int test_alloc_multi(int thr, odp_buffer_pool_t pool) temp_buf[j] = odp_buffer_alloc(pool); if (!odp_buffer_is_valid(temp_buf[j])) { - EXAMPLE_ERR(" [%i] alloc_multi failed\n", thr); + LOG_ERR(" [%i] alloc_multi failed\n", thr); return -1; } } @@ -266,7 +266,7 @@ static int test_poll_queue(int thr, odp_buffer_pool_t msg_pool) buf = odp_buffer_alloc(msg_pool); if (!odp_buffer_is_valid(buf)) { - EXAMPLE_ERR(" [%i] msg_pool alloc failed\n", thr); + LOG_ERR(" [%i] msg_pool alloc failed\n", thr); return -1; } @@ -287,14 +287,14 @@ static int test_poll_queue(int thr, odp_buffer_pool_t msg_pool) for (i = 0; i < QUEUE_ROUNDS; i++) { if (odp_queue_enq(queue, buf)) { - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } buf = odp_queue_deq(queue); if (!odp_buffer_is_valid(buf)) { - EXAMPLE_ERR(" [%i] Queue empty.\n", thr); + LOG_ERR(" [%i] Queue empty.\n", thr); return -1; } } @@ -343,7 +343,7 @@ static int test_schedule_one_single(const char *str, int thr, buf = odp_schedule_one(&queue, ODP_SCHED_WAIT); if (odp_queue_enq(queue, buf)) { - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } } @@ -404,7 +404,7 @@ static int test_schedule_one_many(const char *str, int thr, buf = odp_schedule_one(&queue, ODP_SCHED_WAIT); if (odp_queue_enq(queue, buf)) { - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } } @@ -462,7 +462,7 @@ static int test_schedule_single(const char *str, int thr, buf = odp_schedule(&queue, ODP_SCHED_WAIT); if (odp_queue_enq(queue, buf)) { - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } } @@ -481,7 +481,7 @@ static int test_schedule_single(const char *str, int thr, tot++; if (odp_queue_enq(queue, buf)) { - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } } @@ -541,7 +541,7 @@ static int test_schedule_many(const char *str, int thr, buf = odp_schedule(&queue, ODP_SCHED_WAIT); if (odp_queue_enq(queue, buf)) { - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } } @@ -560,7 +560,7 @@ static int test_schedule_many(const char *str, int thr, tot++; if (odp_queue_enq(queue, buf)) { - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } } @@ -619,8 +619,8 @@ static int test_schedule_multi(const char *str, int thr, queue = odp_queue_lookup(name); if (queue == ODP_QUEUE_INVALID) { - EXAMPLE_ERR(" [%i] Queue %s lookup failed.\n", thr, - name); + LOG_ERR(" [%i] Queue %s lookup failed.\n", thr, + name); return -1; } @@ -628,14 +628,14 @@ static int test_schedule_multi(const char *str, int thr, buf[j] = odp_buffer_alloc(msg_pool); if (!odp_buffer_is_valid(buf[j])) { - EXAMPLE_ERR(" [%i] msg_pool alloc failed\n", - thr); + LOG_ERR(" [%i] msg_pool alloc failed\n", + thr); return -1; } } if (odp_queue_enq_multi(queue, buf, MULTI_BUFS_MAX)) { - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } } @@ -650,7 +650,7 @@ static int test_schedule_multi(const char *str, int thr, tot += num; if (odp_queue_enq_multi(queue, buf, num)) { - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } } @@ -668,7 +668,7 @@ static int test_schedule_multi(const char *str, int thr, tot += num; if (odp_queue_enq_multi(queue, buf, num)) { - EXAMPLE_ERR(" [%i] Queue enqueue failed.\n", thr); + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } } @@ -720,7 +720,7 @@ static void *run_thread(void *arg) globals = odp_shm_addr(shm); if (globals == NULL) { - EXAMPLE_ERR("Shared mem lookup failed\n"); + LOG_ERR("Shared mem lookup failed\n"); return NULL; } @@ -740,7 +740,7 @@ static void *run_thread(void *arg) msg_pool = odp_buffer_pool_lookup("msg_pool"); if (msg_pool == ODP_BUFFER_POOL_INVALID) { - EXAMPLE_ERR(" [%i] msg_pool not found\n", thr); + LOG_ERR(" [%i] msg_pool not found\n", thr); return NULL; } @@ -840,7 +840,7 @@ static void test_time(void) double err; if (clock_gettime(CLOCK_MONOTONIC, &tp2)) { - EXAMPLE_ERR("clock_gettime failed.\n"); + LOG_ERR("clock_gettime failed.\n"); return; } @@ -848,7 +848,7 @@ static void test_time(void) do { if (clock_gettime(CLOCK_MONOTONIC, &tp1)) { - EXAMPLE_ERR("clock_gettime failed.\n"); + LOG_ERR("clock_gettime failed.\n"); return; } @@ -858,7 +858,7 @@ static void test_time(void) do { if (clock_gettime(CLOCK_MONOTONIC, &tp2)) { - EXAMPLE_ERR("clock_gettime failed.\n"); + LOG_ERR("clock_gettime failed.\n"); return; } @@ -976,7 +976,7 @@ int main(int argc, char *argv[]) /* ODP global init */ if (odp_init_global(NULL, NULL)) { - EXAMPLE_ERR("ODP global init failed.\n"); + LOG_ERR("ODP global init failed.\n"); return -1; } @@ -985,7 +985,7 @@ int main(int argc, char *argv[]) * setting up resources for worker threads. */ if (odp_init_local()) { - EXAMPLE_ERR("ODP global init failed.\n"); + LOG_ERR("ODP global init failed.\n"); return -1; } @@ -1033,7 +1033,7 @@ int main(int argc, char *argv[]) globals = odp_shm_addr(shm); if (globals == NULL) { - EXAMPLE_ERR("Shared memory reserve failed.\n"); + LOG_ERR("Shared memory reserve failed.\n"); return -1; } @@ -1051,7 +1051,7 @@ int main(int argc, char *argv[]) pool = odp_buffer_pool_create("msg_pool", ODP_SHM_NULL, ¶ms); if (pool == ODP_BUFFER_POOL_INVALID) { - EXAMPLE_ERR("Pool create failed.\n"); + LOG_ERR("Pool create failed.\n"); return -1; } @@ -1063,7 +1063,7 @@ int main(int argc, char *argv[]) queue = odp_queue_create("poll_queue", ODP_QUEUE_TYPE_POLL, NULL); if (queue == ODP_QUEUE_INVALID) { - EXAMPLE_ERR("Poll queue create failed.\n"); + LOG_ERR("Poll queue create failed.\n"); return -1; } @@ -1095,7 +1095,7 @@ int main(int argc, char *argv[]) ¶m); if (queue == ODP_QUEUE_INVALID) { - EXAMPLE_ERR("Schedule queue create failed.\n"); + LOG_ERR("Schedule queue create failed.\n"); return -1; } } @@ -1115,7 +1115,7 @@ int main(int argc, char *argv[]) first_core); if (ret < 0) { - EXAMPLE_ERR("Fork workers failed %i\n", ret); + LOG_ERR("Fork workers failed %i\n", ret); return -1; }
odp_example is too complex to be an example, and is not a unit test, instead it is a performance oriented test application. Signed-off-by: Mike Holmes <mike.holmes@linaro.org> --- configure.ac | 2 +- example/Makefile.am | 2 +- example/odp_example/.gitignore | 1 - example/odp_example/Makefile.am | 10 --- test/Makefile.am | 2 +- test/performance/.gitignore | 1 + test/performance/Makefile.am | 10 +++ .../performance/odp_scheduling.c | 76 +++++++++++----------- 8 files changed, 52 insertions(+), 52 deletions(-) delete mode 100644 example/odp_example/.gitignore delete mode 100644 example/odp_example/Makefile.am create mode 100644 test/performance/.gitignore create mode 100644 test/performance/Makefile.am rename example/odp_example/odp_example.c => test/performance/odp_scheduling.c (92%)