Changeset ea55bc4 in mainline


Ignore:
Timestamp:
2010-03-29T16:44:12Z (15 years ago)
Author:
Stanislav Kozina <stanislav.kozina@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3a10e34
Parents:
07640dfd
Message:

cycles count echoing with suffixes

Location:
uspace/app/ps
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/ps/Makefile

    r07640dfd rea55bc4  
    3232
    3333SOURCES = \
    34         ps.c
     34        ps.c \
     35        func.c
    3536
    3637include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/ps/ps.c

    r07640dfd rea55bc4  
    4141#include <errno.h>
    4242#include <stdlib.h>
    43 /* #include <string.h> */
    4443#include <malloc.h>
     44
     45#include "func.h"
    4546
    4647#define TASK_COUNT 10
     
    7071        }
    7172
    72         printf("      ID  Threads    Pages   [k]uCycles   [k]kCycles  Cycle fault Name\n");
     73        printf("      ID  Threads    Pages       uCycles       kCycles   Cycle fault Name\n");
    7374
    7475        int i;
     
    7677                task_info_t taskinfo;
    7778                get_task_info(tasks[i], &taskinfo);
    78                 printf("%8llu %8u %8u %12llu %12llu %12llu %s\n", tasks[i],
    79                                 taskinfo.thread_count, taskinfo.pages, taskinfo.ucycles / 1000,
    80                                 taskinfo.kcycles / 1000, (taskinfo.ucycles + taskinfo.kcycles) -
    81                                 taskinfo.cycles, taskinfo.name);
     79                uint64_t ucycles, kcycles, fault;
     80                char usuffix, ksuffix, fsuffix;
     81                order(taskinfo.ucycles, &ucycles, &usuffix);
     82                order(taskinfo.kcycles, &kcycles, &ksuffix);
     83                order((taskinfo.kcycles + taskinfo.ucycles) - taskinfo.cycles, &fault, &fsuffix);
     84                printf("%8llu %8u %8u %12llu%c %12llu%c %12llu%c %s\n", tasks[i],
     85                        taskinfo.thread_count, taskinfo.pages, ucycles, usuffix,
     86                        kcycles, ksuffix, fault, fsuffix, taskinfo.name);
    8287        }
    8388}
     
    101106
    102107        int i;
    103         printf("    ID    State  CPU   Prio   [k]uCycles   [k]kcycles  Cycle fault\n");
     108        printf("    ID    State  CPU   Prio    [k]uCycles    [k]kcycles   Cycle fault\n");
    104109        for (i = 0; i < result; ++i) {
    105                 printf("%6llu %-8s %4u %6d %12llu %12llu %12llu\n", threads[i].tid,
     110                uint64_t ucycles, kcycles, fault;
     111                char usuffix, ksuffix, fsuffix;
     112                order(threads[i].ucycles, &ucycles, &usuffix);
     113                order(threads[i].kcycles, &kcycles, &ksuffix);
     114                order((threads[i].kcycles + threads[i].ucycles) - threads[i].cycles, &fault, &fsuffix);
     115                printf("%6llu %-8s %4u %6d %12llu%c %12llu%c %12llu%c\n", threads[i].tid,
    106116                        thread_states[threads[i].state], threads[i].cpu,
    107                         threads[i].priority, threads[i].ucycles / 1000,
    108                         threads[i].kcycles / 1000,
    109                         threads[i].ucycles + threads[i].kcycles - threads[i].cycles);
     117                        threads[i].priority, ucycles, usuffix,
     118                        kcycles, ksuffix, fault, fsuffix);
    110119        }
    111120}
Note: See TracChangeset for help on using the changeset viewer.