diff mbox

performance: odp_atomic: move atomic test from api_test to performance

Message ID 1426625996-8864-2-git-send-email-mike.holmes@linaro.org
State Accepted
Commit 091463bc03c7b9572404c8d327deb34a0c0cd3ce
Headers show

Commit Message

Mike Holmes March 17, 2015, 8:59 p.m. UTC
Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 test/api_test/.gitignore                           |   1 -
 test/api_test/Makefile.am                          |   6 +-
 test/api_test/odp_atomic_test.h                    |  51 --------
 test/api_test/odp_common.c                         |   2 +-
 test/performance/.gitignore                        |   1 +
 test/performance/Makefile.am                       |   6 +-
 .../odp_atomic_test.c => performance/odp_atomic.c} | 136 ++++++++++++++++++++-
 7 files changed, 139 insertions(+), 64 deletions(-)
 delete mode 100644 test/api_test/odp_atomic_test.h
 rename test/{api_test/odp_atomic_test.c => performance/odp_atomic.c} (63%)

Comments

Bill Fischofer March 17, 2015, 10:07 p.m. UTC | #1
These changes do not seem to be a simple move as logic is being changed.  A
better commit message needed to say what's really happening perhaps?

On Tue, Mar 17, 2015 at 3:59 PM, Mike Holmes <mike.holmes@linaro.org> wrote:

> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>  test/api_test/.gitignore                           |   1 -
>  test/api_test/Makefile.am                          |   6 +-
>  test/api_test/odp_atomic_test.h                    |  51 --------
>  test/api_test/odp_common.c                         |   2 +-
>  test/performance/.gitignore                        |   1 +
>  test/performance/Makefile.am                       |   6 +-
>  .../odp_atomic_test.c => performance/odp_atomic.c} | 136
> ++++++++++++++++++++-
>  7 files changed, 139 insertions(+), 64 deletions(-)
>  delete mode 100644 test/api_test/odp_atomic_test.h
>  rename test/{api_test/odp_atomic_test.c => performance/odp_atomic.c} (63%)
>
> diff --git a/test/api_test/.gitignore b/test/api_test/.gitignore
> index 84159e1..950f443 100644
> --- a/test/api_test/.gitignore
> +++ b/test/api_test/.gitignore
> @@ -1,3 +1,2 @@
> -odp_atomic
>  odp_ring
>  odp_shm
> diff --git a/test/api_test/Makefile.am b/test/api_test/Makefile.am
> index 86e1bc2..f231fee 100644
> --- a/test/api_test/Makefile.am
> +++ b/test/api_test/Makefile.am
> @@ -1,21 +1,17 @@
>  include $(top_srcdir)/test/Makefile.inc
>
> -bin_PROGRAMS = odp_atomic odp_shm odp_ring
> +bin_PROGRAMS = odp_shm odp_ring
>
> -odp_atomic_CFLAGS = $(AM_CFLAGS)
>  odp_shm_CFLAGS = $(AM_CFLAGS)
>  odp_ring_CFLAGS = $(AM_CFLAGS)
>
> -odp_atomic_LDFLAGS = $(AM_LDFLAGS) -static
>  odp_shm_LDFLAGS = $(AM_LDFLAGS) -static
>  odp_ring_LDFLAGS = $(AM_LDFLAGS) -static
>
>  noinst_HEADERS = \
> -                 $(top_srcdir)/test/api_test/odp_atomic_test.h \
>                   $(top_srcdir)/test/api_test/odp_common.h \
>                   $(top_srcdir)/test/api_test/odp_shm_test.h \
>                   $(top_srcdir)/test/test_debug.h
>
> -dist_odp_atomic_SOURCES = odp_atomic_test.c odp_common.c
>  dist_odp_shm_SOURCES = odp_shm_test.c odp_common.c
>  dist_odp_ring_SOURCES = odp_ring_test.c odp_common.c
> diff --git a/test/api_test/odp_atomic_test.h
> b/test/api_test/odp_atomic_test.h
> deleted file mode 100644
> index 89e7748..0000000
> --- a/test/api_test/odp_atomic_test.h
> +++ /dev/null
> @@ -1,51 +0,0 @@
> -/* Copyright (c) 2013, Linaro Limited
> - * All rights reserved.
> - *
> - * SPDX-License-Identifier:     BSD-3-Clause
> - */
> -
> -#ifndef ODP_ATOMIC_TEST_H_
> -#define ODP_ATOMIC_TEST_H_
> -
> -#include <odp.h>
> -#include <odp/helper/linux.h>
> -
> -/**
> - * add_sub_cnt could be any valid value
> - * so to excercise explicit atomic_add/sub
> - * ops. For now using 5..
> - */
> -#define ADD_SUB_CNT    5
> -
> -#define        CNT 500000
> -#define        U32_INIT_VAL    (1UL << 10)
> -#define        U64_INIT_VAL    (1ULL << 33)
> -
> -typedef enum {
> -       TEST_MIX = 1, /* Must be first test case num */
> -       TEST_INC_DEC_U32,
> -       TEST_ADD_SUB_U32,
> -       TEST_INC_DEC_64,
> -       TEST_ADD_SUB_64,
> -       TEST_MAX,
> -} odp_test_atomic_t;
> -
> -
> -void test_atomic_inc_dec_u32(void);
> -void test_atomic_add_sub_u32(void);
> -void test_atomic_inc_dec_64(void);
> -void test_atomic_add_sub_64(void);
> -void test_atomic_inc_u32(void);
> -void test_atomic_dec_u32(void);
> -void test_atomic_add_u32(void);
> -void test_atomic_sub_u32(void);
> -void test_atomic_inc_64(void);
> -void test_atomic_dec_64(void);
> -void test_atomic_add_64(void);
> -void test_atomic_sub_64(void);
> -void test_atomic_init(void);
> -void test_atomic_basic(void);
> -void test_atomic_store(void);
> -int test_atomic_validate(void);
> -
> -#endif /* ODP_ATOMIC_TEST_H_ */
> diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
> index 5158d87..18b365e 100644
> --- a/test/api_test/odp_common.c
> +++ b/test/api_test/odp_common.c
> @@ -14,10 +14,10 @@
>  #include <odp.h>
>  #include <odp/helper/linux.h>
>  #include <odp_common.h>
> -#include <odp_atomic_test.h>
>  #include <odp_shm_test.h>
>  #include <test_debug.h>
>
> +#define MAX_WORKERS           32            /**< Max worker threads */
>
>  /* Globals */
>  static odph_linux_pthread_t thread_tbl[MAX_WORKERS]; /**< worker threads
> table*/
> diff --git a/test/performance/.gitignore b/test/performance/.gitignore
> index 9ccb102..1bdb90d 100644
> --- a/test/performance/.gitignore
> +++ b/test/performance/.gitignore
> @@ -1,3 +1,4 @@
>  *.log
>  *.trs
>  odp_scheduling
> +odp_atomic
> diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am
> index 3be3721..63e4e23 100644
> --- a/test/performance/Makefile.am
> +++ b/test/performance/Makefile.am
> @@ -1,6 +1,6 @@
>  include $(top_srcdir)/test/Makefile.inc
>
> -EXECUTABLES =
> +EXECUTABLES = odp_atomic
>
>  COMPILE_ONLY = odp_scheduling
>
> @@ -15,7 +15,11 @@ bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY)
>  odp_scheduling_LDFLAGS = $(AM_LDFLAGS) -static
>  odp_scheduling_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
>
> +odp_atomic_LDFLAGS = $(AM_LDFLAGS) -static
> +odp_atomic_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
> +
>  noinst_HEADERS = \
>                   $(top_srcdir)/test/test_debug.h
>
>  dist_odp_scheduling_SOURCES = odp_scheduling.c
> +dist_odp_atomic_SOURCES = odp_atomic.c
> diff --git a/test/api_test/odp_atomic_test.c
> b/test/performance/odp_atomic.c
> similarity index 63%
> rename from test/api_test/odp_atomic_test.c
> rename to test/performance/odp_atomic.c
> index 6ccdc35..241295c 100644
> --- a/test/api_test/odp_atomic_test.c
> +++ b/test/performance/odp_atomic.c
> @@ -6,14 +6,68 @@
>
>  #include <string.h>
>  #include <sys/time.h>
> -#include <odp_common.h>
> -#include <odp_atomic_test.h>
>  #include <test_debug.h>
>
> +#include <odp.h>
> +#include <odp/helper/linux.h>
> +
> +static void test_atomic_inc_dec_u32(void);
> +static void test_atomic_add_sub_u32(void);
> +static void test_atomic_inc_dec_64(void);
> +static void test_atomic_add_sub_64(void);
> +static void test_atomic_inc_u32(void);
> +static void test_atomic_dec_u32(void);
> +static void test_atomic_add_u32(void);
> +static void test_atomic_sub_u32(void);
> +static void test_atomic_inc_64(void);
> +static void test_atomic_dec_64(void);
> +static void test_atomic_add_64(void);
> +static void test_atomic_sub_64(void);
> +static void test_atomic_init(void);
> +static void test_atomic_basic(void);
> +static void test_atomic_store(void);
> +static int test_atomic_validate(void);
> +static int odp_test_global_init(void);
> +static void odp_print_system_info(void);
> +
> +/**
> + * Thread argument
> + */
> +typedef struct {
> +       int testcase; /**< specifies which set of API's to exercise */
> +       int numthrds; /**< no of pthreads to create */
> +} pthrd_arg;
> +
> +static int odp_test_thread_create(void *(*start_routine) (void *),
> pthrd_arg *);
> +static int odp_test_thread_exit(pthrd_arg *);
> +
> +#define MAX_WORKERS           32            /**< Max worker threads */
> +/**
> + * add_sub_cnt could be any valid value
> + * so to excercise explicit atomic_add/sub
> + * ops. For now using 5..
> + */
> +#define ADD_SUB_CNT    5
> +#define        CNT 500000
> +#define        U32_INIT_VAL    (1UL << 10)
> +#define        U64_INIT_VAL    (1ULL << 33)
> +
> +typedef enum {
> +       TEST_MIX = 1, /* Must be first test case num */
> +       TEST_INC_DEC_U32,
> +       TEST_ADD_SUB_U32,
> +       TEST_INC_DEC_64,
> +       TEST_ADD_SUB_64,
> +       TEST_MAX,
> +} odp_test_atomic_t;
> +
>  static odp_atomic_u32_t a32u;
>  static odp_atomic_u64_t a64u;
> -
>  static odp_barrier_t barrier;
> +static odph_linux_pthread_t thread_tbl[MAX_WORKERS]; /**< worker threads
> table*/
> +static int num_workers; /**< number of workers >----*/
> +
> +
>
>  static const char * const test_name[] = {
>         "dummy",
> @@ -224,17 +278,87 @@ static void *run_thread(void *arg)
>         return parg;
>  }
>
> +/** create test thread */
> +int odp_test_thread_create(void *func_ptr(void *), pthrd_arg *arg)
> +{
> +       odp_cpumask_t cpumask;
> +
> +       /* Create and init additional threads */
> +       odph_linux_cpumask_default(&cpumask, arg->numthrds);
> +       odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr,
> +                                 (void *)arg);
> +
> +       return 0;
> +}
> +
> +/** exit from test thread */
> +int odp_test_thread_exit(pthrd_arg *arg)
> +{
> +       /* Wait for other threads to exit */
> +       odph_linux_pthread_join(thread_tbl, arg->numthrds);
> +
> +       return 0;
> +}
> +
> +/** test init globals and call odp_init_global() */
> +int odp_test_global_init(void)
> +{
> +       memset(thread_tbl, 0, sizeof(thread_tbl));
> +
> +       if (odp_init_global(NULL, NULL)) {
> +               LOG_ERR("ODP global init failed.\n");
> +               return -1;
> +       }
> +
> +       num_workers = odp_cpu_count();
> +       /* force to max CPU count */
> +       if (num_workers > MAX_WORKERS)
> +               num_workers = MAX_WORKERS;
> +
> +       return 0;
> +}
> +
> +/**
> + * Print system information
> + */
> +void odp_print_system_info(void)
> +{
> +       odp_cpumask_t cpumask;
> +       char str[ODP_CPUMASK_STR_SIZE];
> +
> +       memset(str, 1, sizeof(str));
> +
> +       odp_cpumask_zero(&cpumask);
> +
> +       odp_cpumask_from_str(&cpumask, "0x1");
> +       (void)odp_cpumask_to_str(&cpumask, str, sizeof(str));
> +
> +       printf("\n");
> +       printf("ODP system info\n");
> +       printf("---------------\n");
> +       printf("ODP API version: %s\n",        odp_version_api_str());
> +       printf("CPU model:       %s\n",        odp_sys_cpu_model_str());
> +       printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
> +       printf("Cache line size: %i\n",        odp_sys_cache_line_size());
> +       printf("CPU count:       %i\n",        odp_cpu_count());
> +       printf("CPU mask:        %s\n",        str);
> +
> +       printf("\n");
> +}
> +
> +
>  int main(int argc, char *argv[])
>  {
>         pthrd_arg thrdarg;
> -       int test_type = 0, pthrdnum = 0, i = 0, cnt = argc - 1;
> +       int test_type = 1, pthrdnum = 0, i = 0, cnt = argc - 1;
>         char c;
>         int result;
>
> -       if (argc == 1 || argc % 2 == 0) {
> +       if (argc == 0 || argc % 2 == 0) {
>                 usage();
>                 goto err_exit;
>         }
> +
>         if (odp_test_global_init() != 0)
>                 goto err_exit;
>         odp_print_system_info();
> @@ -297,3 +421,5 @@ int main(int argc, char *argv[])
>  err_exit:
>         return -1;
>  }
> +
> +
> --
> 2.1.0
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Mike Holmes March 18, 2015, 11:48 a.m. UTC | #2
All the changes are only to enable the move to work, I am open suggestions,
I will catch you on a HO and to gather your ideas

On 17 March 2015 at 18:07, Bill Fischofer <bill.fischofer@linaro.org> wrote:

> These changes do not seem to be a simple move as logic is being changed.
> A better commit message needed to say what's really happening perhaps?
>
> On Tue, Mar 17, 2015 at 3:59 PM, Mike Holmes <mike.holmes@linaro.org>
> wrote:
>
>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
>> ---
>>  test/api_test/.gitignore                           |   1 -
>>  test/api_test/Makefile.am                          |   6 +-
>>  test/api_test/odp_atomic_test.h                    |  51 --------
>>  test/api_test/odp_common.c                         |   2 +-
>>  test/performance/.gitignore                        |   1 +
>>  test/performance/Makefile.am                       |   6 +-
>>  .../odp_atomic_test.c => performance/odp_atomic.c} | 136
>> ++++++++++++++++++++-
>>  7 files changed, 139 insertions(+), 64 deletions(-)
>>  delete mode 100644 test/api_test/odp_atomic_test.h
>>  rename test/{api_test/odp_atomic_test.c => performance/odp_atomic.c}
>> (63%)
>>
>> diff --git a/test/api_test/.gitignore b/test/api_test/.gitignore
>> index 84159e1..950f443 100644
>> --- a/test/api_test/.gitignore
>> +++ b/test/api_test/.gitignore
>> @@ -1,3 +1,2 @@
>> -odp_atomic
>>  odp_ring
>>  odp_shm
>> diff --git a/test/api_test/Makefile.am b/test/api_test/Makefile.am
>> index 86e1bc2..f231fee 100644
>> --- a/test/api_test/Makefile.am
>> +++ b/test/api_test/Makefile.am
>> @@ -1,21 +1,17 @@
>>  include $(top_srcdir)/test/Makefile.inc
>>
>> -bin_PROGRAMS = odp_atomic odp_shm odp_ring
>> +bin_PROGRAMS = odp_shm odp_ring
>>
>> -odp_atomic_CFLAGS = $(AM_CFLAGS)
>>  odp_shm_CFLAGS = $(AM_CFLAGS)
>>  odp_ring_CFLAGS = $(AM_CFLAGS)
>>
>> -odp_atomic_LDFLAGS = $(AM_LDFLAGS) -static
>>  odp_shm_LDFLAGS = $(AM_LDFLAGS) -static
>>  odp_ring_LDFLAGS = $(AM_LDFLAGS) -static
>>
>>  noinst_HEADERS = \
>> -                 $(top_srcdir)/test/api_test/odp_atomic_test.h \
>>                   $(top_srcdir)/test/api_test/odp_common.h \
>>                   $(top_srcdir)/test/api_test/odp_shm_test.h \
>>                   $(top_srcdir)/test/test_debug.h
>>
>> -dist_odp_atomic_SOURCES = odp_atomic_test.c odp_common.c
>>  dist_odp_shm_SOURCES = odp_shm_test.c odp_common.c
>>  dist_odp_ring_SOURCES = odp_ring_test.c odp_common.c
>> diff --git a/test/api_test/odp_atomic_test.h
>> b/test/api_test/odp_atomic_test.h
>> deleted file mode 100644
>> index 89e7748..0000000
>> --- a/test/api_test/odp_atomic_test.h
>> +++ /dev/null
>> @@ -1,51 +0,0 @@
>> -/* Copyright (c) 2013, Linaro Limited
>> - * All rights reserved.
>> - *
>> - * SPDX-License-Identifier:     BSD-3-Clause
>> - */
>> -
>> -#ifndef ODP_ATOMIC_TEST_H_
>> -#define ODP_ATOMIC_TEST_H_
>> -
>> -#include <odp.h>
>> -#include <odp/helper/linux.h>
>> -
>> -/**
>> - * add_sub_cnt could be any valid value
>> - * so to excercise explicit atomic_add/sub
>> - * ops. For now using 5..
>> - */
>> -#define ADD_SUB_CNT    5
>> -
>> -#define        CNT 500000
>> -#define        U32_INIT_VAL    (1UL << 10)
>> -#define        U64_INIT_VAL    (1ULL << 33)
>> -
>> -typedef enum {
>> -       TEST_MIX = 1, /* Must be first test case num */
>> -       TEST_INC_DEC_U32,
>> -       TEST_ADD_SUB_U32,
>> -       TEST_INC_DEC_64,
>> -       TEST_ADD_SUB_64,
>> -       TEST_MAX,
>> -} odp_test_atomic_t;
>> -
>> -
>> -void test_atomic_inc_dec_u32(void);
>> -void test_atomic_add_sub_u32(void);
>> -void test_atomic_inc_dec_64(void);
>> -void test_atomic_add_sub_64(void);
>> -void test_atomic_inc_u32(void);
>> -void test_atomic_dec_u32(void);
>> -void test_atomic_add_u32(void);
>> -void test_atomic_sub_u32(void);
>> -void test_atomic_inc_64(void);
>> -void test_atomic_dec_64(void);
>> -void test_atomic_add_64(void);
>> -void test_atomic_sub_64(void);
>> -void test_atomic_init(void);
>> -void test_atomic_basic(void);
>> -void test_atomic_store(void);
>> -int test_atomic_validate(void);
>> -
>> -#endif /* ODP_ATOMIC_TEST_H_ */
>> diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
>> index 5158d87..18b365e 100644
>> --- a/test/api_test/odp_common.c
>> +++ b/test/api_test/odp_common.c
>> @@ -14,10 +14,10 @@
>>  #include <odp.h>
>>  #include <odp/helper/linux.h>
>>  #include <odp_common.h>
>> -#include <odp_atomic_test.h>
>>  #include <odp_shm_test.h>
>>  #include <test_debug.h>
>>
>> +#define MAX_WORKERS           32            /**< Max worker threads */
>>
>>  /* Globals */
>>  static odph_linux_pthread_t thread_tbl[MAX_WORKERS]; /**< worker threads
>> table*/
>> diff --git a/test/performance/.gitignore b/test/performance/.gitignore
>> index 9ccb102..1bdb90d 100644
>> --- a/test/performance/.gitignore
>> +++ b/test/performance/.gitignore
>> @@ -1,3 +1,4 @@
>>  *.log
>>  *.trs
>>  odp_scheduling
>> +odp_atomic
>> diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am
>> index 3be3721..63e4e23 100644
>> --- a/test/performance/Makefile.am
>> +++ b/test/performance/Makefile.am
>> @@ -1,6 +1,6 @@
>>  include $(top_srcdir)/test/Makefile.inc
>>
>> -EXECUTABLES =
>> +EXECUTABLES = odp_atomic
>>
>>  COMPILE_ONLY = odp_scheduling
>>
>> @@ -15,7 +15,11 @@ bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY)
>>  odp_scheduling_LDFLAGS = $(AM_LDFLAGS) -static
>>  odp_scheduling_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
>>
>> +odp_atomic_LDFLAGS = $(AM_LDFLAGS) -static
>> +odp_atomic_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
>> +
>>  noinst_HEADERS = \
>>                   $(top_srcdir)/test/test_debug.h
>>
>>  dist_odp_scheduling_SOURCES = odp_scheduling.c
>> +dist_odp_atomic_SOURCES = odp_atomic.c
>> diff --git a/test/api_test/odp_atomic_test.c
>> b/test/performance/odp_atomic.c
>> similarity index 63%
>> rename from test/api_test/odp_atomic_test.c
>> rename to test/performance/odp_atomic.c
>> index 6ccdc35..241295c 100644
>> --- a/test/api_test/odp_atomic_test.c
>> +++ b/test/performance/odp_atomic.c
>> @@ -6,14 +6,68 @@
>>
>>  #include <string.h>
>>  #include <sys/time.h>
>> -#include <odp_common.h>
>> -#include <odp_atomic_test.h>
>>  #include <test_debug.h>
>>
>> +#include <odp.h>
>> +#include <odp/helper/linux.h>
>> +
>> +static void test_atomic_inc_dec_u32(void);
>> +static void test_atomic_add_sub_u32(void);
>> +static void test_atomic_inc_dec_64(void);
>> +static void test_atomic_add_sub_64(void);
>> +static void test_atomic_inc_u32(void);
>> +static void test_atomic_dec_u32(void);
>> +static void test_atomic_add_u32(void);
>> +static void test_atomic_sub_u32(void);
>> +static void test_atomic_inc_64(void);
>> +static void test_atomic_dec_64(void);
>> +static void test_atomic_add_64(void);
>> +static void test_atomic_sub_64(void);
>> +static void test_atomic_init(void);
>> +static void test_atomic_basic(void);
>> +static void test_atomic_store(void);
>> +static int test_atomic_validate(void);
>> +static int odp_test_global_init(void);
>> +static void odp_print_system_info(void);
>> +
>> +/**
>> + * Thread argument
>> + */
>> +typedef struct {
>> +       int testcase; /**< specifies which set of API's to exercise */
>> +       int numthrds; /**< no of pthreads to create */
>> +} pthrd_arg;
>> +
>> +static int odp_test_thread_create(void *(*start_routine) (void *),
>> pthrd_arg *);
>> +static int odp_test_thread_exit(pthrd_arg *);
>> +
>> +#define MAX_WORKERS           32            /**< Max worker threads */
>> +/**
>> + * add_sub_cnt could be any valid value
>> + * so to excercise explicit atomic_add/sub
>> + * ops. For now using 5..
>> + */
>> +#define ADD_SUB_CNT    5
>> +#define        CNT 500000
>> +#define        U32_INIT_VAL    (1UL << 10)
>> +#define        U64_INIT_VAL    (1ULL << 33)
>> +
>> +typedef enum {
>> +       TEST_MIX = 1, /* Must be first test case num */
>> +       TEST_INC_DEC_U32,
>> +       TEST_ADD_SUB_U32,
>> +       TEST_INC_DEC_64,
>> +       TEST_ADD_SUB_64,
>> +       TEST_MAX,
>> +} odp_test_atomic_t;
>> +
>>  static odp_atomic_u32_t a32u;
>>  static odp_atomic_u64_t a64u;
>> -
>>  static odp_barrier_t barrier;
>> +static odph_linux_pthread_t thread_tbl[MAX_WORKERS]; /**< worker threads
>> table*/
>> +static int num_workers; /**< number of workers >----*/
>> +
>> +
>>
>>  static const char * const test_name[] = {
>>         "dummy",
>> @@ -224,17 +278,87 @@ static void *run_thread(void *arg)
>>         return parg;
>>  }
>>
>> +/** create test thread */
>> +int odp_test_thread_create(void *func_ptr(void *), pthrd_arg *arg)
>> +{
>> +       odp_cpumask_t cpumask;
>> +
>> +       /* Create and init additional threads */
>> +       odph_linux_cpumask_default(&cpumask, arg->numthrds);
>> +       odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr,
>> +                                 (void *)arg);
>> +
>> +       return 0;
>> +}
>> +
>> +/** exit from test thread */
>> +int odp_test_thread_exit(pthrd_arg *arg)
>> +{
>> +       /* Wait for other threads to exit */
>> +       odph_linux_pthread_join(thread_tbl, arg->numthrds);
>> +
>> +       return 0;
>> +}
>> +
>> +/** test init globals and call odp_init_global() */
>> +int odp_test_global_init(void)
>> +{
>> +       memset(thread_tbl, 0, sizeof(thread_tbl));
>> +
>> +       if (odp_init_global(NULL, NULL)) {
>> +               LOG_ERR("ODP global init failed.\n");
>> +               return -1;
>> +       }
>> +
>> +       num_workers = odp_cpu_count();
>> +       /* force to max CPU count */
>> +       if (num_workers > MAX_WORKERS)
>> +               num_workers = MAX_WORKERS;
>> +
>> +       return 0;
>> +}
>> +
>> +/**
>> + * Print system information
>> + */
>> +void odp_print_system_info(void)
>> +{
>> +       odp_cpumask_t cpumask;
>> +       char str[ODP_CPUMASK_STR_SIZE];
>> +
>> +       memset(str, 1, sizeof(str));
>> +
>> +       odp_cpumask_zero(&cpumask);
>> +
>> +       odp_cpumask_from_str(&cpumask, "0x1");
>> +       (void)odp_cpumask_to_str(&cpumask, str, sizeof(str));
>> +
>> +       printf("\n");
>> +       printf("ODP system info\n");
>> +       printf("---------------\n");
>> +       printf("ODP API version: %s\n",        odp_version_api_str());
>> +       printf("CPU model:       %s\n",        odp_sys_cpu_model_str());
>> +       printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
>> +       printf("Cache line size: %i\n",        odp_sys_cache_line_size());
>> +       printf("CPU count:       %i\n",        odp_cpu_count());
>> +       printf("CPU mask:        %s\n",        str);
>> +
>> +       printf("\n");
>> +}
>> +
>> +
>>  int main(int argc, char *argv[])
>>  {
>>         pthrd_arg thrdarg;
>> -       int test_type = 0, pthrdnum = 0, i = 0, cnt = argc - 1;
>> +       int test_type = 1, pthrdnum = 0, i = 0, cnt = argc - 1;
>>         char c;
>>         int result;
>>
>> -       if (argc == 1 || argc % 2 == 0) {
>> +       if (argc == 0 || argc % 2 == 0) {
>>                 usage();
>>                 goto err_exit;
>>         }
>> +
>>         if (odp_test_global_init() != 0)
>>                 goto err_exit;
>>         odp_print_system_info();
>> @@ -297,3 +421,5 @@ int main(int argc, char *argv[])
>>  err_exit:
>>         return -1;
>>  }
>> +
>> +
>> --
>> 2.1.0
>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>
>
>
Mike Holmes March 18, 2015, 3:51 p.m. UTC | #3
I will send V2

On 18 March 2015 at 07:48, Mike Holmes <mike.holmes@linaro.org> wrote:

> All the changes are only to enable the move to work, I am open
> suggestions, I will catch you on a HO and to gather your ideas
>
> On 17 March 2015 at 18:07, Bill Fischofer <bill.fischofer@linaro.org>
> wrote:
>
>> These changes do not seem to be a simple move as logic is being changed.
>> A better commit message needed to say what's really happening perhaps?
>>
>> On Tue, Mar 17, 2015 at 3:59 PM, Mike Holmes <mike.holmes@linaro.org>
>> wrote:
>>
>>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
>>> ---
>>>  test/api_test/.gitignore                           |   1 -
>>>  test/api_test/Makefile.am                          |   6 +-
>>>  test/api_test/odp_atomic_test.h                    |  51 --------
>>>  test/api_test/odp_common.c                         |   2 +-
>>>  test/performance/.gitignore                        |   1 +
>>>  test/performance/Makefile.am                       |   6 +-
>>>  .../odp_atomic_test.c => performance/odp_atomic.c} | 136
>>> ++++++++++++++++++++-
>>>  7 files changed, 139 insertions(+), 64 deletions(-)
>>>  delete mode 100644 test/api_test/odp_atomic_test.h
>>>  rename test/{api_test/odp_atomic_test.c => performance/odp_atomic.c}
>>> (63%)
>>>
>>> diff --git a/test/api_test/.gitignore b/test/api_test/.gitignore
>>> index 84159e1..950f443 100644
>>> --- a/test/api_test/.gitignore
>>> +++ b/test/api_test/.gitignore
>>> @@ -1,3 +1,2 @@
>>> -odp_atomic
>>>  odp_ring
>>>  odp_shm
>>> diff --git a/test/api_test/Makefile.am b/test/api_test/Makefile.am
>>> index 86e1bc2..f231fee 100644
>>> --- a/test/api_test/Makefile.am
>>> +++ b/test/api_test/Makefile.am
>>> @@ -1,21 +1,17 @@
>>>  include $(top_srcdir)/test/Makefile.inc
>>>
>>> -bin_PROGRAMS = odp_atomic odp_shm odp_ring
>>> +bin_PROGRAMS = odp_shm odp_ring
>>>
>>> -odp_atomic_CFLAGS = $(AM_CFLAGS)
>>>  odp_shm_CFLAGS = $(AM_CFLAGS)
>>>  odp_ring_CFLAGS = $(AM_CFLAGS)
>>>
>>> -odp_atomic_LDFLAGS = $(AM_LDFLAGS) -static
>>>  odp_shm_LDFLAGS = $(AM_LDFLAGS) -static
>>>  odp_ring_LDFLAGS = $(AM_LDFLAGS) -static
>>>
>>>  noinst_HEADERS = \
>>> -                 $(top_srcdir)/test/api_test/odp_atomic_test.h \
>>>                   $(top_srcdir)/test/api_test/odp_common.h \
>>>                   $(top_srcdir)/test/api_test/odp_shm_test.h \
>>>                   $(top_srcdir)/test/test_debug.h
>>>
>>> -dist_odp_atomic_SOURCES = odp_atomic_test.c odp_common.c
>>>  dist_odp_shm_SOURCES = odp_shm_test.c odp_common.c
>>>  dist_odp_ring_SOURCES = odp_ring_test.c odp_common.c
>>> diff --git a/test/api_test/odp_atomic_test.h
>>> b/test/api_test/odp_atomic_test.h
>>> deleted file mode 100644
>>> index 89e7748..0000000
>>> --- a/test/api_test/odp_atomic_test.h
>>> +++ /dev/null
>>> @@ -1,51 +0,0 @@
>>> -/* Copyright (c) 2013, Linaro Limited
>>> - * All rights reserved.
>>> - *
>>> - * SPDX-License-Identifier:     BSD-3-Clause
>>> - */
>>> -
>>> -#ifndef ODP_ATOMIC_TEST_H_
>>> -#define ODP_ATOMIC_TEST_H_
>>> -
>>> -#include <odp.h>
>>> -#include <odp/helper/linux.h>
>>> -
>>> -/**
>>> - * add_sub_cnt could be any valid value
>>> - * so to excercise explicit atomic_add/sub
>>> - * ops. For now using 5..
>>> - */
>>> -#define ADD_SUB_CNT    5
>>> -
>>> -#define        CNT 500000
>>> -#define        U32_INIT_VAL    (1UL << 10)
>>> -#define        U64_INIT_VAL    (1ULL << 33)
>>> -
>>> -typedef enum {
>>> -       TEST_MIX = 1, /* Must be first test case num */
>>> -       TEST_INC_DEC_U32,
>>> -       TEST_ADD_SUB_U32,
>>> -       TEST_INC_DEC_64,
>>> -       TEST_ADD_SUB_64,
>>> -       TEST_MAX,
>>> -} odp_test_atomic_t;
>>> -
>>> -
>>> -void test_atomic_inc_dec_u32(void);
>>> -void test_atomic_add_sub_u32(void);
>>> -void test_atomic_inc_dec_64(void);
>>> -void test_atomic_add_sub_64(void);
>>> -void test_atomic_inc_u32(void);
>>> -void test_atomic_dec_u32(void);
>>> -void test_atomic_add_u32(void);
>>> -void test_atomic_sub_u32(void);
>>> -void test_atomic_inc_64(void);
>>> -void test_atomic_dec_64(void);
>>> -void test_atomic_add_64(void);
>>> -void test_atomic_sub_64(void);
>>> -void test_atomic_init(void);
>>> -void test_atomic_basic(void);
>>> -void test_atomic_store(void);
>>> -int test_atomic_validate(void);
>>> -
>>> -#endif /* ODP_ATOMIC_TEST_H_ */
>>> diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
>>> index 5158d87..18b365e 100644
>>> --- a/test/api_test/odp_common.c
>>> +++ b/test/api_test/odp_common.c
>>> @@ -14,10 +14,10 @@
>>>  #include <odp.h>
>>>  #include <odp/helper/linux.h>
>>>  #include <odp_common.h>
>>> -#include <odp_atomic_test.h>
>>>  #include <odp_shm_test.h>
>>>  #include <test_debug.h>
>>>
>>> +#define MAX_WORKERS           32            /**< Max worker threads */
>>>
>>>  /* Globals */
>>>  static odph_linux_pthread_t thread_tbl[MAX_WORKERS]; /**< worker
>>> threads table*/
>>> diff --git a/test/performance/.gitignore b/test/performance/.gitignore
>>> index 9ccb102..1bdb90d 100644
>>> --- a/test/performance/.gitignore
>>> +++ b/test/performance/.gitignore
>>> @@ -1,3 +1,4 @@
>>>  *.log
>>>  *.trs
>>>  odp_scheduling
>>> +odp_atomic
>>> diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am
>>> index 3be3721..63e4e23 100644
>>> --- a/test/performance/Makefile.am
>>> +++ b/test/performance/Makefile.am
>>> @@ -1,6 +1,6 @@
>>>  include $(top_srcdir)/test/Makefile.inc
>>>
>>> -EXECUTABLES =
>>> +EXECUTABLES = odp_atomic
>>>
>>>  COMPILE_ONLY = odp_scheduling
>>>
>>> @@ -15,7 +15,11 @@ bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY)
>>>  odp_scheduling_LDFLAGS = $(AM_LDFLAGS) -static
>>>  odp_scheduling_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
>>>
>>> +odp_atomic_LDFLAGS = $(AM_LDFLAGS) -static
>>> +odp_atomic_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
>>> +
>>>  noinst_HEADERS = \
>>>                   $(top_srcdir)/test/test_debug.h
>>>
>>>  dist_odp_scheduling_SOURCES = odp_scheduling.c
>>> +dist_odp_atomic_SOURCES = odp_atomic.c
>>> diff --git a/test/api_test/odp_atomic_test.c
>>> b/test/performance/odp_atomic.c
>>> similarity index 63%
>>> rename from test/api_test/odp_atomic_test.c
>>> rename to test/performance/odp_atomic.c
>>> index 6ccdc35..241295c 100644
>>> --- a/test/api_test/odp_atomic_test.c
>>> +++ b/test/performance/odp_atomic.c
>>> @@ -6,14 +6,68 @@
>>>
>>>  #include <string.h>
>>>  #include <sys/time.h>
>>> -#include <odp_common.h>
>>> -#include <odp_atomic_test.h>
>>>  #include <test_debug.h>
>>>
>>> +#include <odp.h>
>>> +#include <odp/helper/linux.h>
>>> +
>>> +static void test_atomic_inc_dec_u32(void);
>>> +static void test_atomic_add_sub_u32(void);
>>> +static void test_atomic_inc_dec_64(void);
>>> +static void test_atomic_add_sub_64(void);
>>> +static void test_atomic_inc_u32(void);
>>> +static void test_atomic_dec_u32(void);
>>> +static void test_atomic_add_u32(void);
>>> +static void test_atomic_sub_u32(void);
>>> +static void test_atomic_inc_64(void);
>>> +static void test_atomic_dec_64(void);
>>> +static void test_atomic_add_64(void);
>>> +static void test_atomic_sub_64(void);
>>> +static void test_atomic_init(void);
>>> +static void test_atomic_basic(void);
>>> +static void test_atomic_store(void);
>>> +static int test_atomic_validate(void);
>>> +static int odp_test_global_init(void);
>>> +static void odp_print_system_info(void);
>>> +
>>> +/**
>>> + * Thread argument
>>> + */
>>> +typedef struct {
>>> +       int testcase; /**< specifies which set of API's to exercise */
>>> +       int numthrds; /**< no of pthreads to create */
>>> +} pthrd_arg;
>>> +
>>> +static int odp_test_thread_create(void *(*start_routine) (void *),
>>> pthrd_arg *);
>>> +static int odp_test_thread_exit(pthrd_arg *);
>>> +
>>> +#define MAX_WORKERS           32            /**< Max worker threads */
>>> +/**
>>> + * add_sub_cnt could be any valid value
>>> + * so to excercise explicit atomic_add/sub
>>> + * ops. For now using 5..
>>> + */
>>> +#define ADD_SUB_CNT    5
>>> +#define        CNT 500000
>>> +#define        U32_INIT_VAL    (1UL << 10)
>>> +#define        U64_INIT_VAL    (1ULL << 33)
>>> +
>>> +typedef enum {
>>> +       TEST_MIX = 1, /* Must be first test case num */
>>> +       TEST_INC_DEC_U32,
>>> +       TEST_ADD_SUB_U32,
>>> +       TEST_INC_DEC_64,
>>> +       TEST_ADD_SUB_64,
>>> +       TEST_MAX,
>>> +} odp_test_atomic_t;
>>> +
>>>  static odp_atomic_u32_t a32u;
>>>  static odp_atomic_u64_t a64u;
>>> -
>>>  static odp_barrier_t barrier;
>>> +static odph_linux_pthread_t thread_tbl[MAX_WORKERS]; /**< worker
>>> threads table*/
>>> +static int num_workers; /**< number of workers >----*/
>>> +
>>> +
>>>
>>>  static const char * const test_name[] = {
>>>         "dummy",
>>> @@ -224,17 +278,87 @@ static void *run_thread(void *arg)
>>>         return parg;
>>>  }
>>>
>>> +/** create test thread */
>>> +int odp_test_thread_create(void *func_ptr(void *), pthrd_arg *arg)
>>> +{
>>> +       odp_cpumask_t cpumask;
>>> +
>>> +       /* Create and init additional threads */
>>> +       odph_linux_cpumask_default(&cpumask, arg->numthrds);
>>> +       odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr,
>>> +                                 (void *)arg);
>>> +
>>> +       return 0;
>>> +}
>>> +
>>> +/** exit from test thread */
>>> +int odp_test_thread_exit(pthrd_arg *arg)
>>> +{
>>> +       /* Wait for other threads to exit */
>>> +       odph_linux_pthread_join(thread_tbl, arg->numthrds);
>>> +
>>> +       return 0;
>>> +}
>>> +
>>> +/** test init globals and call odp_init_global() */
>>> +int odp_test_global_init(void)
>>> +{
>>> +       memset(thread_tbl, 0, sizeof(thread_tbl));
>>> +
>>> +       if (odp_init_global(NULL, NULL)) {
>>> +               LOG_ERR("ODP global init failed.\n");
>>> +               return -1;
>>> +       }
>>> +
>>> +       num_workers = odp_cpu_count();
>>> +       /* force to max CPU count */
>>> +       if (num_workers > MAX_WORKERS)
>>> +               num_workers = MAX_WORKERS;
>>> +
>>> +       return 0;
>>> +}
>>> +
>>> +/**
>>> + * Print system information
>>> + */
>>> +void odp_print_system_info(void)
>>> +{
>>> +       odp_cpumask_t cpumask;
>>> +       char str[ODP_CPUMASK_STR_SIZE];
>>> +
>>> +       memset(str, 1, sizeof(str));
>>> +
>>> +       odp_cpumask_zero(&cpumask);
>>> +
>>> +       odp_cpumask_from_str(&cpumask, "0x1");
>>> +       (void)odp_cpumask_to_str(&cpumask, str, sizeof(str));
>>> +
>>> +       printf("\n");
>>> +       printf("ODP system info\n");
>>> +       printf("---------------\n");
>>> +       printf("ODP API version: %s\n",        odp_version_api_str());
>>> +       printf("CPU model:       %s\n",        odp_sys_cpu_model_str());
>>> +       printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
>>> +       printf("Cache line size: %i\n",
>>> odp_sys_cache_line_size());
>>> +       printf("CPU count:       %i\n",        odp_cpu_count());
>>> +       printf("CPU mask:        %s\n",        str);
>>> +
>>> +       printf("\n");
>>> +}
>>> +
>>> +
>>>  int main(int argc, char *argv[])
>>>  {
>>>         pthrd_arg thrdarg;
>>> -       int test_type = 0, pthrdnum = 0, i = 0, cnt = argc - 1;
>>> +       int test_type = 1, pthrdnum = 0, i = 0, cnt = argc - 1;
>>>         char c;
>>>         int result;
>>>
>>> -       if (argc == 1 || argc % 2 == 0) {
>>> +       if (argc == 0 || argc % 2 == 0) {
>>>                 usage();
>>>                 goto err_exit;
>>>         }
>>> +
>>>         if (odp_test_global_init() != 0)
>>>                 goto err_exit;
>>>         odp_print_system_info();
>>> @@ -297,3 +421,5 @@ int main(int argc, char *argv[])
>>>  err_exit:
>>>         return -1;
>>>  }
>>> +
>>> +
>>> --
>>> 2.1.0
>>>
>>>
>>> _______________________________________________
>>> lng-odp mailing list
>>> lng-odp@lists.linaro.org
>>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>>
>>
>>
>
>
> --
> Mike Holmes
> Technical Manager - Linaro Networking Group
> Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
>
>
>
diff mbox

Patch

diff --git a/test/api_test/.gitignore b/test/api_test/.gitignore
index 84159e1..950f443 100644
--- a/test/api_test/.gitignore
+++ b/test/api_test/.gitignore
@@ -1,3 +1,2 @@ 
-odp_atomic
 odp_ring
 odp_shm
diff --git a/test/api_test/Makefile.am b/test/api_test/Makefile.am
index 86e1bc2..f231fee 100644
--- a/test/api_test/Makefile.am
+++ b/test/api_test/Makefile.am
@@ -1,21 +1,17 @@ 
 include $(top_srcdir)/test/Makefile.inc
 
-bin_PROGRAMS = odp_atomic odp_shm odp_ring
+bin_PROGRAMS = odp_shm odp_ring
 
-odp_atomic_CFLAGS = $(AM_CFLAGS)
 odp_shm_CFLAGS = $(AM_CFLAGS)
 odp_ring_CFLAGS = $(AM_CFLAGS)
 
-odp_atomic_LDFLAGS = $(AM_LDFLAGS) -static
 odp_shm_LDFLAGS = $(AM_LDFLAGS) -static
 odp_ring_LDFLAGS = $(AM_LDFLAGS) -static
 
 noinst_HEADERS = \
-		  $(top_srcdir)/test/api_test/odp_atomic_test.h \
 		  $(top_srcdir)/test/api_test/odp_common.h \
 		  $(top_srcdir)/test/api_test/odp_shm_test.h \
 		  $(top_srcdir)/test/test_debug.h
 
-dist_odp_atomic_SOURCES = odp_atomic_test.c odp_common.c
 dist_odp_shm_SOURCES = odp_shm_test.c odp_common.c
 dist_odp_ring_SOURCES = odp_ring_test.c odp_common.c
diff --git a/test/api_test/odp_atomic_test.h b/test/api_test/odp_atomic_test.h
deleted file mode 100644
index 89e7748..0000000
--- a/test/api_test/odp_atomic_test.h
+++ /dev/null
@@ -1,51 +0,0 @@ 
-/* Copyright (c) 2013, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier:     BSD-3-Clause
- */
-
-#ifndef ODP_ATOMIC_TEST_H_
-#define ODP_ATOMIC_TEST_H_
-
-#include <odp.h>
-#include <odp/helper/linux.h>
-
-/**
- * add_sub_cnt could be any valid value
- * so to excercise explicit atomic_add/sub
- * ops. For now using 5..
- */
-#define ADD_SUB_CNT	5
-
-#define	CNT 500000
-#define	U32_INIT_VAL	(1UL << 10)
-#define	U64_INIT_VAL	(1ULL << 33)
-
-typedef enum {
-	TEST_MIX = 1, /* Must be first test case num */
-	TEST_INC_DEC_U32,
-	TEST_ADD_SUB_U32,
-	TEST_INC_DEC_64,
-	TEST_ADD_SUB_64,
-	TEST_MAX,
-} odp_test_atomic_t;
-
-
-void test_atomic_inc_dec_u32(void);
-void test_atomic_add_sub_u32(void);
-void test_atomic_inc_dec_64(void);
-void test_atomic_add_sub_64(void);
-void test_atomic_inc_u32(void);
-void test_atomic_dec_u32(void);
-void test_atomic_add_u32(void);
-void test_atomic_sub_u32(void);
-void test_atomic_inc_64(void);
-void test_atomic_dec_64(void);
-void test_atomic_add_64(void);
-void test_atomic_sub_64(void);
-void test_atomic_init(void);
-void test_atomic_basic(void);
-void test_atomic_store(void);
-int test_atomic_validate(void);
-
-#endif /* ODP_ATOMIC_TEST_H_ */
diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
index 5158d87..18b365e 100644
--- a/test/api_test/odp_common.c
+++ b/test/api_test/odp_common.c
@@ -14,10 +14,10 @@ 
 #include <odp.h>
 #include <odp/helper/linux.h>
 #include <odp_common.h>
-#include <odp_atomic_test.h>
 #include <odp_shm_test.h>
 #include <test_debug.h>
 
+#define MAX_WORKERS           32            /**< Max worker threads */
 
 /* Globals */
 static odph_linux_pthread_t thread_tbl[MAX_WORKERS]; /**< worker threads table*/
diff --git a/test/performance/.gitignore b/test/performance/.gitignore
index 9ccb102..1bdb90d 100644
--- a/test/performance/.gitignore
+++ b/test/performance/.gitignore
@@ -1,3 +1,4 @@ 
 *.log
 *.trs
 odp_scheduling
+odp_atomic
diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am
index 3be3721..63e4e23 100644
--- a/test/performance/Makefile.am
+++ b/test/performance/Makefile.am
@@ -1,6 +1,6 @@ 
 include $(top_srcdir)/test/Makefile.inc
 
-EXECUTABLES =
+EXECUTABLES = odp_atomic
 
 COMPILE_ONLY = odp_scheduling
 
@@ -15,7 +15,11 @@  bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY)
 odp_scheduling_LDFLAGS = $(AM_LDFLAGS) -static
 odp_scheduling_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
 
