Changeset bdfd3c97 in mainline


Ignore:
Timestamp:
2010-04-14T15:40:52Z (14 years ago)
Author:
Stanislav Kozina <stanislav.kozina@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
95319bd
Parents:
a307beb
Message:

Press 'i' in top and you can see IPC statistics.

Location:
uspace/app/top
Files:
3 edited

Legend:

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

    ra307beb rbdfd3c97  
    204204}
    205205
    206 static inline void print_head(void)
     206static inline void print_task_head(void)
    207207{
    208208        fflush(stdout);
     
    214214        fflush(stdout);
    215215        console_set_rgb_color(fphone(stdout), BLACK, WHITE);
     216}
     217
     218static inline void print_ipc_head(void)
     219{
     220        fflush(stdout);
     221        console_set_rgb_color(fphone(stdout), WHITE, BLACK);
     222        printf("      ID Calls sent Calls recv Answs sent Answs recv  IRQn recv       Forw Name");
     223        int i;
     224        for (i = 80; i < colls; ++i)
     225                puts(" ");
     226        fflush(stdout);
     227        console_set_rgb_color(fphone(stdout), BLACK, WHITE);
     228}
     229
     230static inline void print_ipc(data_t *data, int row)
     231{
     232        int i;
     233        for (i = 0; i < (int)data->task_count; ++i) {
     234                if (row + i > rows)
     235                        return;
     236                task_info_t *taskinfo = &data->taskinfos[i];
     237                task_ipc_info_t *ipcinfo = &taskinfo->ipc_info;
     238                printf("%8llu ", taskinfo->taskid);
     239                printf("%10llu %10llu %10llu %10llu %10llu %10llu ",
     240                                ipcinfo->call_sent, ipcinfo->call_recieved,
     241                                ipcinfo->answer_sent, ipcinfo->answer_recieved,
     242                                ipcinfo->irq_notif_recieved, ipcinfo->forwarded);
     243                printf("%s\n", taskinfo->name);
     244        }
    216245}
    217246
     
    238267        puts("\n");
    239268        ++up_rows;
    240         print_head();
    241         puts("\n");
    242         print_tasks(data, up_rows);
     269        if (operation_type == OP_IPC) {
     270                print_ipc_head();
     271                puts("\n");
     272                print_ipc(data, up_rows);
     273        } else {
     274                print_task_head();
     275                puts("\n");
     276                print_tasks(data, up_rows);
     277        }
    243278        fflush(stdout);
    244279}
  • uspace/app/top/top.c

    ra307beb rbdfd3c97  
    5656#define MINUTE 60
    5757
    58 int number = 0;
    59 int number2 = 0;
     58int operation_type;
     59
    6060static void read_data(data_t *target)
    6161{
     
    188188
    189189        /* And paint screen until death... */
     190        operation_type = OP_TASKS;
    190191        while (true) {
    191192                char c = tgetchar(UPDATE_INTERVAL);
     
    202203                                clear_screen();
    203204                                return 0;
     205                        case 'i':
     206                                PRINT_WARNING("Showing IPC statistics", c);
     207                                operation_type = OP_IPC;
     208                                break;
     209                        case 't':
     210                                PRINT_WARNING("Showing task stats", c);
     211                                operation_type = OP_TASKS;
     212                                break;
    204213                        default:
    205214                                PRINT_WARNING("Unknown command: %c", c);
  • uspace/app/top/top.h

    ra307beb rbdfd3c97  
    4242        (float).lower = (b); \
    4343}
     44
     45#define OP_TASKS 1
     46#define OP_IPC 2
     47extern int operation_type;
    4448
    4549typedef struct {
Note: See TracChangeset for help on using the changeset viewer.