Changeset a2a00e8 in mainline for kernel/generic/src/proc/task.c


Ignore:
Timestamp:
2010-03-28T23:05:18Z (14 years ago)
Author:
Stanislav Kozina <stanislav.kozina@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
07640dfd
Parents:
34bba0e
Message:

Accounting separated to kernel and user time.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/task.c

    r34bba0e ra2a00e8  
    185185        ta->capabilities = 0;
    186186        ta->cycles = 0;
     187        ta->ucycles = 0;
     188        ta->kcycles = 0;
    187189
    188190#ifdef CONFIG_UDEBUG
     
    317319 *
    318320 * @param t             Pointer to thread.
    319  *
    320  * @return              Number of cycles used by the task and all its threads
    321  *                      so far.
    322  */
    323 uint64_t task_get_accounting(task_t *t)
    324 {
    325         /* Accumulated value of task */
     321 * @param ucycles       Out pointer to sum of all user cycles.
     322 * @param kcycles       Out pointer to sum of all kernel cycles.
     323 */
     324uint64_t task_get_accounting(task_t *t, uint64_t *ucycles, uint64_t *kcycles)
     325{
     326        /* Accumulated values of task */
    326327        uint64_t ret = t->cycles;
     328        uint64_t uret = t->ucycles;
     329        uint64_t kret = t->kcycles;
    327330       
    328331        /* Current values of threads */
     
    336339                        if (thr == THREAD) {
    337340                                /* Update accounting of current thread */
    338                                 thread_update_accounting();
     341                                thread_update_accounting(false);
    339342                        }
     343                        uret += thr->ucycles;
     344                        kret += thr->kcycles;
    340345                        ret += thr->cycles;
    341346                }
     
    343348        }
    344349       
     350        *ucycles = uret;
     351        *kcycles = kret;
     352
    345353        return ret;
    346354}
     
    410418                       
    411419        uint64_t cycles;
    412         char suffix;
    413         order(task_get_accounting(t), &cycles, &suffix);
     420        uint64_t ucycles;
     421        uint64_t kcycles;
     422        char suffix, usuffix, ksuffix;
     423        cycles = task_get_accounting(t, &ucycles, &kcycles);
     424        order(cycles, &cycles, &suffix);
     425        order(ucycles, &ucycles, &usuffix);
     426        order(kcycles, &kcycles, &ksuffix);
    414427
    415428#ifdef __32_BITS__     
    416         printf("%-6" PRIu64 " %-12s %-3" PRIu32 " %10p %10p %9" PRIu64
    417             "%c %7ld %6ld", t->taskid, t->name, t->context, t, t->as, cycles,
    418             suffix, atomic_get(&t->refcount), atomic_get(&t->active_calls));
     429        printf("%-6" PRIu64 " %-12s %-3" PRIu32 " %10p %10p %9" PRIu64 "%c %9" PRIu64 "%c %9"
     430                PRIu64 "%c %7ld %6ld", t->taskid, t->name, t->context, t, t->as, cycles, suffix,
     431                ucycles, usuffix, kcycles, ksuffix, atomic_get(&t->refcount),
     432                atomic_get(&t->active_calls));
    419433#endif
    420434
    421435#ifdef __64_BITS__
    422         printf("%-6" PRIu64 " %-12s %-3" PRIu32 " %18p %18p %9" PRIu64
    423             "%c %7ld %6ld", t->taskid, t->name, t->context, t, t->as, cycles,
    424             suffix, atomic_get(&t->refcount), atomic_get(&t->active_calls));
     436        printf("%-6" PRIu64 " %-12s %-3" PRIu32 " %18p %18p %9" PRIu64 "%c %9" PRIu64 "%c %9"
     437                PRIu64 "%c %7ld %6ld", t->taskid, t->name, t->context, t, t->as, cycles, suffix,
     438                ucycles, usuffix, kcycles, ksuffix, atomic_get(&t->refcount),
     439                atomic_get(&t->active_calls));
    425440#endif
    426441
     
    445460
    446461#ifdef __32_BITS__     
    447         printf("taskid name         ctx address    as         "
    448             "cycles     threads calls  callee\n");
    449         printf("------ ------------ --- ---------- ---------- "
    450             "---------- ------- ------ ------>\n");
     462        printf("taskid name         ctx address    as        "
     463            " cycles     ucycles    kcycles    threads calls  callee\n");
     464        printf("------ ------------ --- ---------- ----------"
     465            " ---------- ---------- ---------- ------- ------ ------>\n");
    451466#endif
    452467
    453468#ifdef __64_BITS__
    454         printf("taskid name         ctx address            as                 "
    455             "cycles     threads calls  callee\n");
    456         printf("------ ------------ --- ------------------ ------------------ "
    457             "---------- ------- ------ ------>\n");
     469        printf("taskid name         ctx address            as                "
     470            " cycles     ucycles    kcycles    threads calls  callee\n");
     471        printf("------ ------------ --- ------------------ ------------------"
     472            " ---------- ---------- ---------- ---------- ------- ------ ------>\n");
    458473#endif
    459474
Note: See TracChangeset for help on using the changeset viewer.