summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-10-31 16:23:52 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-03 11:23:30 +0100
commit47d246436f5b95359325740f4deb2df6345c971e (patch)
tree0d006b98e2449d66b8b882c39ffb6ef107e1532f /cpukit/score/include/rtems/score
parentscore: Relax _Scheduler_Set() restrictions (diff)
downloadrtems-47d246436f5b95359325740f4deb2df6345c971e.tar.bz2
score: Conditionally enable thread resource count
Maintain the thread resource count only in debug configurations. This is a performance optimization for non-debug configurations.
Diffstat (limited to '')
-rw-r--r--cpukit/score/include/rtems/score/thread.h8
-rw-r--r--cpukit/score/include/rtems/score/threadimpl.h10
2 files changed, 18 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index ff7f13be55..7711f706f3 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -83,6 +83,10 @@ extern "C" {
#define RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API
#endif
+#if defined(RTEMS_DEBUG)
+#define RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT
+#endif
+
/*
* Only provided for backward compatiblity to not break application
* configurations.
@@ -492,8 +496,10 @@ typedef struct {
*/
Priority_Node Real_priority;
+#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
/** This field is the number of mutexes currently held by this proxy. */
uint32_t resource_count;
+#endif
/**
* @brief Scheduler related control.
@@ -716,8 +722,10 @@ struct _Thread_Control {
*/
Priority_Node Real_priority;
+#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
/** This field is the number of mutexes currently held by this thread. */
uint32_t resource_count;
+#endif
/**
* @brief Scheduler related control.
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index 37127fbabd..61694461b4 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -977,16 +977,25 @@ RTEMS_INLINE_ROUTINE void _Thread_Resource_count_increment(
Thread_Control *the_thread
)
{
+#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
++the_thread->resource_count;
+#else
+ (void) the_thread;
+#endif
}
RTEMS_INLINE_ROUTINE void _Thread_Resource_count_decrement(
Thread_Control *the_thread
)
{
+#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
--the_thread->resource_count;
+#else
+ (void) the_thread;
+#endif
}
+#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
/**
* @brief Returns true if the thread owns resources, and false otherwise.
*
@@ -1001,6 +1010,7 @@ RTEMS_INLINE_ROUTINE bool _Thread_Owns_resources(
{
return the_thread->resource_count != 0;
}
+#endif
#if defined(RTEMS_SMP)
RTEMS_INLINE_ROUTINE void _Thread_Scheduler_cancel_need_for_help(