[PATCH 2/2] psxtests/psxkey08: Limit workspace size

Gedare Bloom gedare at rtems.org
Tue Mar 11 13:06:23 UTC 2014


Is there no good way to get an estimate of the available workspace
size for allocations?

On Tue, Mar 11, 2014 at 8:59 AM, Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
> This avoids large test execution times on targets with a big RAM.
> ---
>  testsuites/psxtests/psxkey08/init.c |   13 +++++++++----
>  1 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/testsuites/psxtests/psxkey08/init.c b/testsuites/psxtests/psxkey08/init.c
> index 6c4e2d0..6cfa68f 100644
> --- a/testsuites/psxtests/psxkey08/init.c
> +++ b/testsuites/psxtests/psxkey08/init.c
> @@ -56,9 +56,10 @@ rtems_task test_task(rtems_task_argument arg)
>
>  rtems_task Init(rtems_task_argument arg)
>  {
> -  rtems_status_code status;
> -  int              sc;
> -  rtems_id        *task_id_p;
> +  rtems_status_code  status;
> +  int                sc;
> +  uintptr_t          max_free_size = 13 * RTEMS_MINIMUM_STACK_SIZE;
> +  void              *greedy;
>
>    all_thread_created = 0;
>
> @@ -89,6 +90,8 @@ rtems_task Init(rtems_task_argument arg)
>    sc = pthread_key_create( &Key, NULL );
>    rtems_test_assert( !sc );
>
> +  greedy = rtems_workspace_greedy_allocate( &max_free_size, 1 );
> +
>    for ( ; ; ) {
>      rtems_id task_id;
>
> @@ -115,13 +118,15 @@ rtems_task Init(rtems_task_argument arg)
>      }
>      ++created_task_count;
>
> -    sc = rtems_task_start( *task_id_p,  test_task, 0 );
> +    sc = rtems_task_start( task_id,  test_task, 0 );
>      rtems_test_assert( sc == RTEMS_SUCCESSFUL );
>
>      sc = rtems_semaphore_obtain( sema1, RTEMS_WAIT, 0 );
>      rtems_test_assert( sc == RTEMS_SUCCESSFUL );
>    }
>
> +  rtems_workspace_greedy_free( greedy );
> +
>    printf(
>      "Init - %d tasks have been created - OK\n"
>      "Init - %d tasks have been setted key data - OK\n",
> --
> 1.7.7
>
> _______________________________________________
> rtems-devel mailing list
> rtems-devel at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-devel



More information about the devel mailing list