apps/testing/smp: Move apps/examples/smp to apps/testing/smp
This commit is contained in:
parent
ed963588bd
commit
b71f6d07ac
@ -1684,12 +1684,6 @@ examples/smart_test
|
|||||||
* CONFIG_NSH_BUILTIN_APPS=y: This test can be built only as an NSH
|
* CONFIG_NSH_BUILTIN_APPS=y: This test can be built only as an NSH
|
||||||
command
|
command
|
||||||
|
|
||||||
examples/smp
|
|
||||||
^^^^^^^^^^^^
|
|
||||||
|
|
||||||
This is a simple test for SMP functionality. It is basically just the
|
|
||||||
pthread barrier test with some custom instrumentation.
|
|
||||||
|
|
||||||
examples/smps
|
examples/smps
|
||||||
^^^^^^^^^^^^^
|
^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
#
|
#
|
||||||
|
|
||||||
config EXAMPLES_SMP
|
config TESTING_SMP
|
||||||
tristate "SMP example"
|
tristate "SMP example"
|
||||||
default n
|
default n
|
||||||
depends on SMP
|
depends on SMP
|
||||||
@ -12,9 +12,9 @@ config EXAMPLES_SMP
|
|||||||
barrier test from apps/testing/ostest and adds some instrumentation
|
barrier test from apps/testing/ostest and adds some instrumentation
|
||||||
useful for debugging SMP implementations.
|
useful for debugging SMP implementations.
|
||||||
|
|
||||||
if EXAMPLES_SMP
|
if TESTING_SMP
|
||||||
|
|
||||||
config EXAMPLES_SMP_NBARRIER_THREADS
|
config TESTING_SMP_NBARRIER_THREADS
|
||||||
int "Number of barrier threads"
|
int "Number of barrier threads"
|
||||||
default 8
|
default 8
|
||||||
---help---
|
---help---
|
||||||
@ -22,7 +22,7 @@ config EXAMPLES_SMP_NBARRIER_THREADS
|
|||||||
is 8 but a smaller number may be needed on systems without sufficient memory
|
is 8 but a smaller number may be needed on systems without sufficient memory
|
||||||
to start so many threads.
|
to start so many threads.
|
||||||
|
|
||||||
config EXAMPLES_SMP_PROGNAME
|
config TESTING_SMP_PROGNAME
|
||||||
string "Program name"
|
string "Program name"
|
||||||
default "smp"
|
default "smp"
|
||||||
depends on BUILD_LOADABLE
|
depends on BUILD_LOADABLE
|
||||||
@ -30,11 +30,11 @@ config EXAMPLES_SMP_PROGNAME
|
|||||||
This is the name of the program that will be use when the NSH ELF
|
This is the name of the program that will be use when the NSH ELF
|
||||||
program is installed.
|
program is installed.
|
||||||
|
|
||||||
config EXAMPLES_SMP_PRIORITY
|
config TESTING_SMP_PRIORITY
|
||||||
int "SMP task priority"
|
int "SMP task priority"
|
||||||
default 100
|
default 100
|
||||||
|
|
||||||
config EXAMPLES_SMP_STACKSIZE
|
config TESTING_SMP_STACKSIZE
|
||||||
int "SMP stack size"
|
int "SMP stack size"
|
||||||
default 2048
|
default 2048
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
# apps/examples/smp/Make.defs
|
# apps/testing/smp/Make.defs
|
||||||
# Adds selected applications to apps/ build
|
# Adds selected applications to apps/ build
|
||||||
#
|
#
|
||||||
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
@ -34,6 +34,6 @@
|
|||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
ifneq ($(CONFIG_EXAMPLES_SMP),)
|
ifneq ($(CONFIG_TESTING_SMP),)
|
||||||
CONFIGURED_APPS += examples/smp
|
CONFIGURED_APPS += testing/smp
|
||||||
endif
|
endif
|
@ -1,5 +1,5 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
# apps/examples/smp/Makefile
|
# apps/testing/smp/Makefile
|
||||||
#
|
#
|
||||||
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@ -37,12 +37,12 @@
|
|||||||
|
|
||||||
# SMP built-in application info
|
# SMP built-in application info
|
||||||
|
|
||||||
CONFIG_EXAMPLES_SMP_PRIORITY ?= SCHED_PRIORITY_DEFAULT
|
CONFIG_TESTING_SMP_PRIORITY ?= SCHED_PRIORITY_DEFAULT
|
||||||
CONFIG_EXAMPLES_SMP_STACKSIZE ?= 2048
|
CONFIG_TESTING_SMP_STACKSIZE ?= 2048
|
||||||
|
|
||||||
APPNAME = smp
|
APPNAME = smp
|
||||||
PRIORITY = $(CONFIG_EXAMPLES_SMP_PRIORITY)
|
PRIORITY = $(CONFIG_TESTING_SMP_PRIORITY)
|
||||||
STACKSIZE = $(CONFIG_EXAMPLES_SMP_STACKSIZE)
|
STACKSIZE = $(CONFIG_TESTING_SMP_STACKSIZE)
|
||||||
|
|
||||||
# SMP Example
|
# SMP Example
|
||||||
|
|
||||||
@ -50,9 +50,9 @@ ASRCS =
|
|||||||
CSRCS =
|
CSRCS =
|
||||||
MAINSRC = smp_main.c
|
MAINSRC = smp_main.c
|
||||||
|
|
||||||
CONFIG_EXAMPLES_SMP_PROGNAME ?= smp$(EXEEXT)
|
CONFIG_TESTING_SMP_PROGNAME ?= smp$(EXEEXT)
|
||||||
PROGNAME = $(CONFIG_EXAMPLES_SMP_PROGNAME)
|
PROGNAME = $(CONFIG_TESTING_SMP_PROGNAME)
|
||||||
|
|
||||||
MODULE = CONFIG_EXAMPLES_SMP
|
MODULE = CONFIG_TESTING_SMP
|
||||||
|
|
||||||
include $(APPDIR)/Application.mk
|
include $(APPDIR)/Application.mk
|
@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* examples/smp/smp_main.c
|
* apps/testing/smp/smp_main.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@ -58,7 +58,7 @@
|
|||||||
static pthread_barrier_t g_smp_barrier;
|
static pthread_barrier_t g_smp_barrier;
|
||||||
|
|
||||||
#if defined(CONFIG_SMP) && defined(CONFIG_BUILD_FLAT)
|
#if defined(CONFIG_SMP) && defined(CONFIG_BUILD_FLAT)
|
||||||
static volatile int g_thread_cpu[CONFIG_EXAMPLES_SMP_NBARRIER_THREADS+1];
|
static volatile int g_thread_cpu[CONFIG_TESTING_SMP_NBARRIER_THREADS+1];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -223,7 +223,7 @@ int main(int argc, FAR char *argv[])
|
|||||||
int smp_main(int argc, char *argv[])
|
int smp_main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
pthread_t threadid[CONFIG_EXAMPLES_SMP_NBARRIER_THREADS];
|
pthread_t threadid[CONFIG_TESTING_SMP_NBARRIER_THREADS];
|
||||||
pthread_addr_t result;
|
pthread_addr_t result;
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
pthread_barrierattr_t barrierattr;
|
pthread_barrierattr_t barrierattr;
|
||||||
@ -233,13 +233,13 @@ int smp_main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* Initialize data */
|
/* Initialize data */
|
||||||
|
|
||||||
memset(threadid, 0, sizeof(pthread_t) * CONFIG_EXAMPLES_SMP_NBARRIER_THREADS);
|
memset(threadid, 0, sizeof(pthread_t) * CONFIG_TESTING_SMP_NBARRIER_THREADS);
|
||||||
for (i = 0; i <= CONFIG_EXAMPLES_SMP_NBARRIER_THREADS; i++)
|
for (i = 0; i <= CONFIG_TESTING_SMP_NBARRIER_THREADS; i++)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_SMP) && defined(CONFIG_BUILD_FLAT)
|
#if defined(CONFIG_SMP) && defined(CONFIG_BUILD_FLAT)
|
||||||
g_thread_cpu[i] = IMPOSSIBLE_CPU;
|
g_thread_cpu[i] = IMPOSSIBLE_CPU;
|
||||||
#endif
|
#endif
|
||||||
if (i < CONFIG_EXAMPLES_SMP_NBARRIER_THREADS)
|
if (i < CONFIG_TESTING_SMP_NBARRIER_THREADS)
|
||||||
{
|
{
|
||||||
threadid[i] = 0;
|
threadid[i] = 0;
|
||||||
}
|
}
|
||||||
@ -258,7 +258,7 @@ int smp_main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = pthread_barrier_init(&g_smp_barrier, &barrierattr,
|
ret = pthread_barrier_init(&g_smp_barrier, &barrierattr,
|
||||||
CONFIG_EXAMPLES_SMP_NBARRIER_THREADS);
|
CONFIG_TESTING_SMP_NBARRIER_THREADS);
|
||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
printf(" Main[0]: pthread_barrierattr_init failed, ret=%d\n", ret);
|
printf(" Main[0]: pthread_barrierattr_init failed, ret=%d\n", ret);
|
||||||
@ -271,7 +271,7 @@ int smp_main(int argc, char *argv[])
|
|||||||
|
|
||||||
(void)pthread_barrierattr_init(&barrierattr);
|
(void)pthread_barrierattr_init(&barrierattr);
|
||||||
|
|
||||||
/* Start CONFIG_EXAMPLES_SMP_NBARRIER_THREADS thread instances */
|
/* Start CONFIG_TESTING_SMP_NBARRIER_THREADS thread instances */
|
||||||
|
|
||||||
ret = pthread_attr_init(&attr);
|
ret = pthread_attr_init(&attr);
|
||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
@ -282,7 +282,7 @@ int smp_main(int argc, char *argv[])
|
|||||||
goto errout_with_barrier;
|
goto errout_with_barrier;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < CONFIG_EXAMPLES_SMP_NBARRIER_THREADS; i++)
|
for (i = 0; i < CONFIG_TESTING_SMP_NBARRIER_THREADS; i++)
|
||||||
{
|
{
|
||||||
ret = pthread_create(&threadid[i], &attr, barrier_thread,
|
ret = pthread_create(&threadid[i], &attr, barrier_thread,
|
||||||
(pthread_addr_t)((uintptr_t)i+1));
|
(pthread_addr_t)((uintptr_t)i+1));
|
||||||
@ -307,7 +307,7 @@ int smp_main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* Wait for all thread instances to complete */
|
/* Wait for all thread instances to complete */
|
||||||
|
|
||||||
for (i = 0; i < CONFIG_EXAMPLES_SMP_NBARRIER_THREADS; i++)
|
for (i = 0; i < CONFIG_TESTING_SMP_NBARRIER_THREADS; i++)
|
||||||
{
|
{
|
||||||
if (threadid[i] != 0)
|
if (threadid[i] != 0)
|
||||||
{
|
{
|
Loading…
x
Reference in New Issue
Block a user