Re: Cortex-M0 BPS creation

2014-09-22 Thread Pavel Pisa
Hello Sebastian and Oleg,

On Monday 22 of September 2014 07:35:38 Sebastian Huber wrote:
 On 22/09/14 06:36, Мороз Олег wrote:
   Hello everyone. i'm new to  BSP development.  We have a project
  which is uses some kind of cortex-m0 microcontroller. As i understand
  it's armv6-m family. Is this CPU family is supported by rtems? I'm
  reading the book called BSP and device driver development guide  and it
  says look at
  cpukit/score/cpu/CPU. This directory contains only armv7-m and armv4
  files. Is it correct?

 The armv7-m support will probably work also for a Cortex-M0.

I think that M3 context switch would be mostly OK.
Exception and interrupts model is the same as for M3,
but I have feeling that there exists option to
use some simplified one - but it can be for M1.
But you need to use M0 specific GCC options.
We use GCC for nRF51 Cortex-M0 with next options

  arm-none-eabi-gcc -mcpu=cortex-m0 -mthumb --std=gnu99 -Wall -mfloat-abi=soft 

Else GCC can use Thumb2 instructions which are not supporeted
by ARMv6-m. For example Thumb instructions CBZ, CBNZ, IT
emitted by GCC for M3 are not supported by M0.

So toolchain rebuild is required for sure.

Best wishes,

 Pavel

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: or1ksim: Updated results from RTEMS Tester

2014-09-22 Thread Hesham Moustafa
Hi,

This is the result with --jobs=1 run:

Passed:   467
Failed: 0
Timeouts:  36
Invalid:0
Total:503

Thanks,
Hesham

On Sun, Sep 21, 2014 at 2:38 AM, Hesham Moustafa heshamelmat...@gmail.com
wrote:



 On Sun, Sep 21, 2014 at 2:21 AM, Chris Johns chr...@rtems.org wrote:

 On 21/09/2014 10:00 am, Hesham Moustafa wrote:

 On Sun, Sep 21, 2014 at 1:15 AM, Chris Johns chr...@rtems.org
 mailto:chr...@rtems.org wrote:

 What does --jobs=none return as results ?

 Only RTEMS Testing - Tester, v0.2.0 and no tests run.


 This looks like a bug. Can you please try --jobs=1 ?

 Sure, its running now, but this will take long time for final results to
 come out.



 Chris



___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH 4/5] cpuuse: Move is_executing_on_a_core to threadimpl.h

2014-09-22 Thread Jennifer Averett
---
 cpukit/libmisc/cpuuse/cpuusagereport.c | 25 +
 1 file changed, 1 insertion(+), 24 deletions(-)

diff --git a/cpukit/libmisc/cpuuse/cpuusagereport.c 
b/cpukit/libmisc/cpuuse/cpuusagereport.c
index 296fa28..62bb81a 100644
--- a/cpukit/libmisc/cpuuse/cpuusagereport.c
+++ b/cpukit/libmisc/cpuuse/cpuusagereport.c
@@ -30,29 +30,6 @@
 #include rtems/score/todimpl.h
 #include rtems/score/watchdogimpl.h
 
-#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
-  static bool is_executing_on_a_core(
-Thread_Control*the_thread,
-Timestamp_Control *time_of_context_switch
-  )
-  {
-#ifndef RTEMS_SMP
-  if ( _Thread_Executing-Object.id == the_thread-Object.id ) {
-*time_of_context_switch = _Thread_Time_of_last_context_switch;
-return true;
-  }
-#else
-  /* FIXME: Locking */
-  if ( _Thread_Is_executing_on_a_processor( the_thread ) ) {
-*time_of_context_switch =
-  _Thread_Get_CPU( the_thread )-time_of_last_context_switch;
-return true;
-  }
-#endif
-return false;
-  }
-#endif
-
 /*
  *  rtems_cpu_usage_report
  */
