Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/time/clock.c

    rd0c82c5 rda1bafb  
    5757#include <mm/frame.h>
    5858#include <ddi/ddi.h>
    59 #include <arch/cycle.h>
    6059
    6160/* Pointer to variable with uptime */
     
    126125}
    127126
    128 static void cpu_update_accounting(void)
    129 {
    130         irq_spinlock_lock(&CPU->lock, false);
    131         uint64_t now = get_cycle();
    132         CPU->busy_cycles += now - CPU->last_cycle;
    133         CPU->last_cycle = now;
    134         irq_spinlock_unlock(&CPU->lock, false);
    135 }
    136 
    137127/** Clock routine
    138128 *
     
    146136        size_t missed_clock_ticks = CPU->missed_clock_ticks;
    147137       
    148         /* Account CPU usage */
    149         cpu_update_accounting();
     138        /* Account lost ticks to CPU usage */
     139        if (CPU->idle)
     140                CPU->idle_ticks += missed_clock_ticks + 1;
     141        else
     142                CPU->busy_ticks += missed_clock_ticks + 1;
     143       
     144        CPU->idle = false;
    150145       
    151146        /*
     
    156151        size_t i;
    157152        for (i = 0; i <= missed_clock_ticks; i++) {
    158                 /* Update counters and accounting */
    159153                clock_update_counters();
    160                 cpu_update_accounting();
    161                
    162154                irq_spinlock_lock(&CPU->timeoutlock, false);
    163155               
Note: See TracChangeset for help on using the changeset viewer.