Changeset cefb126 in mainline for kernel/generic/src/time/clock.c
- Timestamp:
- 2010-07-02T14:19:30Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 89c57b6
- Parents:
- fe7abd0 (diff), e3ee9b9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/time/clock.c
rfe7abd0 rcefb126 57 57 #include <mm/frame.h> 58 58 #include <ddi/ddi.h> 59 #include <arch/cycle.h> 59 60 60 61 /* Pointer to variable with uptime */ … … 125 126 } 126 127 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 127 137 /** Clock routine 128 138 * … … 136 146 size_t missed_clock_ticks = CPU->missed_clock_ticks; 137 147 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; 148 /* Account CPU usage */ 149 cpu_update_accounting(); 145 150 146 151 /* … … 151 156 size_t i; 152 157 for (i = 0; i <= missed_clock_ticks; i++) { 158 /* Update counters and accounting */ 153 159 clock_update_counters(); 160 cpu_update_accounting(); 161 154 162 irq_spinlock_lock(&CPU->timeoutlock, false); 155 163
Note:
See TracChangeset
for help on using the changeset viewer.