@@ -149,7 +126,7 @@ void rtems_cpu_usage_report_with_plugin(
* since the last context switch.
*/
   ran = the_thread-cpu_time_used;
-  if ( is_executing_on_a_core( the_thread, last ) ) {
+  if ( _Thread_is_executing_on_a_core( the_thread, last ) ) {
 Timestamp_Control used;
 _TOD_Get_uptime( uptime );
 _Timestamp_Subtract( last, uptime, used );
-- 
1.8.1.4

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 1/5] capture: Removal of capture task tracking.

2014-09-22 Thread Jennifer Averett
This patch removes functionality for stack checking from
the capture engine and requiresi the use of existing rtems
functions for this information.  It modifies ctload to use
functionality similar to rtems cpuusage.  It removes the
capture task and stores a new capture task record the first
time the task is seen.  The per task data that was still
needed is scaled down and stored in the tcb.
---
 cpukit/libmisc/capture/capture-cli.c| 383 ++--
 cpukit/libmisc/capture/capture.c| 367 ++-
 cpukit/libmisc/capture/capture.h| 295 --
 cpukit/libmisc/capture/capture_user_extension.c | 219 +++---
 cpukit/libmisc/capture/captureimpl.h|  53 +---
 5 files changed, 420 insertions(+), 897 deletions(-)

diff --git a/cpukit/libmisc/capture/capture-cli.c 
b/cpukit/libmisc/capture/capture-cli.c
index 2aa7c9c..6fe7e6c 100644
--- a/cpukit/libmisc/capture/capture-cli.c
+++ b/cpukit/libmisc/capture/capture-cli.c
@@ -35,12 +35,28 @@
 #include rtems.h
 #include rtems/capture-cli.h
 #include rtems/monitor.h
-
+#include rtems/cpuuse.h
+#
 #define RC_UNUSED __attribute__((unused))
 
 #define RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS (20)
 
 /*
+ * Counter used to count the number of active tasks.
+ */
+static int   rtems_capture_cli_task_count = 0;
+
+/*
+ * Array of tasks sorted by load.
+ */
+static rtems_tcb*
rtems_capture_cli_load_tasks[RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS + 1];
+
+/*
+ * The load for each tcb at the moment rtems_capture_cli_load_tasks was 
generated.
+ */
+static unsigned long long
rtems_capture_cli_load[RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS + 1];
+
+/*
  * The user capture timestamper.
  */
 static rtems_capture_timestamp capture_timestamp;
@@ -233,6 +249,104 @@ rtems_capture_cli_print_timestamp (uint64_t uptime)
   fprintf (stdout, %5lu:%02lu:%02lu.%09lu, hours, minutes, seconds, 
nanosecs);
 }
 
+static void
+rtems_capture_cli_print_task (rtems_tcb *tcb)
+{
+  rtems_task_priority   ceiling = rtems_capture_watch_get_ceiling ();
+  rtems_task_priority   floor = rtems_capture_watch_get_floor ();
+  rtems_task_priority   priority;
+  int   length;
+
+  priority = rtems_capture_task_real_priority (tcb);
+
+  fprintf (stdout,  );
+  rtems_monitor_dump_id (rtems_capture_task_id (tcb));
+  fprintf (stdout,  );
+  rtems_monitor_dump_name (rtems_capture_task_id (tcb));
+  fprintf (stdout,  );
+  rtems_monitor_dump_priority (rtems_capture_task_start_priority (tcb));
+  fprintf (stdout,  );
+  rtems_monitor_dump_priority (rtems_capture_task_real_priority (tcb));
+  fprintf (stdout,  );
+  rtems_monitor_dump_priority (rtems_capture_task_curr_priority (tcb));
+  fprintf (stdout,  );
+  length = rtems_monitor_dump_state (rtems_capture_task_state (tcb));
+  fprintf (stdout, %*c, 14 - length, ' ');
+  fprintf (stdout,  %c%c,
+   'a',
+   rtems_capture_task_flags (tcb)  RTEMS_CAPTURE_TRACED ? 't' : '-');
+
+  if ((floor  ceiling)  (ceiling  priority))
+fprintf (stdout, --);
+  else
+  {
+uint32_t flags = rtems_capture_task_control_flags (tcb);
+fprintf (stdout, %c%c,
+ rtems_capture_task_control (tcb) ?
+ (flags  RTEMS_CAPTURE_WATCH ? 'w' : '+') : '-',
+ rtems_capture_watch_global_on () ? 'g' : '-');
+  }
+  fprintf (stdout, \n); 
+}
+static void
+rtems_caputure_cli_print_record_std(rtems_capture_record_t* rec, uint64_t diff)
+{
+  uint32_t event;
+  int  e;
+
+  event = rec-events  RTEMS_CAPTURE_EVENT_START;
+
+  for (e = RTEMS_CAPTURE_EVENT_START; e  RTEMS_CAPTURE_EVENT_END; e++)
+  {
+if (event  1)
+{
+  rtems_capture_cli_print_timestamp (rec-time);
+  fprintf (stdout,  %9 PRId64  , diff);
+  rtems_monitor_dump_id (rec-task_id);
+  fprintf(stdout,   %3 PRId32  %3 PRId32  %s\n,
+ (rec-events  RTEMS_CAPTURE_REAL_PRIORITY_EVENT)  0xff,
+ (rec-events  RTEMS_CAPTURE_CURR_PRIORITY_EVENT)  0xff,
+ rtems_capture_event_text (e));
+}
+event = 1;
+  }
+}
+
+static void
+rtems_caputre_cli_print_record_task(rtems_capture_record_t* rec)
+{
+  rtems_capture_task_record_t* task_rec = (rtems_capture_task_record_t*) rec;
+
+  rtems_capture_cli_print_timestamp (rec-time);
+  fprintf (stdout,);
+  rtems_monitor_dump_id (rec-task_id);
+   fprintf (stdout,  %c%c%c%c,
+(char) (task_rec-name  24)  0xff,
+(char) (task_rec-name  16)  0xff,
+(char) (task_rec-name  8)  0xff,
+(char) (task_rec-name  0)  0xff);
+   fprintf (stdout,  %3 PRId32%3 PRId32 \n,
+task_rec-start_priority,
+task_rec-stack_size);
+}
+
+/*
+ * rtems_capture_cli_count_tasks
+ *
+ *  DESCRIPTION:
+ *
+ * This function is called for each tcb and counts the
+ * number of tasks.
+ *
+ */
+
+static void
+rtems_capture_cli_count_tasks (rtems_tcb *tcb)
+{
+  

[PATCH 2/5] score: Add capture data to tcb.

2014-09-22 Thread Jennifer Averett
---
 cpukit/score/include/rtems/score/thread.h | 7 +++
 cpukit/score/src/threadinitialize.c   | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/cpukit/score/include/rtems/score/thread.h 
b/cpukit/score/include/rtems/score/thread.h
index be35789..59e0f9e 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -537,6 +537,11 @@ typedef struct {
 #endif
 } Thread_Scheduler_control;
 
+typedef struct  {
+  uint32_t  flags;
+  void *control;
+}Thread_Capture_control;
+
 /**
  *  This structure defines the Thread Control Block (TCB).
  */
@@ -649,6 +654,8 @@ struct Thread_Control_struct {
*/
   Thread_Life_control   Life;
 
+  Thread_Capture_controlcapture;
+
   /**
* @brief Variable length array of user extension pointers.
*
diff --git a/cpukit/score/src/threadinitialize.c 
b/cpukit/score/src/threadinitialize.c
index e56e4e6..6c1ab36 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -228,6 +228,9 @@ bool _Thread_Initialize(
   the_thread-Life.state = THREAD_LIFE_NORMAL;
   the_thread-Life.terminator = NULL;
 
+  the_thread-capture.flags = 0;
+  the_thread-capture.control = NULL;
+
   /*
*  Open the object
*/
-- 
1.8.1.4

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 5/5] capture01: Remove capture task tracking.

2014-09-22 Thread Jennifer Averett
This involved adding a new variable record to the capture buffer
and modifing the trace method to read those records.
---
 testsuites/libtests/capture01/init.c | 112 ++-
 1 file changed, 85 insertions(+), 27 deletions(-)

diff --git a/testsuites/libtests/capture01/init.c 
b/testsuites/libtests/capture01/init.c
index 21895b9..ae70501 100644
--- a/testsuites/libtests/capture01/init.c
+++ b/testsuites/libtests/capture01/init.c
@@ -113,6 +113,73 @@ static void cwlist ()
   }
 }
 
