Changes in kernel/generic/src/time/clock.c [d0c82c5:da1bafb] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/time/clock.c
rd0c82c5 rda1bafb 57 57 #include <mm/frame.h> 58 58 #include <ddi/ddi.h> 59 #include <arch/cycle.h>60 59 61 60 /* Pointer to variable with uptime */ … … 126 125 } 127 126 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 137 127 /** Clock routine 138 128 * … … 146 136 size_t missed_clock_ticks = CPU->missed_clock_ticks; 147 137 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; 150 145 151 146 /* … … 156 151 size_t i; 157 152 for (i = 0; i <= missed_clock_ticks; i++) { 158 /* Update counters and accounting */159 153 clock_update_counters(); 160 cpu_update_accounting();161 162 154 irq_spinlock_lock(&CPU->timeoutlock, false); 163 155
Note:
See TracChangeset
for help on using the changeset viewer.