Changeset be06914 in mainline for uspace/app/top/screen.c


Ignore:
Timestamp:
2010-06-11T12:41:35Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b3b7e14
Parents:
48dcc69
Message:

nicer top printouts
fix typos (recieved → received)

File:
1 edited

Legend:

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

    r48dcc69 rbe06914  
    126126}
    127127
    128 static void print_float(fixed_float ffloat, unsigned int precision)
    129 {
    130         printf("%2" PRIu64 ".", ffloat.upper / ffloat.lower);
     128static void print_percent(fixed_float ffloat, unsigned int precision)
     129{
     130        printf("%3" PRIu64 ".", ffloat.upper / ffloat.lower);
    131131       
    132132        unsigned int i;
     
    136136                rest = (rest % ffloat.lower) * 10;
    137137        }
     138       
     139        printf("%%");
     140}
     141
     142static void print_string(const char *str)
     143{
     144        ipcarg_t cols;
     145        ipcarg_t rows;
     146        screen_get_size(&cols, &rows);
     147       
     148        ipcarg_t c;
     149        ipcarg_t r;
     150        screen_get_pos(&c, &r);
     151       
     152        if (c < cols)
     153                printf("%.*s", cols - c - 1, str);
    138154}
    139155
     
    211227                            data->cpus[i].busy_ticks, data->cpus[i].idle_ticks);
    212228                        puts(", idle: ");
    213                         print_float(data->cpus_perc[i].idle, 2);
    214                         puts("%, busy: ");
    215                         print_float(data->cpus_perc[i].busy, 2);
    216                         puts("%");
     229                        print_percent(data->cpus_perc[i].idle, 2);
     230                        puts(", busy: ");
     231                        print_percent(data->cpus_perc[i].busy, 2);
    217232                } else
    218233                        printf("cpu%u inactive", data->cpus[i].id);
     
    247262{
    248263        screen_style_inverted();
    249         printf("      ID  Threads      Mem      %%Mem %%uCycles %%kCycles  Name");
     264        printf("[taskid] [threads] [virtual] [%%virt] [%%user]"
     265            " [%%kernel] [name");
    250266        screen_newline();
    251267        screen_style_normal();
     
    268284                order_suffix(data->tasks[i].virtmem, &virtmem, &virtmem_suffix);
    269285               
    270                 printf("%8" PRIu64 " %8u %8" PRIu64 "%c ", data->tasks[i].task_id,
     286                printf("%-8" PRIu64 " %9u %8" PRIu64 "%c ", data->tasks[i].task_id,
    271287                    data->tasks[i].threads, virtmem, virtmem_suffix);
     288                print_percent(data->tasks_perc[i].virtmem, 2);
     289                puts(" ");
     290                print_percent(data->tasks_perc[i].ucycles, 2);
    272291                puts("   ");
    273                 print_float(data->tasks_perc[i].virtmem, 2);
    274                 puts("%   ");
    275                 print_float(data->tasks_perc[i].ucycles, 2);
    276                 puts("%   ");
    277                 print_float(data->tasks_perc[i].kcycles, 2);
    278                 printf("%% %s", data->tasks[i].name);
     292                print_percent(data->tasks_perc[i].kcycles, 2);
     293                puts(" ");
     294                print_string(data->tasks[i].name);
    279295               
    280296                screen_newline();
     
    290306{
    291307        screen_style_inverted();
    292         printf("      ID Calls sent Calls recv Answs sent Answs recv  IRQn recv       Forw Name");
     308        printf("[taskid] [cls snt] [cls rcv] [ans snt]"
     309            " [ans rcv] [irq rcv] [forward] [name");
    293310        screen_newline();
    294311        screen_style_normal();
     
    307324        size_t i;
    308325        for (i = 0; (i < data->tasks_count) && (row < rows); i++, row++) {
    309                 printf("%8" PRIu64 " %10" PRIu64 " %10" PRIu64 " %10" PRIu64
    310                      " %10" PRIu64 " %10" PRIu64 " %10" PRIu64 " %s",
    311                      data->tasks[i].task_id, data->tasks[i].ipc_info.call_sent,
    312                      data->tasks[i].ipc_info.call_recieved,
    313                      data->tasks[i].ipc_info.answer_sent,
    314                      data->tasks[i].ipc_info.answer_recieved,
    315                      data->tasks[i].ipc_info.irq_notif_recieved,
    316                      data->tasks[i].ipc_info.forwarded, data->tasks[i].name);
     326                uint64_t call_sent;
     327                uint64_t call_received;
     328                uint64_t answer_sent;
     329                uint64_t answer_received;
     330                uint64_t irq_notif_received;
     331                uint64_t forwarded;
     332               
     333                char call_sent_suffix;
     334                char call_received_suffix;
     335                char answer_sent_suffix;
     336                char answer_received_suffix;
     337                char irq_notif_received_suffix;
     338                char forwarded_suffix;
     339               
     340                order_suffix(data->tasks[i].ipc_info.call_sent, &call_sent,
     341                    &call_sent_suffix);
     342                order_suffix(data->tasks[i].ipc_info.call_received,
     343                    &call_received, &call_received_suffix);
     344                order_suffix(data->tasks[i].ipc_info.answer_sent,
     345                    &answer_sent, &answer_sent_suffix);
     346                order_suffix(data->tasks[i].ipc_info.answer_received,
     347                    &answer_received, &answer_received_suffix);
     348                order_suffix(data->tasks[i].ipc_info.irq_notif_received,
     349                    &irq_notif_received, &irq_notif_received_suffix);
     350                order_suffix(data->tasks[i].ipc_info.forwarded, &forwarded,
     351                    &forwarded_suffix);
     352               
     353                printf("%-8" PRIu64 " %8" PRIu64 "%c %8" PRIu64 "%c"
     354                     " %8" PRIu64 "%c %8" PRIu64 "%c %8" PRIu64 "%c"
     355                     " %8" PRIu64 "%c ", data->tasks[i].task_id,
     356                     call_sent, call_sent_suffix,
     357                     call_received, call_received_suffix,
     358                     answer_sent, answer_sent_suffix,
     359                     answer_received, answer_received_suffix,
     360                     irq_notif_received, irq_notif_received_suffix,
     361                     forwarded, forwarded_suffix);
     362                print_string(data->tasks[i].name);
    317363               
    318364                screen_newline();
     
    328374{
    329375        screen_style_inverted();
    330         printf("  ID                     Desc    Count   Cycles");
     376        printf("[exc   ] [count   ] [%%count] [cycles  ] [%%cycles] [description");
    331377        screen_newline();
    332378        screen_style_normal();
     
    345391        size_t i;
    346392        for (i = 0; (i < data->exceptions_count) && (row < rows); i++, row++) {
     393                uint64_t count;
    347394                uint64_t cycles;
    348                 char suffix;
    349                
    350                 order_suffix(data->exceptions[i].cycles, &cycles, &suffix);
    351                 printf("%8u %20s %8" PRIu64 " %8" PRIu64 "%c",
    352                      data->exceptions[i].id, data->exceptions[i].desc,
    353                      data->exceptions[i].count, cycles, suffix);
     395               
     396                char count_suffix;
     397                char cycles_suffix;
     398               
     399                order_suffix(data->exceptions[i].count, &count, &count_suffix);
     400                order_suffix(data->exceptions[i].cycles, &cycles, &cycles_suffix);
     401               
     402                printf("%-8u %9" PRIu64 "%c  ",
     403                     data->exceptions[i].id, count, count_suffix);
     404                print_percent(data->exceptions_perc[i].count, 2);
     405                printf(" %9" PRIu64 "%c   ", cycles, cycles_suffix);
     406                print_percent(data->exceptions_perc[i].cycles, 2);
     407                puts(" ");
     408                print_string(data->exceptions[i].desc);
    354409               
    355410                screen_newline();
Note: See TracChangeset for help on using the changeset viewer.