+odp_atomic_LDFLAGS = $(AM_LDFLAGS) -static
+odp_atomic_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
+
 noinst_HEADERS = \
 		  $(top_srcdir)/test/test_debug.h
 
 dist_odp_scheduling_SOURCES = odp_scheduling.c
+dist_odp_atomic_SOURCES = odp_atomic.c
diff --git a/test/api_test/odp_atomic_test.c b/test/performance/odp_atomic.c
similarity index 63%
rename from test/api_test/odp_atomic_test.c
rename to test/performance/odp_atomic.c
index 6ccdc35..241295c 100644
--- a/test/api_test/odp_atomic_test.c
+++ b/test/performance/odp_atomic.c
@@ -6,14 +6,68 @@ 
 
 #include <string.h>
 #include <sys/time.h>
-#include <odp_common.h>
-#include <odp_atomic_test.h>
 #include <test_debug.h>
 
+#include <odp.h>
+#include <odp/helper/linux.h>
+
+static void test_atomic_inc_dec_u32(void);
+static void test_atomic_add_sub_u32(void);
+static void test_atomic_inc_dec_64(void);
+static void test_atomic_add_sub_64(void);
+static void test_atomic_inc_u32(void);
+static void test_atomic_dec_u32(void);
+static void test_atomic_add_u32(void);
+static void test_atomic_sub_u32(void);
+static void test_atomic_inc_64(void);
+static void test_atomic_dec_64(void);
+static void test_atomic_add_64(void);
+static void test_atomic_sub_64(void);
+static void test_atomic_init(void);
+static void test_atomic_basic(void);
+static void test_atomic_store(void);
+static int test_atomic_validate(void);
+static int odp_test_global_init(void);
+static void odp_print_system_info(void);
+
+/**
+ * Thread argument
+ */
+typedef struct {
+	int testcase; /**< specifies which set of API's to exercise */
+	int numthrds; /**< no of pthreads to create */
+} pthrd_arg;
+
+static int odp_test_thread_create(void *(*start_routine) (void *), pthrd_arg *);
+static int odp_test_thread_exit(pthrd_arg *);
+
+#define MAX_WORKERS           32            /**< Max worker threads */
+/**
+ * add_sub_cnt could be any valid value
+ * so to excercise explicit atomic_add/sub
+ * ops. For now using 5..
+ */
+#define ADD_SUB_CNT	5
+#define	CNT 500000
+#define	U32_INIT_VAL	(1UL << 10)
+#define	U64_INIT_VAL	(1ULL << 33)
+
+typedef enum {
+	TEST_MIX = 1, /* Must be first test case num */
+	TEST_INC_DEC_U32,
+	TEST_ADD_SUB_U32,
+	TEST_INC_DEC_64,
+	TEST_ADD_SUB_64,
+	TEST_MAX,
+} odp_test_atomic_t;
+
 static odp_atomic_u32_t a32u;
 static odp_atomic_u64_t a64u;
