Changeset 638927a in mainline for uspace/app/top/screen.c


Ignore:
Timestamp:
2010-04-09T11:18:08Z (14 years ago)
Author:
Stanislav Kozina <stanislav.kozina@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e43cdac
Parents:
faf38b2
Message:

top echoes also thread state overview
write_barrier() after computing percentages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/top/screen.c

    rfaf38b2 r638927a  
    119119}
    120120
     121static inline void print_threadstat(data_t *data)
     122{
     123        size_t sleeping = 0;
     124        size_t running = 0;
     125        size_t invalid = 0;
     126        size_t other = 0;
     127        size_t total = 0;
     128        size_t i;
     129        for (i = 0; i < data->thread_count; ++i) {
     130                ++total;
     131                switch (data->thread_infos[i].state) {
     132                        case Invalid:
     133                        case Lingering:
     134                                ++invalid;
     135                                break;
     136                        case Running:
     137                        case Ready:
     138                                ++running;
     139                                break;
     140                        case Sleeping:
     141                                ++sleeping;
     142                                break;
     143                        case Entering:
     144                        case Exiting:
     145                                ++other;
     146                                break;
     147                }
     148        }
     149        printf("Threads: %5u total, %5u running, %5u sleeping, %5u invalid, %5u other",
     150                total, running, sleeping, invalid, other);
     151}
     152
    121153static inline void print_cpuinfo(data_t *data)
    122154{
     
    197229        puts("\n");
    198230        ++up_rows;
     231        print_threadstat(data);
     232        puts("\n");
     233        ++up_rows;
    199234        print_cpuinfo(data);
    200235        print_meminfo(data);
Note: See TracChangeset for help on using the changeset viewer.