Changeset 1ba37fa in mainline


Ignore:
Timestamp:
2010-04-06T11:53:32Z (15 years ago)
Author:
Stanislav Kozina <stanislav.kozina@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
516adce
Parents:
f0dcdc5
Message:

Removed useless cycles sum, using ucycles + kcycles instead.

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/proc/task.h

    rf0dcdc5 r1ba37fa  
    122122       
    123123        /** Accumulated accounting. */
    124         uint64_t cycles;
    125124        uint64_t ucycles;
    126125        uint64_t kcycles;
     
    136135extern task_t *task_find_by_id(task_id_t id);
    137136extern int task_kill(task_id_t id);
    138 extern uint64_t task_get_accounting(task_t *t, uint64_t *ucycles, uint64_t *kcycles);
     137extern void task_get_accounting(task_t *t, uint64_t *ucycles, uint64_t *kcycles);
    139138extern void task_print_list(void);
    140139
  • kernel/generic/include/proc/thread.h

    rf0dcdc5 r1ba37fa  
    174174       
    175175        /** Thread accounting. */
    176         uint64_t cycles;
    177176        uint64_t ucycles;
    178177        uint64_t kcycles;
  • kernel/generic/include/ps/taskinfo.h

    rf0dcdc5 r1ba37fa  
    5050        size_t pages;
    5151        int thread_count;
    52         uint64_t cycles;
    5352        uint64_t ucycles;
    5453        uint64_t kcycles;
  • kernel/generic/src/console/cmd.c

    rf0dcdc5 r1ba37fa  
    10271027        ipl_t ipl = interrupts_disable();
    10281028        spinlock_lock(&TASK->lock);
    1029         uint64_t ucycles, kcycles;
    1030         uint64_t t0 = task_get_accounting(TASK, &ucycles, &kcycles);
     1029        uint64_t ucycles0, kcycles0;
     1030        task_get_accounting(TASK, &ucycles0, &kcycles0);
    10311031        spinlock_unlock(&TASK->lock);
    10321032        interrupts_restore(ipl);
     
    10371037       
    10381038        /* Update and read thread accounting */
     1039        uint64_t ucycles1, kcycles1;
    10391040        ipl = interrupts_disable();
    10401041        spinlock_lock(&TASK->lock);
    1041         uint64_t dt = task_get_accounting(TASK, &ucycles, &kcycles) - t0;
     1042        task_get_accounting(TASK, &ucycles1, &kcycles1);
    10421043        spinlock_unlock(&TASK->lock);
    10431044        interrupts_restore(ipl);
    10441045       
    1045         uint64_t cycles;
    1046         char suffix;
    1047         order(dt, &cycles, &suffix);
    1048                
    1049         printf("Time: %" PRIu64 "%c cycles\n", cycles, suffix);
     1046        uint64_t ucycles, kcycles;
     1047        char usuffix, ksuffix;
     1048        order(ucycles1 - ucycles0, &ucycles, &usuffix);
     1049        order(kcycles1 - kcycles0, &kcycles, &ksuffix);
     1050               
     1051        printf("Time: %" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles\n",
     1052                        ucycles, usuffix, kcycles, ksuffix);
    10501053       
    10511054        if (ret == NULL) {
     
    10621065        uint32_t i;
    10631066        bool ret = true;
    1064         uint64_t cycles;
    1065         char suffix;
     1067        uint64_t ucycles, kcycles;
     1068        char usuffix, ksuffix;
    10661069       
    10671070        if (cnt < 1)
     
    10811084                ipl_t ipl = interrupts_disable();
    10821085                spinlock_lock(&TASK->lock);
    1083                 uint64_t ucycles, kcycles;
    1084                 uint64_t t0 = task_get_accounting(TASK, &ucycles, &kcycles);
     1086                uint64_t ucycles0, kcycles0;
     1087                task_get_accounting(TASK, &ucycles0, &kcycles0);
    10851088                spinlock_unlock(&TASK->lock);
    10861089                interrupts_restore(ipl);
     
    10931096                ipl = interrupts_disable();
    10941097                spinlock_lock(&TASK->lock);
    1095                 uint64_t dt = task_get_accounting(TASK, &ucycles, &kcycles) - t0;
     1098                uint64_t ucycles1, kcycles1;
     1099                task_get_accounting(TASK, &ucycles1, &kcycles1);
    10961100                spinlock_unlock(&TASK->lock);
    10971101                interrupts_restore(ipl);
    1098                
     1102
    10991103                if (ret != NULL) {
    11001104                        printf("%s\n", ret);
     
    11031107                }
    11041108               
    1105                 data[i] = dt;
    1106                 order(dt, &cycles, &suffix);
    1107                 printf("OK (%" PRIu64 "%c cycles)\n", cycles, suffix);
     1109                data[i] = ucycles1 - ucycles0 + kcycles1 - kcycles0;
     1110                order(ucycles1 - ucycles0, &ucycles, &usuffix);
     1111                order(kcycles1 - kcycles0, &kcycles, &ksuffix);
     1112                printf("OK (%" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles)\n",
     1113                                ucycles, usuffix, kcycles, ksuffix);
    11081114        }
    11091115       
     
    11171123                }
    11181124               
    1119                 order(sum / (uint64_t) cnt, &cycles, &suffix);
    1120                 printf("Average\t\t%" PRIu64 "%c\n", cycles, suffix);
     1125                order(sum / (uint64_t) cnt, &ucycles, &usuffix);
     1126                printf("Average\t\t%" PRIu64 "%c\n", ucycles, usuffix);
    11211127        }
    11221128       
  • kernel/generic/src/proc/scheduler.c

    rf0dcdc5 r1ba37fa  
    316316                spinlock_lock(&THREAD->lock);
    317317               
    318                 /* Update thread accounting */
    319                 THREAD->cycles += get_cycle() - THREAD->last_cycle;
     318                /* Update thread kernel accounting */
    320319                THREAD->kcycles += get_cycle() - THREAD->last_cycle;
    321320               
  • kernel/generic/src/proc/task.c

    rf0dcdc5 r1ba37fa  
    184184        ta->context = CONTEXT;
    185185        ta->capabilities = 0;
    186         ta->cycles = 0;
    187186        ta->ucycles = 0;
    188187        ta->kcycles = 0;
     
    322321 * @param kcycles       Out pointer to sum of all kernel cycles.
    323322 */
    324 uint64_t task_get_accounting(task_t *t, uint64_t *ucycles, uint64_t *kcycles)
     323void task_get_accounting(task_t *t, uint64_t *ucycles, uint64_t *kcycles)
    325324{
    326325        /* Accumulated values of task */
    327         uint64_t ret = t->cycles;
    328326        uint64_t uret = t->ucycles;
    329327        uint64_t kret = t->kcycles;
     
    343341                        uret += thr->ucycles;
    344342                        kret += thr->kcycles;
    345                         ret += thr->cycles;
    346343                }
    347344                spinlock_unlock(&thr->lock);
     
    350347        *ucycles = uret;
    351348        *kcycles = kret;
    352 
    353         return ret;
    354349}
    355350
     
    417412        spinlock_lock(&t->lock);
    418413                       
    419         uint64_t cycles;
    420414        uint64_t ucycles;
    421415        uint64_t kcycles;
    422         char suffix, usuffix, ksuffix;
    423         cycles = task_get_accounting(t, &ucycles, &kcycles);
    424         order(cycles, &cycles, &suffix);
     416        char usuffix, ksuffix;
     417        task_get_accounting(t, &ucycles, &kcycles);
    425418        order(ucycles, &ucycles, &usuffix);
    426419        order(kcycles, &kcycles, &ksuffix);
  • kernel/generic/src/proc/thread.c

    rf0dcdc5 r1ba37fa  
    133133        if (!THREAD->uncounted) {
    134134                thread_update_accounting(true);
    135                 uint64_t cycles = THREAD->cycles;
    136                 THREAD->cycles = 0;
    137135                uint64_t ucycles = THREAD->ucycles;
    138136                THREAD->ucycles = 0;
     
    143141               
    144142                spinlock_lock(&TASK->lock);
    145                 TASK->cycles += cycles;
    146143                TASK->ucycles += ucycles;
    147144                TASK->kcycles += kcycles;
     
    330327        t->thread_arg = arg;
    331328        t->ticks = -1;
    332         t->cycles = 0;
    333329        t->ucycles = 0;
    334330        t->kcycles = 0;
     
    623619        thread_t *t = avltree_get_instance(node, thread_t, threads_tree_node);
    624620       
    625         uint64_t cycles, ucycles, kcycles;
    626         char suffix, usuffix, ksuffix;
    627         order(t->cycles, &cycles, &suffix);
     621        uint64_t ucycles, kcycles;
     622        char usuffix, ksuffix;
    628623        order(t->ucycles, &ucycles, &usuffix);
    629624        order(t->kcycles, &kcycles, &ksuffix);
     
    724719{
    725720        uint64_t time = get_cycle();
    726         THREAD->cycles += time - THREAD->last_cycle;
    727721        if (user) {
    728722                THREAD->ucycles += time - THREAD->last_cycle;
  • kernel/generic/src/ps/ps.c

    rf0dcdc5 r1ba37fa  
    140140        uint64_t ucycles;
    141141        uint64_t kcycles;
    142         uint64_t cycles = task_get_accounting(t, &ucycles, &kcycles);
    143         copy_to_uspace(&uspace_info->cycles, &cycles, sizeof(cycles));
    144         copy_to_uspace(&uspace_info->ucycles, &ucycles, sizeof(cycles));
    145         copy_to_uspace(&uspace_info->kcycles, &kcycles, sizeof(cycles));
     142        task_get_accounting(t, &ucycles, &kcycles);
     143        copy_to_uspace(&uspace_info->ucycles, &ucycles, sizeof(uint64_t));
     144        copy_to_uspace(&uspace_info->kcycles, &kcycles, sizeof(uint64_t));
    146145
    147146        size_t pages = get_pages_count(t->as);
     
    178177        result.state = t->state;
    179178        result.priority = t->priority;
    180         result.cycles = t->cycles;
    181179        result.ucycles = t->ucycles;
    182180        result.kcycles = t->kcycles;
  • uspace/app/ps/ps.c

    rf0dcdc5 r1ba37fa  
    8282                task_info_t taskinfo;
    8383                get_task_info(tasks[i], &taskinfo);
    84                 uint64_t ucycles, kcycles, fault;
    85                 char usuffix, ksuffix, fsuffix;
     84                uint64_t ucycles, kcycles;
     85                char usuffix, ksuffix;
    8686                order(taskinfo.ucycles, &ucycles, &usuffix);
    8787                order(taskinfo.kcycles, &kcycles, &ksuffix);
    88                 order((taskinfo.kcycles + taskinfo.ucycles) - taskinfo.cycles, &fault, &fsuffix);
    89                 printf("%8llu %8u %8u %12llu%c %12llu%c %12llu%c %s\n", tasks[i],
     88                printf("%8llu %8u %8u %12llu%c %12llu%c %s\n", tasks[i],
    9089                        taskinfo.thread_count, taskinfo.pages, ucycles, usuffix,
    91                         kcycles, ksuffix, fault, fsuffix, taskinfo.name);
     90                        kcycles, ksuffix, taskinfo.name);
    9291        }
    9392
     
    115114        printf("    ID    State  CPU   Prio    [k]uCycles    [k]kcycles   Cycle fault\n");
    116115        for (i = 0; i < result; ++i) {
    117                 uint64_t ucycles, kcycles, fault;
    118                 char usuffix, ksuffix, fsuffix;
     116                uint64_t ucycles, kcycles;
     117                char usuffix, ksuffix;
    119118                order(threads[i].ucycles, &ucycles, &usuffix);
    120119                order(threads[i].kcycles, &kcycles, &ksuffix);
    121                 order((threads[i].kcycles + threads[i].ucycles) - threads[i].cycles, &fault, &fsuffix);
    122                 printf("%6llu %-8s %4u %6d %12llu%c %12llu%c %12llu%c\n", threads[i].tid,
     120                printf("%6llu %-8s %4u %6d %12llu%c %12llu%c\n", threads[i].tid,
    123121                        thread_states[threads[i].state], threads[i].cpu,
    124122                        threads[i].priority, ucycles, usuffix,
    125                         kcycles, ksuffix, fault, fsuffix);
     123                        kcycles, ksuffix);
    126124        }
    127125
Note: See TracChangeset for help on using the changeset viewer.