Changeset 9f0318c in mainline for uspace


Ignore:
Timestamp:
2011-01-26T14:54:24Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
95622c4
Parents:
ba54451 (diff), 6265a2b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge development/ changes

Location:
uspace
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tasks/tasks.c

    rba54451 r9f0318c  
    6666        }
    6767       
    68         printf("     ID  Threads      Mem       uCycles       kCycles   Name\n");
     68        printf(" Task ID  Threads      Mem       uCycles       kCycles   Name\n");
    6969       
    7070        size_t i;
     
    9696        }
    9797       
    98         printf("    ID    State  CPU   Prio    [k]uCycles    [k]kcycles   Cycle fault\n");
     98        printf(" ThrID    State  CPU   Prio    [k]uCycles    [k]kcycles   Cycle fault\n");
    9999        size_t i;
    100100        for (i = 0; i < count; i++) {
  • uspace/app/top/screen.c

    rba54451 r9f0318c  
    274274{
    275275        screen_style_inverted();
    276         printf("[taskid] [threads] [virtual] [%%virt] [%%user]"
    277             " [%%kernel] [name");
     276        printf("[taskid] [threads] [resident] [%%resi] [virtual] [%%virt]"
     277            " [%%user] [%%kern] [name");
    278278        screen_newline();
    279279        screen_style_normal();
     
    295295                perc_task_t *perc = data->tasks_perc + data->tasks_map[i];
    296296               
     297                uint64_t resmem;
     298                char resmem_suffix;
     299                order_suffix(task->resmem, &resmem, &resmem_suffix);
     300               
    297301                uint64_t virtmem;
    298302                char virtmem_suffix;
    299303                order_suffix(task->virtmem, &virtmem, &virtmem_suffix);
    300304               
    301                 printf("%-8" PRIu64 " %9zu %8" PRIu64 "%c ", task->task_id,
    302                     task->threads, virtmem, virtmem_suffix);
     305                printf("%-8" PRIu64 " %9zu %9" PRIu64 "%c ",
     306                    task->task_id, task->threads, resmem, resmem_suffix);
     307                print_percent(perc->resmem, 2);
     308                printf(" %8" PRIu64 "%c ", virtmem, virtmem_suffix);
    303309                print_percent(perc->virtmem, 2);
    304310                puts(" ");
    305311                print_percent(perc->ucycles, 2);
    306                 puts("   ");
     312                puts(" ");
    307313                print_percent(perc->kcycles, 2);
    308314                puts(" ");
  • uspace/app/top/top.c

    rba54451 r9f0318c  
    195195       
    196196        uint64_t virtmem_total = 0;
     197        uint64_t resmem_total = 0;
    197198        uint64_t ucycles_total = 0;
    198199        uint64_t kcycles_total = 0;
     
    223224               
    224225                virtmem_total += new_data->tasks[i].virtmem;
     226                resmem_total += new_data->tasks[i].resmem;
    225227                ucycles_total += new_data->ucycles_diff[i];
    226228                kcycles_total += new_data->kcycles_diff[i];
     
    232234                FRACTION_TO_FLOAT(new_data->tasks_perc[i].virtmem,
    233235                    new_data->tasks[i].virtmem * 100, virtmem_total);
     236                FRACTION_TO_FLOAT(new_data->tasks_perc[i].resmem,
     237                    new_data->tasks[i].resmem * 100, resmem_total);
    234238                FRACTION_TO_FLOAT(new_data->tasks_perc[i].ucycles,
    235239                    new_data->ucycles_diff[i] * 100, ucycles_total);
  • uspace/app/top/top.h

    rba54451 r9f0318c  
    7777typedef struct {
    7878        fixed_float virtmem;
     79        fixed_float resmem;
    7980        fixed_float ucycles;
    8081        fixed_float kcycles;
  • uspace/app/trace/syscalls.c

    rba54451 r9f0318c  
    7777    [SYS_SYSINFO_GET_VALUE] = { "sysinfo_get_value",            3,      V_ERRNO },
    7878    [SYS_SYSINFO_GET_DATA_SIZE] = { "sysinfo_get_data_size",    3,      V_ERRNO },
    79     [SYS_SYSINFO_GET_DATA] = { "sysinfo_get_data",              4,      V_ERRNO },
     79    [SYS_SYSINFO_GET_DATA] = { "sysinfo_get_data",              5,      V_ERRNO },
    8080
    8181    [SYS_DEBUG_ENABLE_CONSOLE] = { "debug_enable_console", 0,   V_ERRNO },
  • uspace/lib/c/generic/stats.c

    rba54451 r9f0318c  
    3636#include <stats.h>
    3737#include <sysinfo.h>
    38 #include <assert.h>
    3938#include <errno.h>
    4039#include <stdio.h>
    4140#include <inttypes.h>
     41#include <malloc.h>
    4242
    4343#define SYSINFO_STATS_MAX_PATH  64
     
    7171            (stats_cpu_t *) sysinfo_get_data("system.cpus", &size);
    7272       
    73         assert((size % sizeof(stats_cpu_t)) == 0);
     73        if ((size % sizeof(stats_cpu_t)) != 0) {
     74                if (stats_cpus != NULL)
     75                        free(stats_cpus);
     76                *count = 0;
     77                return NULL;
     78        }
    7479       
    7580        *count = size / sizeof(stats_cpu_t);
     
    9196            (stats_physmem_t *) sysinfo_get_data("system.physmem", &size);
    9297       
    93         assert((size == sizeof(stats_physmem_t)) || (size == 0));
     98        if (size != sizeof(stats_physmem_t)) {
     99                if (stats_physmem != NULL)
     100                        free(stats_physmem);
     101                return NULL;
     102        }
    94103       
    95104        return stats_physmem;
     
    111120            (stats_task_t *) sysinfo_get_data("system.tasks", &size);
    112121       
    113         assert((size % sizeof(stats_task_t)) == 0);
     122        if ((size % sizeof(stats_task_t)) != 0) {
     123                if (stats_tasks != NULL)
     124                        free(stats_tasks);
     125                *count = 0;
     126                return NULL;
     127        }
    114128       
    115129        *count = size / sizeof(stats_task_t);
     
    135149            (stats_task_t *) sysinfo_get_data(name, &size);
    136150       
    137         assert((size == sizeof(stats_task_t)) || (size == 0));
     151        if (size != sizeof(stats_task_t)) {
     152                if (stats_task != NULL)
     153                        free(stats_task);
     154                return NULL;
     155        }
    138156       
    139157        return stats_task;
     
    155173            (stats_thread_t *) sysinfo_get_data("system.threads", &size);
    156174       
    157         assert((size % sizeof(stats_thread_t)) == 0);
     175        if ((size % sizeof(stats_thread_t)) != 0) {
     176                if (stats_threads != NULL)
     177                        free(stats_threads);
     178                *count = 0;
     179                return NULL;
     180        }
    158181       
    159182        *count = size / sizeof(stats_thread_t);
     
    179202            (stats_thread_t *) sysinfo_get_data(name, &size);
    180203       
    181         assert((size == sizeof(stats_thread_t)) || (size == 0));
     204        if (size != sizeof(stats_thread_t)) {
     205                if (stats_thread != NULL)
     206                        free(stats_thread);
     207                return NULL;
     208        }
    182209       
    183210        return stats_thread;
     
    199226            (stats_exc_t *) sysinfo_get_data("system.exceptions", &size);
    200227       
    201         assert((size % sizeof(stats_exc_t)) == 0);
     228        if ((size % sizeof(stats_exc_t)) != 0) {
     229                if (stats_exceptions != NULL)
     230                        free(stats_exceptions);
     231                *count = 0;
     232                return NULL;
     233        }
    202234       
    203235        *count = size / sizeof(stats_exc_t);
     
    217249{
    218250        char name[SYSINFO_STATS_MAX_PATH];
    219         snprintf(name, SYSINFO_STATS_MAX_PATH, "system.exceptionss.%u", excn);
     251        snprintf(name, SYSINFO_STATS_MAX_PATH, "system.exceptions.%u", excn);
    220252       
    221253        size_t size = 0;
     
    223255            (stats_exc_t *) sysinfo_get_data(name, &size);
    224256       
    225         assert((size == sizeof(stats_exc_t)) || (size == 0));
     257        if (size != sizeof(stats_exc_t)) {
     258                if (stats_exception != NULL)
     259                        free(stats_exception);
     260                return NULL;
     261        }
    226262       
    227263        return stats_exception;
     
    243279            (load_t *) sysinfo_get_data("system.load", &size);
    244280       
    245         assert((size % sizeof(load_t)) == 0);
     281        if ((size % sizeof(load_t)) != 0) {
     282                if (load != NULL)
     283                        free(load);
     284                *count = 0;
     285                return NULL;
     286        }
    246287       
    247288        *count = size / sizeof(load_t);
  • uspace/lib/c/generic/sysinfo.c

    rba54451 r9f0318c  
    9696void *sysinfo_get_data(const char *path, size_t *size)
    9797{
    98         /* The binary data size might change during time.
    99            Unfortunatelly we cannot allocate the buffer
    100            and transfer the data as a single atomic operation.
     98        /*
     99         * The binary data size might change during time.
     100         * Unfortunatelly we cannot allocate the buffer
     101         * and transfer the data as a single atomic operation.
     102         */
    101103       
    102            Let's hope that the number of iterations is bounded
    103            in common cases. */
    104        
    105         void *data = NULL;
    106        
    107         while (true) {
    108                 /* Get the binary data size */
    109                 int ret = sysinfo_get_data_size(path, size);
    110                 if ((ret != EOK) || (size == 0)) {
    111                         /* Not a binary data item
    112                            or an empty item */
    113                         break;
    114                 }
    115                
    116                 data = realloc(data, *size);
    117                 if (data == NULL)
    118                         break;
    119                
    120                 /* Get the data */
    121                 ret = __SYSCALL4(SYS_SYSINFO_GET_DATA, (sysarg_t) path,
    122                     (sysarg_t) str_size(path), (sysarg_t) data, (sysarg_t) *size);
    123                 if (ret == EOK)
    124                         return data;
    125                
    126                 if (ret != ENOMEM) {
    127                         /* The failure to get the data was not caused
    128                            by wrong buffer size */
    129                         break;
    130                 }
     104        /* Get the binary data size */
     105        int ret = sysinfo_get_data_size(path, size);
     106        if ((ret != EOK) || (size == 0)) {
     107                /*
     108                 * Not a binary data item
     109                 * or an empty item.
     110                 */
     111                *size = 0;
     112                return NULL;
    131113        }
    132114       
    133         if (data != NULL)
    134                 free(data);
     115        void *data = malloc(*size);
     116        if (data == NULL) {
     117                *size = 0;
     118                return NULL;
     119        }
    135120       
     121        /* Get the data */
     122        size_t sz;
     123        ret = __SYSCALL5(SYS_SYSINFO_GET_DATA, (sysarg_t) path,
     124            (sysarg_t) str_size(path), (sysarg_t) data, (sysarg_t) *size,
     125            (sysarg_t) &sz);
     126        if (ret == EOK) {
     127                *size = sz;
     128                return data;
     129        }
     130       
     131        free(data);
    136132        *size = 0;
    137133        return NULL;
  • uspace/lib/usb/Makefile

    rba54451 r9f0318c  
    4747        src/usb.c \
    4848        src/usbdrvreq.c \
    49         src/usbdrv.c
     49        src/usbdrv.c \
     50        src/usbmem.c
    5051
    5152include $(USPACE_PREFIX)/Makefile.common
Note: See TracChangeset for help on using the changeset viewer.