summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/capture
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-10-31 13:37:59 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-02 08:46:47 +0100
commitd271c3bb78f86dd9417a964b019b8e38911064fa (patch)
tree3c36b87c580464cc7f1e5aec89e1137a68759da3 /cpukit/libmisc/capture
parentposix: Fix timer interval (diff)
downloadrtems-d271c3bb78f86dd9417a964b019b8e38911064fa.tar.bz2
rtems: Add rtems_task_iterate()
Update #2423.
Diffstat (limited to 'cpukit/libmisc/capture')
-rw-r--r--cpukit/libmisc/capture/capture-cli.c27
-rw-r--r--cpukit/libmisc/capture/capture.c15
2 files changed, 22 insertions, 20 deletions
diff --git a/cpukit/libmisc/capture/capture-cli.c b/cpukit/libmisc/capture/capture-cli.c
index 05c922be44..d489d9f32a 100644
--- a/cpukit/libmisc/capture/capture-cli.c
+++ b/cpukit/libmisc/capture/capture-cli.c
@@ -42,11 +42,6 @@
#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;
-
-/*
* The user capture timestamper.
*/
static rtems_capture_timestamp capture_timestamp;
@@ -197,8 +192,8 @@ rtems_capture_cli_disable (int argc RC_UNUSED,
fprintf (stdout, "capture engine disabled.\n");
}
-static void
-rtems_capture_cli_print_task (rtems_tcb *tcb)
+static bool
+rtems_capture_cli_print_task (rtems_tcb *tcb, void *arg)
{
rtems_task_priority ceiling = rtems_capture_watch_get_ceiling ();
rtems_task_priority floor = rtems_capture_watch_get_floor ();
@@ -242,6 +237,7 @@ rtems_capture_cli_print_task (rtems_tcb *tcb)
rtems_capture_watch_global_on () ? 'g' : '-');
}
fprintf (stdout, "\n");
+ return false;
}
/*
@@ -251,10 +247,12 @@ rtems_capture_cli_print_task (rtems_tcb *tcb)
* number of tasks.
*/
-static void
-rtems_capture_cli_count_tasks (rtems_tcb *tcb)
+static bool
+rtems_capture_cli_count_tasks (rtems_tcb *tcb, void *arg)
{
- rtems_capture_cli_task_count++;
+ uint32_t *task_count = arg;
+ ++(*task_count);
+ return false;
}
@@ -271,16 +269,17 @@ rtems_capture_cli_task_list (int argc RC_UNUSED,
bool verbose RC_UNUSED)
{
rtems_capture_time uptime;
+ uint32_t task_count;
rtems_capture_get_time (&uptime);
- rtems_capture_cli_task_count = 0;
- rtems_iterate_over_all_threads (rtems_capture_cli_count_tasks);
+ task_count = 0;
+ rtems_task_iterate (rtems_capture_cli_count_tasks, &task_count);
fprintf (stdout, "uptime: ");
rtems_capture_print_timestamp (uptime);
- fprintf (stdout, "\ntotal %i\n", rtems_capture_cli_task_count);
- rtems_iterate_over_all_threads (rtems_capture_cli_print_task);
+ fprintf (stdout, "\ntotal %" PRIu32 "\n", task_count);
+ rtems_task_iterate (rtems_capture_cli_print_task, NULL);
}
/*
diff --git a/cpukit/libmisc/capture/capture.c b/cpukit/libmisc/capture/capture.c
index 69015c8c1a..41f25aacd5 100644
--- a/cpukit/libmisc/capture/capture.c
+++ b/cpukit/libmisc/capture/capture.c
@@ -279,8 +279,8 @@ rtems_capture_find_control (rtems_name name, rtems_id id)
* This function checks if a new control structure matches
* the given task and sets the control if it does.
*/
-static void
-rtems_capture_initialize_control (rtems_tcb *tcb)
+static bool
+rtems_capture_initialize_control (rtems_tcb *tcb, void *arg)
{
if (tcb->Capture.control == NULL)
{
@@ -305,6 +305,8 @@ rtems_capture_initialize_control (rtems_tcb *tcb)
}
}
}
+
+ return false;
}
static rtems_capture_control*
@@ -342,7 +344,7 @@ rtems_capture_create_control (rtems_name name, rtems_id id)
control->next = capture_controls;
capture_controls = control;
- rtems_iterate_over_all_threads (rtems_capture_initialize_control);
+ _Thread_Iterate (rtems_capture_initialize_control, NULL);
rtems_interrupt_lock_release (&capture_lock_global, &lock_context);
}
@@ -749,10 +751,11 @@ rtems_capture_set_monitor (bool enable)
/*
* This function clears the capture trace flag in the tcb.
*/
-static void
-rtems_capture_flush_tcb (rtems_tcb *tcb)
+static bool
+rtems_capture_flush_tcb (rtems_tcb *tcb, void *arg)
{
tcb->Capture.flags &= ~RTEMS_CAPTURE_TRACED;
+ return false;
}
/*
@@ -776,7 +779,7 @@ rtems_capture_flush (bool prime)
return RTEMS_UNSATISFIED;
}
- rtems_iterate_over_all_threads (rtems_capture_flush_tcb);
+ _Thread_Iterate (rtems_capture_flush_tcb, NULL);
if (prime)
capture_flags_global &= ~(RTEMS_CAPTURE_TRIGGERED | RTEMS_CAPTURE_OVERFLOW);