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

2014-09-23 Thread Chris Johns

On 23/09/2014 10:29 pm, Jennifer Averett wrote:

I tried to limit how much functionality I removed from the capture engine with 
this
set of patches and limit it to what had to be removed in order to support 
removal of
capture tasks.   I have no problem with it moving to cpuuse, but I think it 
would need to
be modified to use a printk plugin and account for 
__RTEMS_USE_TICKS_FOR_STATISTICS__ .


This makes sense.

Chris
___
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);
+}
+
+/*
+ *