Ignore:
Timestamp:
01/11/17 10:04:35 (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
96bb2e4b
Parents:
b7f1fc3
git-author:
Sebastian Huber <sebastian.huber@…> (01/11/17 10:04:35)
git-committer:
Sebastian Huber <sebastian.huber@…> (01/12/17 06:44:37)
Message:

Add and use rtems_assoc_thread_states_to_string()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libmisc/monitor/mon-prmisc.c

    rb7f1fc3 ra3730b38  
    1313#include <rtems/monitor.h>
    1414#include <rtems/assoc.h>
    15 #include <rtems/score/statesimpl.h>
    1615
    1716#include <stdio.h>
     
    113112}
    114113
    115 #define WITH_ID(state) (STATES_THREAD_QUEUE_WITH_IDENTIFIER | state)
    116 
    117 static const rtems_assoc_t rtems_monitor_state_assoc[] = {
    118     { "DORM",   STATES_DORMANT, 0 },
    119     { "LIFE",   STATES_LIFE_IS_CHANGING, 0 },
    120     { "SUSP",   STATES_SUSPENDED, 0 },
    121     { "Wbar",   WITH_ID(STATES_WAITING_FOR_BARRIER), 0 },
    122     { "Wcvar",  WITH_ID(STATES_WAITING_FOR_CONDITION_VARIABLE), 0 },
    123     { "Wevnt",  STATES_WAITING_FOR_EVENT, 0 },
    124     { "Wisig",  STATES_INTERRUPTIBLE_BY_SIGNAL, 0 },
    125     { "Wjatx",  STATES_WAITING_FOR_JOIN_AT_EXIT, 0 },
    126     { "Wjoin",  STATES_WAITING_FOR_JOIN, 0 },
    127     { "Wmsg" ,  WITH_ID(STATES_WAITING_FOR_MESSAGE), 0 },
    128     { "Wmutex", WITH_ID(STATES_WAITING_FOR_MUTEX), 0 },
    129     { "WRATE",  STATES_WAITING_FOR_PERIOD, 0 },
    130     { "Wrpc",   STATES_WAITING_FOR_RPC_REPLY, 0 },
    131     { "Wrwlk",  WITH_ID(STATES_WAITING_FOR_RWLOCK), 0 },
    132     { "Wseg",   STATES_WAITING_FOR_SEGMENT, 0 },
    133     { "Wsem",   WITH_ID(STATES_WAITING_FOR_SEMAPHORE), 0 },
    134     { "Wsig",   STATES_WAITING_FOR_SIGNAL, 0 },
    135     { "Wcvar",  STATES_WAITING_FOR_CONDITION_VARIABLE, 0 },
    136     { "Wfutex", STATES_WAITING_FOR_FUTEX, 0 },
    137     { "Wmutex", STATES_WAITING_FOR_MUTEX, 0 },
    138     { "Wsem",   STATES_WAITING_FOR_SEMAPHORE, 0 },
    139     { "Wsysev", STATES_WAITING_FOR_SYSTEM_EVENT, 0 },
    140     { "Wtime",  STATES_WAITING_FOR_TIME, 0 },
    141     { "Wwkup",  STATES_WAITING_FOR_BSD_WAKEUP, 0 },
    142     { "ZOMBI",  STATES_ZOMBIE, 0 },
    143     { 0, 0, 0 },
    144 };
    145 
    146114int
    147115rtems_monitor_dump_state(States_Control state)
    148116{
    149     int   length = 0;
     117    char buf[16];
    150118
    151     if (state == STATES_READY)  /* assoc doesn't deal with this as it is 0 */
    152         length += fprintf(stdout,"READY");
    153 
    154     length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_state_assoc,
    155                                                 ":",
    156                                                 state);
    157     return length;
     119    rtems_assoc_thread_states_to_string(state, buf, sizeof(buf));
     120    return fprintf(stdout, "%s", buf);
    158121}
    159122
Note: See TracChangeset for help on using the changeset viewer.