Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 7a3ccbc in mainline


Ignore:
Timestamp:
2010-04-07T10:41:42Z (12 years ago)
Author:
Stanislav Kozina <stanislav.kozina@…>
Branches:
lfn, master
Children:
a325832
Parents:
36b5b0f
Message:

Echo task memory in kb instead of pages count

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/ps/taskinfo.h

    r36b5b0f r7a3ccbc  
    4848        task_id_t taskid;
    4949        char name[TASK_NAME_BUFLEN];
    50         size_t pages;
     50        uint64_t virt_mem;
    5151        int thread_count;
    5252        uint64_t ucycles;
  • kernel/generic/src/ps/ps.c

    r36b5b0f r7a3ccbc  
    9090}
    9191
    92 static size_t get_pages_count(as_t *as)
     92static uint64_t get_task_memory(as_t *as)
    9393{
    9494        mutex_lock(&as->lock);
     
    115115        mutex_unlock(&as->lock);
    116116       
    117         return result;
     117        return result * PAGE_SIZE;
    118118}
    119119
     
    144144        copy_to_uspace(&uspace_info->kcycles, &kcycles, sizeof(uint64_t));
    145145
    146         size_t pages = get_pages_count(t->as);
    147         copy_to_uspace(&uspace_info->pages, &pages, sizeof(pages));
     146        uint64_t memory = get_task_memory(t->as);
     147        copy_to_uspace(&uspace_info->virt_mem, &memory, sizeof(memory));
    148148
    149149        int thread_count = atomic_get(&t->refcount);
  • uspace/app/ps/ps.c

    r36b5b0f r7a3ccbc  
    7676        }
    7777
    78         printf("      ID  Threads    Pages       uCycles       kCycles   Cycle fault Name\n");
     78        printf("      ID  Threads      Mem       uCycles       kCycles   Cycle fault Name\n");
    7979
    8080        int i;
     
    8282                task_info_t taskinfo;
    8383                get_task_info(tasks[i], &taskinfo);
    84                 uint64_t ucycles, kcycles;
    85                 char usuffix, ksuffix;
     84                uint64_t mem, ucycles, kcycles;
     85                char memsuffix, usuffix, ksuffix;
     86                order(taskinfo.virt_mem, &mem, &memsuffix);
    8687                order(taskinfo.ucycles, &ucycles, &usuffix);
    8788                order(taskinfo.kcycles, &kcycles, &ksuffix);
    88                 printf("%8llu %8u %8u %12llu%c %12llu%c %s\n", tasks[i],
    89                         taskinfo.thread_count, taskinfo.pages, ucycles, usuffix,
     89                printf("%8llu %8u %8llu%c %12llu%c %12llu%c %s\n", tasks[i],
     90                        taskinfo.thread_count, mem, memsuffix, ucycles, usuffix,
    9091                        kcycles, ksuffix, taskinfo.name);
    9192        }
  • uspace/app/top/screen.c

    r36b5b0f r7a3ccbc  
    155155                        return;
    156156                task_info_t *taskinfo = &data->taskinfos[i];
    157                 printf("%8llu %8u %8u ", taskinfo->taskid,
    158                         taskinfo->thread_count, taskinfo->pages);
     157                uint64_t mem;
     158                char suffix;
     159                order(taskinfo->virt_mem, &mem, &suffix);
     160                printf("%8llu %8u %8llu%c ", taskinfo->taskid,
     161                        taskinfo->thread_count, mem, suffix);
    159162                task_perc_t *taskperc = &data->task_perc[i];
    160163                puts("   ");
    161                 print_float(taskperc->pages, 2);
     164                print_float(taskperc->mem, 2);
    162165                puts("%   ");
    163166                print_float(taskperc->ucycles, 2);
     
    173176        fflush(stdout);
    174177        console_set_rgb_color(fphone(stdout), WHITE, BLACK);
    175         printf("      ID  Threads    Pages    %%Pages %%uCycles %%kCycles Name");
     178        printf("      ID  Threads      Mem      %%Mem %%uCycles %%kCycles Name");
    176179        int i;
    177180        for (i = 60; i < colls; ++i)
  • uspace/app/top/top.c

    r36b5b0f r7a3ccbc  
    111111
    112112        /* For all tasks compute sum and differencies of all cycles */
    113         uint64_t pages_total = 0;
     113        uint64_t mem_total = 0;
    114114        uint64_t ucycles_total = 0;
    115115        uint64_t kcycles_total = 0;
     
    131131                kcycles_diff[i] = new_data->taskinfos[i].kcycles - old_data->taskinfos[j].kcycles;
    132132
    133                 pages_total += new_data->taskinfos[i].pages;
     133                mem_total += new_data->taskinfos[i].virt_mem;
    134134                ucycles_total += ucycles_diff[i];
    135135                kcycles_total += kcycles_diff[i];
     
    139139        new_data->task_perc = malloc(new_data->task_count * sizeof(task_perc_t));
    140140        for (i = 0; i < new_data->task_count; ++i) {
    141                 new_data->task_perc[i].pages = (float)(new_data->taskinfos[i].pages * 100) / pages_total;
     141                new_data->task_perc[i].mem = (float)(new_data->taskinfos[i].virt_mem * 100) / mem_total;
    142142                new_data->task_perc[i].ucycles = (float)(ucycles_diff[i] * 100) / ucycles_total;
    143143                new_data->task_perc[i].kcycles = (float)(kcycles_diff[i] * 100) / kcycles_total;
  • uspace/app/top/top.h

    r36b5b0f r7a3ccbc  
    4646        float ucycles;
    4747        float kcycles;
    48         float pages;
     48        float mem;
    4949} task_perc_t;
    5050
Note: See TracChangeset for help on using the changeset viewer.