Ignore:
File:
1 edited

Legend:

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

    r1ba37fa r137691a  
    132132        spinlock_lock(&THREAD->lock);
    133133        if (!THREAD->uncounted) {
    134                 thread_update_accounting(true);
    135                 uint64_t ucycles = THREAD->ucycles;
    136                 THREAD->ucycles = 0;
    137                 uint64_t kcycles = THREAD->kcycles;
    138                 THREAD->kcycles = 0;
    139 
     134                thread_update_accounting();
     135                uint64_t cycles = THREAD->cycles;
     136                THREAD->cycles = 0;
    140137                spinlock_unlock(&THREAD->lock);
    141138               
    142139                spinlock_lock(&TASK->lock);
    143                 TASK->ucycles += ucycles;
    144                 TASK->kcycles += kcycles;
     140                TASK->cycles += cycles;
    145141                spinlock_unlock(&TASK->lock);
    146142        } else
     
    327323        t->thread_arg = arg;
    328324        t->ticks = -1;
    329         t->ucycles = 0;
    330         t->kcycles = 0;
     325        t->cycles = 0;
    331326        t->uncounted = uncounted;
    332327        t->priority = -1;               /* start in rq[0] */
     
    619614        thread_t *t = avltree_get_instance(node, thread_t, threads_tree_node);
    620615       
    621         uint64_t ucycles, kcycles;
    622         char usuffix, ksuffix;
    623         order(t->ucycles, &ucycles, &usuffix);
    624         order(t->kcycles, &kcycles, &ksuffix);
     616        uint64_t cycles;
     617        char suffix;
     618        order(t->cycles, &cycles, &suffix);
    625619
    626620#ifdef __32_BITS__
    627         printf("%-6" PRIu64" %-10s %10p %-8s %10p %-3" PRIu32 " %10p %10p %9"
    628                 PRIu64 "%c %9" PRIu64 "%c ", t->tid, t->name, t,
    629                 thread_states[t->state], t->task, t->task->context, t->thread_code,
    630                 t->kstack, ucycles, usuffix, kcycles, ksuffix);
     621        printf("%-6" PRIu64" %-10s %10p %-8s %10p %-3" PRIu32 " %10p %10p %9" PRIu64 "%c ",
     622            t->tid, t->name, t, thread_states[t->state], t->task,
     623        t->task->context, t->thread_code, t->kstack, cycles, suffix);
    631624#endif
    632625
    633626#ifdef __64_BITS__
    634         printf("%-6" PRIu64" %-10s %18p %-8s %18p %-3" PRIu32 " %18p %18p %9"
    635                 PRIu64 "%c %9" PRIu64 "%c ", t->tid, t->name, t,
    636                 thread_states[t->state], t->task, t->task->context, t->thread_code,
    637                 t->kstack, ucycles, usuffix, kcycles, ksuffix);
     627        printf("%-6" PRIu64" %-10s %18p %-8s %18p %-3" PRIu32 " %18p %18p %9" PRIu64 "%c ",
     628            t->tid, t->name, t, thread_states[t->state], t->task,
     629        t->task->context, t->thread_code, t->kstack, cycles, suffix);
    638630#endif
    639631                       
     
    669661#ifdef __32_BITS__     
    670662        printf("tid    name       address    state    task       "
    671                 "ctx code       stack      ucycles    kcycles    cpu  "
     663                "ctx code       stack      cycles     cpu  "
    672664                "waitqueue\n");
    673665        printf("------ ---------- ---------- -------- ---------- "
    674                 "--- ---------- ---------- ---------- ---------- ---- "
     666                "--- ---------- ---------- ---------- ---- "
    675667                "----------\n");
    676668#endif
     
    678670#ifdef __64_BITS__
    679671        printf("tid    name       address            state    task               "
    680                 "ctx code               stack              ucycles    kcycles    cpu  "
     672                "ctx code               stack              cycles     cpu  "
    681673                "waitqueue\n");
    682674        printf("------ ---------- ------------------ -------- ------------------ "
    683                 "--- ------------------ ------------------ ---------- ---------- ---- "
     675                "--- ------------------ ------------------ ---------- ---- "
    684676                "------------------\n");
    685677#endif
     
    714706 * interrupts must be already disabled.
    715707 *
    716  * @param user  True to update user accounting, false for kernel.
    717  */
    718 void thread_update_accounting(bool user)
     708 */
     709void thread_update_accounting(void)
    719710{
    720711        uint64_t time = get_cycle();
    721         if (user) {
    722                 THREAD->ucycles += time - THREAD->last_cycle;
    723         } else {
    724                 THREAD->kcycles += time - THREAD->last_cycle;
    725         }
     712        THREAD->cycles += time - THREAD->last_cycle;
    726713        THREAD->last_cycle = time;
    727714}
Note: See TracChangeset for help on using the changeset viewer.