-
 static odp_barrier_t barrier;
+static odph_linux_pthread_t thread_tbl[MAX_WORKERS]; /**< worker threads table*/
+static int num_workers; /**< number of workers >----*/
+
+
 
 static const char * const test_name[] = {
 	"dummy",
@@ -224,17 +278,87 @@  static void *run_thread(void *arg)
 	return parg;
 }
 
+/** create test thread */
+int odp_test_thread_create(void *func_ptr(void *), pthrd_arg *arg)
+{
+	odp_cpumask_t cpumask;
+
+	/* Create and init additional threads */
+	odph_linux_cpumask_default(&cpumask, arg->numthrds);
+	odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr,
+				  (void *)arg);
+
+	return 0;
+}
+
+/** exit from test thread */
+int odp_test_thread_exit(pthrd_arg *arg)
+{
+	/* Wait for other threads to exit */
+	odph_linux_pthread_join(thread_tbl, arg->numthrds);
+
+	return 0;
+}
+
+/** test init globals and call odp_init_global() */
+int odp_test_global_init(void)
+{
+	memset(thread_tbl, 0, sizeof(thread_tbl));
+
+	if (odp_init_global(NULL, NULL)) {
+		LOG_ERR("ODP global init failed.\n");
+		return -1;
+	}
+
+	num_workers = odp_cpu_count();
+	/* force to max CPU count */
+	if (num_workers > MAX_WORKERS)
+		num_workers = MAX_WORKERS;
+
+	return 0;
+}
+
+/**
+ * Print system information
+ */
+void odp_print_system_info(void)
+{
+	odp_cpumask_t cpumask;
+	char str[ODP_CPUMASK_STR_SIZE];
+
+	memset(str, 1, sizeof(str));
+
+	odp_cpumask_zero(&cpumask);
+
+	odp_cpumask_from_str(&cpumask, "0x1");
+	(void)odp_cpumask_to_str(&cpumask, str, sizeof(str));
+
+	printf("\n");
+	printf("ODP system info\n");
+	printf("---------------\n");
+	printf("ODP API version: %s\n",        odp_version_api_str());
+	printf("CPU model:       %s\n",        odp_sys_cpu_model_str());
+	printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
+	printf("Cache line size: %i\n",        odp_sys_cache_line_size());
+	printf("CPU count:       %i\n",        odp_cpu_count());
+	printf("CPU mask:        %s\n",        str);
+
+	printf("\n");
+}
+
+
 int main(int argc, char *argv[])
 {
 	pthrd_arg thrdarg;
-	int test_type = 0, pthrdnum = 0, i = 0, cnt = argc - 1;
+	int test_type = 1, pthrdnum = 0, i = 0, cnt = argc - 1;
 	char c;
 	int result;
 
-	if (argc == 1 || argc % 2 == 0) {
+	if (argc == 0 || argc % 2 == 0) {
 		usage();
 		goto err_exit;
 	}
+
 	if (odp_test_global_init() != 0)
 		goto err_exit;
 	odp_print_system_info();
@@ -297,3 +421,5 @@  int main(int argc, char *argv[])
 err_exit:
 	return -1;
 }
+
+