[PATCH 3/5] score: Move is_executing_on_a_core from cpuusagereport.c to threadimpl.h

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Sep 23 04:39:00 UTC 2014


On 22/09/14 16:00, Jennifer Averett wrote:
> ---
>   cpukit/score/include/rtems/score/threadimpl.h | 26 ++++++++++++++++++++++++++
>   1 file changed, 26 insertions(+)
>
> diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
> index 9321c01..77126eb 100644
> --- a/cpukit/score/include/rtems/score/threadimpl.h
> +++ b/cpukit/score/include/rtems/score/threadimpl.h
> @@ -467,6 +467,7 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_executing (
>     return ( the_thread == _Thread_Executing );
>   }
>
> +

Extra empty line.

>   #if defined(RTEMS_SMP)
>   /**
>    * @brief Returns @true in case the thread executes currently on some processor
> @@ -483,6 +484,31 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_executing_on_a_processor(
>   }
>   #endif
>
> +RTEMS_INLINE_ROUTINE bool _Thread_is_executing_on_a_core(
> +  Thread_Control    *the_thread,
> +  Timestamp_Control *time_of_context_switch
> +)

I would rather name this _Thread_Get_time_of_last_context_switch().  The return 
value should be documented.

> +{
> +  bool retval = false;
> +
> +  _Thread_Disable_dispatch();
> +  #ifndef RTEMS_SMP
> +    if ( _Thread_Executing->Object.id == the_thread->Object.id ) {
> +      *time_of_context_switch = _Thread_Time_of_last_context_switch;
> +      retval = true;
> +    }
> +  #else
> +    if ( _Thread_Is_executing_on_a_processor( the_thread ) ) {
> +      *time_of_context_switch =
> +        _Thread_Get_CPU( the_thread )->time_of_last_context_switch;
> +      retval = true;
> +    }
> +  #endif
> +  _Thread_Enable_dispatch();
> +  return retval;
> +}
> +
> +
>   /**
>    * This function returns true if the_thread is the heir
>    * thread, and false otherwise.
>


-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list