Ticket #3552: cpuusagetop.patch

File cpuusagetop.patch, 1.8 KB (added by zhengxiaojun, on 10/17/18 at 05:38:48)
  • rtems/cpukit/libmisc/cpuuse/cpuusagetop.c

    old new  
    4141#include <rtems/score/watchdogimpl.h>
    4242#include <rtems/score/wkspace.h>
    4343
     44#include <rtems/rtems/tasksimpl.h>
     45#include <rtems/scheduler.h>
     46
    4447#include "cpuuseimpl.h"
    4548
    4649/*
     
    199202    data->idle = usage;
    200203    data->current_idle = current;
    201204  }
     205  if (thread->Object.id == 0x09010002)
     206  {
     207    data->idle += usage;
     208    data->current_idle += current;
     209  }
    202210
    203211  /*
    204212   * Create the tasks to display soring as we create.
     
    424432      Thread_Control*   thread = data->tasks[i];
    425433      Timestamp_Control usage;
    426434      Timestamp_Control current_usage;
     435      const Scheduler_Control *scheduler;
    427436
    428437      if (thread == NULL)
    429438        break;
     
    444453      if (name[0] == '\0')
    445454        snprintf(name, sizeof(name) - 1, "(%p)", thread->Start.Entry.Kinds.Numeric.entry);
    446455
     456      scheduler = _Thread_Scheduler_get_home( thread );
     457
    447458      rtems_printf(data->printer,
    448                    " 0x%08" PRIx32 " | %-19s |  %3" PRId64 " |  %3" PRId64 "   | ",
     459                   " 0x%08" PRIx32 " | %-19s |  %3" PRId32 " |  %3" PRId32 "   | ",
    449460                   thread->Object.id,
    450                    name,
    451                    thread->Real_priority.priority,
    452                    _Thread_Get_priority(thread));
     461                   name, 
     462                   _RTEMS_Priority_From_core(scheduler, thread->Real_priority.priority),
     463                   _RTEMS_Priority_From_core(scheduler, _Thread_Get_priority(thread)));
    453464
    454465      usage = data->usage[i];
    455466      current_usage = data->current_usage[i];