Changeset be06914 in mainline


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)

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/include/drivers/pl050/pl050.h

    r48dcc69 rbe06914  
    7272#define PL050_STAT_RXFULL       (1 << 4)        /* 1: register Full */
    7373#define PL050_STAT_RXBUSY       (1 << 3)        /* 1: Busy, recieving Data */
    74 #define PL050_STAT_RXPARITY     (1 << 2)        /* odd parity of the last bit recieved */
     74#define PL050_STAT_RXPARITY     (1 << 2)        /* odd parity of the last bit received */
    7575#define PL050_STAT_KMIC         (1 << 1)        /* status of KMICLKIN */
    7676#define PL050_STAT_KMID         1               /* status of KMIDATAIN */
  • kernel/generic/include/sysinfo/abi.h

    r48dcc69 rbe06914  
    9090typedef struct {
    9191        uint64_t call_sent;           /**< IPC calls sent */
    92         uint64_t call_recieved;       /**< IPC calls received */
     92        uint64_t call_received;       /**< IPC calls received */
    9393        uint64_t answer_sent;         /**< IPC answers sent */
    94         uint64_t answer_recieved;     /**< IPC answers received */
    95         uint64_t irq_notif_recieved;  /**< IPC IRQ notifications */
     94        uint64_t answer_received;     /**< IPC answers received */
     95        uint64_t irq_notif_received;  /**< IPC IRQ notifications */
    9696        uint64_t forwarded;           /**< IPC messages forwarded */
    9797} stats_ipc_t;
  • kernel/generic/src/ipc/ipc.c

    r48dcc69 rbe06914  
    442442        irq_spinlock_lock(&box->lock, true);
    443443        if (!list_empty(&box->irq_notifs)) {
    444                 /* Count recieved IRQ notification */
     444                /* Count received IRQ notification */
    445445                irq_cnt++;
    446446               
     
    452452                irq_spinlock_unlock(&box->irq_lock, false);
    453453        } else if (!list_empty(&box->answers)) {
    454                 /* Count recieved answer */
     454                /* Count received answer */
    455455                answer_cnt++;
    456456               
     
    460460                atomic_dec(&request->data.phone->active_calls);
    461461        } else if (!list_empty(&box->calls)) {
    462                 /* Count recieved call */
     462                /* Count received call */
    463463                call_cnt++;
    464464               
     
    477477        irq_spinlock_pass(&box->lock, &TASK->lock);
    478478       
    479         TASK->ipc_info.irq_notif_recieved += irq_cnt;
    480         TASK->ipc_info.answer_recieved += answer_cnt;
    481         TASK->ipc_info.call_recieved += call_cnt;
     479        TASK->ipc_info.irq_notif_received += irq_cnt;
     480        TASK->ipc_info.answer_received += answer_cnt;
     481        TASK->ipc_info.call_received += call_cnt;
    482482       
    483483        irq_spinlock_unlock(&TASK->lock, true);
  • kernel/generic/src/proc/task.c

    r48dcc69 rbe06914  
    197197       
    198198        task->ipc_info.call_sent = 0;
    199         task->ipc_info.call_recieved = 0;
     199        task->ipc_info.call_received = 0;
    200200        task->ipc_info.answer_sent = 0;
    201         task->ipc_info.answer_recieved = 0;
    202         task->ipc_info.irq_notif_recieved = 0;
     201        task->ipc_info.answer_received = 0;
     202        task->ipc_info.irq_notif_received = 0;
    203203        task->ipc_info.forwarded = 0;
    204204       
     
    478478#ifdef __32_BITS__
    479479        if (*additional)
    480                 printf("%-8" PRIu64 " %9ld %7ld", task->taskid,
     480                printf("%-8" PRIu64 " %9lu %7lu", task->taskid,
    481481                    atomic_get(&task->refcount), atomic_get(&task->active_calls));
    482482        else
     
    489489#ifdef __64_BITS__
    490490        if (*additional)
    491                 printf("%-8" PRIu64 " %9" PRIu64 "%c %9" PRIu64 "%c %9ld %7ld",
     491                printf("%-8" PRIu64 " %9" PRIu64 "%c %9" PRIu64 "%c %9lu %7lu",
    492492                    task->taskid, ucycles, usuffix, kcycles, ksuffix,
    493493                    atomic_get(&task->refcount), atomic_get(&task->active_calls));
     
    530530#ifdef __64_BITS__
    531531        if (additional)
    532                 printf("[taskid] [ucycles ] [kcycles ] [threads] [calls]"
     532                printf("[id    ] [ucycles ] [kcycles ] [threads] [calls]"
    533533                    " [callee\n");
    534534        else
    535                 printf("[taskid] [name        ] [ctx] [address         ]"
     535                printf("[id    ] [name        ] [ctx] [address         ]"
    536536                    " [as              ]\n");
    537537#endif
  • 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();
  • uspace/app/top/top.c

    r48dcc69 rbe06914  
    6767        target->tasks_perc = NULL;
    6868        target->threads = NULL;
     69        target->exceptions = NULL;
     70        target->exceptions_perc = NULL;
    6971        target->physmem = NULL;
    7072       
     
    115117                return "Cannot get threads";
    116118       
     119        /* Get Exceptions */
    117120        target->exceptions = stats_get_exceptions(&(target->exceptions_count));
    118121        if (target->exceptions == NULL)
    119122                return "Cannot get exceptions";
     123       
     124        target->exceptions_perc =
     125            (perc_exc_t *) calloc(target->exceptions_count, sizeof(perc_exc_t));
     126        if (target->exceptions_perc == NULL)
     127                return "Not enough memory for exception utilization";
    120128       
    121129        /* Get physical memory */
     
    137145        /* Allocate memory */
    138146       
    139         uint64_t *ucycles_diff = calloc(new_data->tasks_count, sizeof(uint64_t));
     147        uint64_t *ucycles_diff = calloc(new_data->tasks_count,
     148            sizeof(uint64_t));
    140149        if (ucycles_diff == NULL)
    141150                return "Not enough memory for user utilization";
    142151       
    143         uint64_t *kcycles_diff = calloc(new_data->tasks_count, sizeof(uint64_t));
     152        uint64_t *kcycles_diff = calloc(new_data->tasks_count,
     153            sizeof(uint64_t));
    144154        if (kcycles_diff == NULL) {
    145155                free(ucycles_diff);
    146156                return "Not enough memory for kernel utilization";
     157        }
     158       
     159        uint64_t *ecycles_diff = calloc(new_data->exceptions_count,
     160            sizeof(uint64_t));
     161        if (ecycles_diff == NULL) {
     162                free(ucycles_diff);
     163                free(kcycles_diff);
     164                return "Not enough memory for exception cycles utilization";
     165        }
     166       
     167        uint64_t *ecount_diff = calloc(new_data->exceptions_count,
     168            sizeof(uint64_t));
     169        if (ecount_diff == NULL) {
     170                free(ucycles_diff);
     171                free(kcycles_diff);
     172                free(ecycles_diff);
     173                return "Not enough memory for exception count utilization";
    147174        }
    148175       
     
    164191        /* For all tasks compute sum and differencies of all cycles */
    165192       
    166         uint64_t virtmem_total = 1;  /* Must NOT be zero */
    167         uint64_t ucycles_total = 1;  /* Must NOT be zero */
    168         uint64_t kcycles_total = 1;  /* Must NOT be zero */
     193        uint64_t virtmem_total = 0;
     194        uint64_t ucycles_total = 0;
     195        uint64_t kcycles_total = 0;
    169196       
    170197        for (i = 0; i < new_data->tasks_count; i++) {
     
    197224        }
    198225       
    199         /* For each task: Compute percential change */
     226        /* For each task compute percential change */
    200227       
    201228        for (i = 0; i < new_data->tasks_count; i++) {
     
    208235        }
    209236       
     237        /* For all exceptions compute sum and differencies of cycles */
     238       
     239        uint64_t ecycles_total = 0;
     240        uint64_t ecount_total = 0;
     241       
     242        for (i = 0; i < new_data->exceptions_count; i++) {
     243                /*
     244                 * March exception with the previous instance.
     245                 * This is quite paranoid since exceptions do not
     246                 * usually disappear, but it does not hurt.
     247                 */
     248               
     249                bool found = false;
     250                size_t j;
     251                for (j = 0; j < old_data->exceptions_count; j++) {
     252                        if (new_data->exceptions[i].id == old_data->exceptions[j].id) {
     253                                found = true;
     254                                break;
     255                        }
     256                }
     257               
     258                if (!found) {
     259                        /* This is a new exception, ignore it */
     260                        ecycles_diff[i] = 0;
     261                        ecount_diff[i] = 0;
     262                        continue;
     263                }
     264               
     265                ecycles_diff[i] =
     266                    new_data->exceptions[i].cycles - old_data->exceptions[j].cycles;
     267                ecount_diff[i] =
     268                    new_data->exceptions[i].count - old_data->exceptions[i].count;
     269               
     270                ecycles_total += ecycles_diff[i];
     271                ecount_total += ecount_diff[i];
     272        }
     273       
     274        /* For each exception compute percential change */
     275       
     276        for (i = 0; i < new_data->exceptions_count; i++) {
     277                FRACTION_TO_FLOAT(new_data->exceptions_perc[i].cycles,
     278                    ecycles_diff[i] * 100, ecycles_total);
     279                FRACTION_TO_FLOAT(new_data->exceptions_perc[i].count,
     280                    ecount_diff[i] * 100, ecount_total);
     281        }
     282       
    210283        /* Cleanup */
    211284       
    212285        free(ucycles_diff);
    213286        free(kcycles_diff);
     287        free(ecycles_diff);
     288        free(ecount_diff);
    214289       
    215290        return NULL;
     
    238313        if (target->exceptions != NULL)
    239314                free(target->exceptions);
     315       
     316        if (target->exceptions_perc != NULL)
     317                free(target->exceptions_perc);
    240318       
    241319        if (target->physmem != NULL)
  • uspace/app/top/top.h

    r48dcc69 rbe06914  
    3939#include <time.h>
    4040
    41 #define FRACTION_TO_FLOAT(float, a, b) { \
    42         (float).upper = (a); \
    43         (float).lower = (b); \
    44 }
     41#define FRACTION_TO_FLOAT(float, a, b) \
     42        { \
     43                if ((b) != 0) { \
     44                        (float).upper = (a); \
     45                        (float).lower = (b); \
     46                } else { \
     47                        (float).upper = 0; \
     48                        (float).lower = 1; \
     49                } \
     50        }
    4551
    4652#define OP_TASKS  1
     
    6167
    6268typedef struct {
     69        fixed_float virtmem;
    6370        fixed_float ucycles;
    6471        fixed_float kcycles;
    65         fixed_float virtmem;
    6672} perc_task_t;
     73
     74typedef struct {
     75        fixed_float cycles;
     76        fixed_float count;
     77} perc_exc_t;
    6778
    6879typedef struct {
     
    92103        size_t exceptions_count;
    93104        stats_exc_t *exceptions;
     105        perc_exc_t *exceptions_perc;
    94106       
    95107        stats_physmem_t *physmem;
Note: See TracChangeset for help on using the changeset viewer.