diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-03-17 23:22:05 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-03-17 23:22:05 +0000 |
commit | 33b49f60be637f06f385d2ede26846a636621396 (patch) | |
tree | be0406aafc9fdfe726b9071b94e7486aa3d3c7c0 /nuttx/examples/ostest | |
parent | 8d6908334ae667db589d437973106e3f81a342c6 (diff) | |
download | px4-nuttx-33b49f60be637f06f385d2ede26846a636621396.tar.gz px4-nuttx-33b49f60be637f06f385d2ede26846a636621396.tar.bz2 px4-nuttx-33b49f60be637f06f385d2ede26846a636621396.zip |
Verified roundrobin test
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@87 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples/ostest')
-rw-r--r-- | nuttx/examples/ostest/main.c | 2 | ||||
-rw-r--r-- | nuttx/examples/ostest/roundrobin.c | 24 |
2 files changed, 22 insertions, 4 deletions
diff --git a/nuttx/examples/ostest/main.c b/nuttx/examples/ostest/main.c index 7afba05c9..8b7096972 100644 --- a/nuttx/examples/ostest/main.c +++ b/nuttx/examples/ostest/main.c @@ -164,13 +164,11 @@ static int user_main(int argc, char *argv[]) sighand_test(); #endif -#if 0 /* Does not work yet */ #if !defined(CONFIG_DISABLE_PTHREAD) && CONFIG_RR_INTERVAL > 0 /* Verify round robin scheduling */ rr_test(); #endif -#endif printf("user_main: Exitting\n"); return 0; diff --git a/nuttx/examples/ostest/roundrobin.c b/nuttx/examples/ostest/roundrobin.c index d8217e451..c8b8f0d29 100644 --- a/nuttx/examples/ostest/roundrobin.c +++ b/nuttx/examples/ostest/roundrobin.c @@ -47,7 +47,11 @@ * Definitions ********************************************************************************/ -#define CONFIG_NINTEGERS 32768 +/* This number may need to be tuned for different processor speeds */ + +/* #define CONFIG_NINTEGERS 32768 Takes forever on 60Mhz ARM7 */ + +#define CONFIG_NINTEGERS 2048 /******************************************************************************** * Private Data @@ -121,10 +125,16 @@ static void *sieve1(void *parameter) int i; printf("sieve1 started\n"); + fflush(stdout); + for (i = 0; i < 1000; i++) { dosieve(prime1); } + + printf("sieve1 finished\n"); + fflush(stdout); + pthread_exit(NULL); } @@ -137,10 +147,16 @@ static void *sieve2(void *parameter) int i; printf("sieve2 started\n"); + fflush(stdout); + for (i = 0; i < 1000; i++) { dosieve(prime2); } + + printf("sieve2 finished\n"); + fflush(stdout); + pthread_exit(NULL); } @@ -203,7 +219,11 @@ void rr_test(void) printf("rr_test: Error in thread 2 creation, status=%d\n", status); } - printf("rr_test: Waiting for sieves to complete\n"); + printf("rr_test: Waiting for sieves to complete -- this should take awhile\n"); + printf("rr_test: If RR scheduling is working, they should complete at\n"); + printf("rr_test: then same time\n"); + fflush(stdout); + pthread_join(sieve2_thread, &result); pthread_join(sieve1_thread, &result); printf("rr_test: Done\n"); |