+/*
+ * rtems_catpure_cli_print_uptime
+ *
+ *  DESCRIPTION::148
+ *
+ *
+ * This function prints the nanosecond uptime to stdout.
+ */
+static void
+rtems_capture_cli_print_timestamp (uint64_t uptime)
+{
+  uint32_t hours;
+  uint32_t minutes;
+  uint32_t seconds;
+  uint32_t nanosecs;
+
+  seconds  = uptime / 10LLU;
+  minutes  = seconds / 60;
+  hours= minutes / 60;
+  minutes  = minutes % 60;
+  seconds  = seconds % 60;
+  nanosecs = uptime % 10;
+
+  fprintf (stdout, %5lu:%02lu:%02lu.%09lu, hours, minutes, seconds, 
nanosecs);
+}
+static void
+rtems_caputre_cli_print_record_task(rtems_capture_record_t* rec)
+{
+  rtems_capture_task_record_t* task_rec = (rtems_capture_task_record_t*) rec;
+
+  rtems_capture_cli_print_timestamp (rec-time);
+  fprintf (stdout,);
+  rtems_monitor_dump_id (rec-task_id);
+   fprintf (stdout,  %c%c%c%c,
+(char) (task_rec-name  24)  0xff,
+(char) (task_rec-name  16)  0xff,
+(char) (task_rec-name  8)  0xff,
+(char) (task_rec-name  0)  0xff);
+   fprintf (stdout,  %3 PRId32%3 PRId32 \n,
+task_rec-start_priority,
+task_rec-stack_size);
+}
+
+static void
+rtems_caputure_cli_print_record_std(rtems_capture_record_t* rec, uint64_t diff)
+{
+  uint32_t event;
+  int  e;
+
+  event = rec-events  RTEMS_CAPTURE_EVENT_START;
+
+  for (e = RTEMS_CAPTURE_EVENT_START; e  RTEMS_CAPTURE_EVENT_END; e++)
+  {
+if (event  1)
+{
+  rtems_capture_cli_print_timestamp (rec-time);
+  fprintf (stdout,  %9 PRId64  , diff);
+  rtems_monitor_dump_id (rec-task_id);
+  fprintf(stdout,   %3 PRId32  %3 PRId32  %s\n,
+ (rec-events  RTEMS_CAPTURE_REAL_PRIORITY_EVENT)  0xff,
+ (rec-events  RTEMS_CAPTURE_CURR_PRIORITY_EVENT)  0xff,
+ rtems_capture_event_text (e));
+}
+event = 1;
+  }
+}
+
 static void ctrace()
 {
   rtems_status_code   sc;
@@ -122,6 +189,8 @@ static void ctrace()
   int count;
   uint32_tread;
   rtems_capture_record_t* rec;
+  uint8_t*ptr;
+  rtems_capture_time_tlast_t = 0;
 
   total = dump_total;
 
@@ -148,43 +217,32 @@ static void ctrace()
 }
 
 count = total  read ? total : read;
