[PATCH 3/8] score: Add potpourri lock statistics

Gedare Bloom gedare at gwu.edu
Fri Jul 24 14:15:23 UTC 2015


All of the external lock objects will re-use the same lock statistics
struct? Is there any reason to separate the stats more? At least in
terms of the locks provided in RTEMS, you could create an array of the
Potpourri_stats and assign the known usages into the array, with a
catch-all at offset zero for the unknown usages. I don't know if this
makes sense or not, but in terms of understanding the lock stats this
might be a good thing for profiling purposes rather than aggregrating
all stats into the same struct?

On Thu, Jul 23, 2015 at 8:54 AM, Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
> These SMP lock statistics are used for all lock objects that lack a
> storage space for the statistics.  Examples are lock objects used in
> external libraries which are independent of the actual RTEMS build
> configuration.
> ---
>  cpukit/score/include/rtems/score/thread.h | 12 ++++++++++++
>  cpukit/score/src/threadinitialize.c       |  1 +
>  cpukit/score/src/threadrestart.c          |  1 +
>  3 files changed, 14 insertions(+)
>
> diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
> index 157acfa..ac908e2 100644
> --- a/cpukit/score/include/rtems/score/thread.h
> +++ b/cpukit/score/include/rtems/score/thread.h
> @@ -733,6 +733,18 @@ struct _Thread_Control {
>    Thread_Lock_control Lock;
>  #endif
>
> +#if defined(RTEMS_SMP) && defined(RTEMS_PROFILING)
> +  /**
> +   * @brief Potpourri lock statistics.
> +   *
> +   * These SMP lock statistics are used for all lock objects that lack a
> +   * storage space for the statistics.  Examples are lock objects used in
> +   * external libraries which are independent of the actual RTEMS build
> +   * configuration.
> +   */
> +  SMP_lock_Stats Potpourri_stats;
> +#endif
> +
>  #ifdef __RTEMS_STRICT_ORDER_MUTEX__
>    /** This field is the head of queue of priority inheritance mutex
>     *  held by the thread.
> diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
> index 9019e1f..7452c93 100644
> --- a/cpukit/score/src/threadinitialize.c
> +++ b/cpukit/score/src/threadinitialize.c
> @@ -205,6 +205,7 @@ bool _Thread_Initialize(
>    _CPU_Context_Set_is_executing( &the_thread->Registers, false );
>    the_thread->Lock.current = &the_thread->Lock.Default;
>    _ISR_lock_Initialize( &the_thread->Lock.Default, "Thread Lock Default");
> +  _SMP_lock_Stats_initialize( &the_thread->Potpourri_stats, "Thread Potpourri" );
>    _Atomic_Init_uint(&the_thread->Lock.generation, 0);
>  #endif
>
> diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
> index abd809d..5d80beb 100644
> --- a/cpukit/score/src/threadrestart.c
> +++ b/cpukit/score/src/threadrestart.c
> @@ -130,6 +130,7 @@ static void _Thread_Free( Thread_Control *the_thread )
>
>  #if defined(RTEMS_SMP)
>    _ISR_lock_Destroy( &the_thread->Lock.Default );
> +  _SMP_lock_Stats_destroy( &the_thread->Potpourri_stats );
>  #endif
>
>    _Objects_Free( &information->Objects, &the_thread->Object );
> --
> 1.8.4.5
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list