Changeset 8eec3c8 in mainline for uspace/app/top


Ignore:
Timestamp:
2010-06-10T14:24:50Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c0f13d2
Parents:
1113c9e
Message:

merge basic exception accounting (this is the last piece missing from the original "measure" branch by Stanislav Kozina)

Location:
uspace/app/top
Files:
3 edited

Legend:

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

    r1113c9e r8eec3c8  
    325325}
    326326
     327static inline void print_exc_head(void)
     328{
     329        screen_style_inverted();
     330        printf("  ID                     Desc    Count   Cycles");
     331        screen_newline();
     332        screen_style_normal();
     333}
     334
     335static inline void print_exc(data_t *data)
     336{
     337        ipcarg_t cols;
     338        ipcarg_t rows;
     339        screen_get_size(&cols, &rows);
     340       
     341        ipcarg_t col;
     342        ipcarg_t row;
     343        screen_get_pos(&col, &row);
     344       
     345        size_t i;
     346        for (i = 0; (i < data->exceptions_count) && (row < rows); i++, row++) {
     347                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);
     354               
     355                screen_newline();
     356        }
     357       
     358        while (row < rows) {
     359                screen_newline();
     360                row++;
     361        }
     362}
     363
    327364void print_data(data_t *data)
    328365{
     
    338375        screen_newline();
    339376       
    340         if (operation_type == OP_IPC) {
     377        switch (operation_type) {
     378        case OP_TASKS:
     379                print_task_head();
     380                print_tasks(data);
     381                break;
     382        case OP_IPC:
    341383                print_ipc_head();
    342384                print_ipc(data);
    343         } else {
    344                 print_task_head();
    345                 print_tasks(data);
     385                break;
     386        case OP_EXC:
     387                print_exc_head();
     388                print_exc(data);
     389                break;
    346390        }
    347391       
  • uspace/app/top/top.c

    r1113c9e r8eec3c8  
    115115                return "Cannot get threads";
    116116       
     117        target->exceptions = stats_get_exceptions(&(target->exceptions_count));
     118        if (target->exceptions == NULL)
     119                return "Cannot get exceptions";
     120       
    117121        /* Get physical memory */
    118122        target->physmem = stats_get_physmem();
     
    231235        if (target->threads != NULL)
    232236                free(target->threads);
     237       
     238        if (target->exceptions != NULL)
     239                free(target->exceptions);
    233240       
    234241        if (target->physmem != NULL)
     
    285292                                operation_type = OP_TASKS;
    286293                                break;
     294                        case 'e':
     295                                print_warning("Showing exception statistics");
     296                                operation_type = OP_EXC;
     297                                break;
    287298                        default:
    288299                                print_warning("Unknown command: %c", c);
  • uspace/app/top/top.h

    r1113c9e r8eec3c8  
    4646#define OP_TASKS  1
    4747#define OP_IPC    2
     48#define OP_EXC    3
    4849
    4950extern int operation_type;
     
    8990        stats_thread_t *threads;
    9091       
     92        size_t exceptions_count;
     93        stats_exc_t *exceptions;
     94       
    9195        stats_physmem_t *physmem;
    9296} data_t;
Note: See TracChangeset for help on using the changeset viewer.