-
+ptr = (uint8_t *) rec;
 while (count--)
 {
+  rec = (rtems_capture_record_t*) ptr;
+
   if (csv)
-fprintf (stdout, %08 PRIxPTR ,%03 PRIu32
+fprintf (stdout, %08 PRIu32 ,%03 PRIu32
,%03 PRIu32 ,%04 PRIx32 ,% PRId64 \n,
- (uintptr_t) rec-task,
+ rec-task_id,
  (rec-events  RTEMS_CAPTURE_REAL_PRIORITY_EVENT)  0xff,
  (rec-events  RTEMS_CAPTURE_CURR_PRIORITY_EVENT)  0xff,
  (rec-events  RTEMS_CAPTURE_EVENT_START),
  (uint64_t) rec-time);
-  else
-  {
-uint32_t event;
-int  e;
-
-event = rec-events  RTEMS_CAPTURE_EVENT_START;
-
-for (e = RTEMS_CAPTURE_EVENT_START; e = RTEMS_CAPTURE_EVENT_END; e++)
-{
-  if (event  1)
-  {
-rtems_monitor_dump_id (rtems_capture_task_id (rec-task));
-fprintf (stdout,  %c%c%c%c,
- (char) (rec-task-name  24)  0xff,
- (char) (rec-task-name  16)  0xff,
- (char) (rec-task-name  8)  0xff,
- (char) (rec-task-name  0)  0xff);
-fprintf (stdout,  %3 PRId32  %3 PRId32  %s\n,
-(rec-events  RTEMS_CAPTURE_REAL_PRIORITY_EVENT)  0xff,
-(rec-events  RTEMS_CAPTURE_CURR_PRIORITY_EVENT)  0xff,
-rtems_capture_event_text (e));
-  }
-  event = 1;
+  else {
+if ((rec-events  RTEMS_CAPTURE_EVENT_START) == 0)
+  rtems_caputre_cli_print_record_task( rec );
+else {
+  uint64_t diff = 0;
+  if (last_t)
+diff = rec-time - last_t;
+  last_t = rec-time;
+ 
+  rtems_caputure_cli_print_record_std( rec, diff );
 }
   }
-  rec++;
+  ptr += rec-size;
 }
 
 count = total  read ? total : read;
-- 
1.8.1.4

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 1/5] capture: Removal of capture task tracking.

2014-09-22 Thread Chris Johns

On 23/09/2014 12:00 am, Jennifer Averett wrote:

This patch removes functionality for stack checking from
the capture engine and requiresi the use of existing rtems
functions for this information.  It modifies ctload to use
functionality similar to rtems cpuusage.  It removes the
capture task and stores a new capture task record the first
time the task is seen.  The per task data that was still
needed is scaled down and stored in the tcb.


If the capture engine is not needed for ctload to work why not move that 
code out of here and into the cpuuse command ? It would appear more 
available to users.



---
  cpukit/libmisc/capture/capture-cli.c| 383 ++--
  cpukit/libmisc/capture/capture.c| 367 ++-
  cpukit/libmisc/capture/capture.h| 295 --
  cpukit/libmisc/capture/capture_user_extension.c | 219 +++---
  cpukit/libmisc/capture/captureimpl.h|  53 +---
  5 files changed, 420 insertions(+), 897 deletions(-)

diff --git a/cpukit/libmisc/capture/capture-cli.c 
b/cpukit/libmisc/capture/capture-cli.c
index 2aa7c9c..6fe7e6c 100644
--- a/cpukit/libmisc/capture/capture-cli.c
+++ b/cpukit/libmisc/capture/capture-cli.c
@@ -35,12 +35,28 @@
  #include rtems.h
  #include rtems/capture-cli.h
  #include rtems/monitor.h
-
+#include rtems/cpuuse.h
+#
  #define RC_UNUSED __attribute__((unused))

  #define RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS (20)

  /*
+ * Counter used to count the number of active tasks.
+ */
+static int   rtems_capture_cli_task_count = 0;
+
+/*
+ * Array of tasks sorted by load.
+ */
+static rtems_tcb*
rtems_capture_cli_load_tasks[RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS + 1];
+
+/*
+ * The load for each tcb at the moment rtems_capture_cli_load_tasks was 
generated.
+ */
+static unsigned long long
rtems_capture_cli_load[RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS + 1];
+
+/*
   * The user capture timestamper.
   */
  static rtems_capture_timestamp capture_timestamp;
@@ -233,6 +249,104 @@ rtems_capture_cli_print_timestamp (uint64_t uptime)
fprintf (stdout, %5lu:%02lu:%02lu.%09lu, hours, minutes, seconds, 
nanosecs);
  }

+static void
+rtems_capture_cli_print_task (rtems_tcb *tcb)
+{
+  rtems_task_priority   ceiling = rtems_capture_watch_get_ceiling ();
+  rtems_task_priority   floor = rtems_capture_watch_get_floor ();
+  rtems_task_priority   priority;
+  int   length;
+
+  priority = rtems_capture_task_real_priority (tcb);
+
+  fprintf (stdout,  );
+  rtems_monitor_dump_id (rtems_capture_task_id (tcb));
+  fprintf (stdout,  );
+  rtems_monitor_dump_name (rtems_capture_task_id (tcb));
+  fprintf (stdout,  );
+  rtems_monitor_dump_priority (rtems_capture_task_start_priority (tcb));
+  fprintf (stdout,  );
+  rtems_monitor_dump_priority (rtems_capture_task_real_priority (tcb));
+  fprintf (stdout,  );
+  rtems_monitor_dump_priority (rtems_capture_task_curr_priority (tcb));
+  fprintf (stdout,  );
+  length = rtems_monitor_dump_state (rtems_capture_task_state (tcb));
+  fprintf (stdout, %*c, 14 - length, ' ');
+  fprintf (stdout,  %c%c,
+   'a',
+   rtems_capture_task_flags (tcb)  RTEMS_CAPTURE_TRACED ? 't' : '-');
+
+  if ((floor  ceiling)  (ceiling  priority))
+fprintf (stdout, --);
+  else
+  {
+uint32_t flags = rtems_capture_task_control_flags (tcb);
+fprintf (stdout, %c%c,
+ rtems_capture_task_control (tcb) ?
+ (flags  RTEMS_CAPTURE_WATCH ? 'w' : '+') : '-',
+ rtems_capture_watch_global_on () ? 'g' : '-');
+  }
+  fprintf (stdout, \n);
+}
+static void
+rtems_caputure_cli_print_record_std(rtems_capture_record_t* rec, uint64_t diff)
+{
+  uint32_t event;
+  int  e;
+
+  event = rec-events  RTEMS_CAPTURE_EVENT_START;
+
+  for (e = RTEMS_CAPTURE_EVENT_START; e  RTEMS_CAPTURE_EVENT_END; e++)
+  {
+if (event  1)
+{
+  rtems_capture_cli_print_timestamp (rec-time);
+  fprintf (stdout,  %9 PRId64  , diff);
+  rtems_monitor_dump_id (rec-task_id);
+  fprintf(stdout,   %3 PRId32  %3 PRId32  %s\n,
+ (rec-events  RTEMS_CAPTURE_REAL_PRIORITY_EVENT)  0xff,
+ (rec-events  RTEMS_CAPTURE_CURR_PRIORITY_EVENT)  0xff,
+ rtems_capture_event_text (e));
+}
+event = 1;
+  }
+}
+
+static void
+rtems_caputre_cli_print_record_task(rtems_capture_record_t* rec)
+{
+  rtems_capture_task_record_t* task_rec = (rtems_capture_task_record_t*) rec;
+
+  rtems_capture_cli_print_timestamp (rec-time);
+  fprintf (stdout,);
+  rtems_monitor_dump_id (rec-task_id);
+   fprintf (stdout,  %c%c%c%c,
+(char) (task_rec-name  24)  0xff,
+(char) (task_rec-name  16)  0xff,
+(char) (task_rec-name  8)  0xff,
+(char) (task_rec-name  0)  0xff);
+   fprintf (stdout,  %3 PRId32%3 PRId32 \n,
+task_rec-start_priority,
+task_rec-stack_size);
+}
+
+/*
+ * 

Re: [PATCH 2/5] score: Add capture data to tcb.

2014-09-22 Thread Sebastian Huber

On 22/09/14 16:00, Jennifer Averett wrote:

+  Thread_Capture_controlcapture;
+


This should be Capture.

--
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.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


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

2014-09-22 Thread Sebastian Huber

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.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel