summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/cpuuse/cpuusagetop.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/libmisc/cpuuse/cpuusagetop.c')
-rw-r--r--cpukit/libmisc/cpuuse/cpuusagetop.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/cpukit/libmisc/cpuuse/cpuusagetop.c b/cpukit/libmisc/cpuuse/cpuusagetop.c
index 6355e4e636..9b928588c7 100644
--- a/cpukit/libmisc/cpuuse/cpuusagetop.c
+++ b/cpukit/libmisc/cpuuse/cpuusagetop.c
@@ -218,12 +218,14 @@ static void
task_usage(Thread_Control* thread, void* arg)
{
rtems_cpu_usage_data* data = (rtems_cpu_usage_data*) arg;
- Timestamp_Control usage = thread->cpu_time_used;
+ Timestamp_Control usage;
Timestamp_Control current = data->zero;
int j;
data->stack_size += thread->Start.Initial_stack.size;
+ _Thread_Get_CPU_time_used(thread, &usage);
+
for (j = 0; j < data->last_task_count; j++)
{
if (thread == data->last_tasks[j])
@@ -497,25 +499,6 @@ rtems_cpuusage_top_thread (rtems_task_argument arg)
current_usage = data->current_usage[i];
/*
- * If this is the currently executing thread, account for time since
- * the last context switch.
- */
- if (_Thread_Get_time_of_last_context_switch(thread, &last))
- {
- Timestamp_Control used;
- Timestamp_Control now;
-
- /*
- * Get the current uptime and assume we are not pre-empted to
- * measure the time from the last switch this thread and now.
- */
- _TOD_Get_uptime(&now);
- _Timestamp_Subtract(&last, &now, &used);
- _Timestamp_Add_to(&usage, &used);
- _Timestamp_Add_to(&current_usage, &used);
- }
-
- /*
* Print the information
*/
print_time(data, &usage, 19);