MCPcopy Create free account
hub / github.com/bendudson/EuraliOS / pit_interrupt_notify

Function pit_interrupt_notify

kernel/src/time.rs:36–53  ·  view source on GitHub ↗

This function is called by the timer interrupt handler

()

Source from the content-addressed store, hash-verified

34
35/// This function is called by the timer interrupt handler
36pub fn pit_interrupt_notify() {
37 // Increment the number of PIT ticks
38 PIT_TICKS.fetch_add(PIT_TICKS_PER_INTERRUPT, Ordering::Relaxed);
39
40 // Get the change in TSC from last time, and update moving average of
41 // TSC ticks per PIT tick.
42 let new_tsc = time_stamp_counter();
43 let last_tsc = LAST_TSC.swap(new_tsc, Ordering::Relaxed);
44 let new_tsc_per_pit = (new_tsc - last_tsc) / PIT_TICKS_PER_INTERRUPT;
45 let ma_tsc_per_pit = (new_tsc_per_pit + TSC_PER_PIT.load(Ordering::Relaxed)) / 2;
46 TSC_PER_PIT.store(ma_tsc_per_pit, Ordering::Relaxed);
47
48 // Store in user-accessible KernelInfo page
49 let info = memory::kernel_info::get_mut();
50 info.pit_ticks = PIT_TICKS.load(Ordering::Relaxed);
51 info.last_tsc = new_tsc;
52 info.tsc_per_pit = ma_tsc_per_pit;
53}
54
55/// Monotonic count of he number of microseconds since restart
56///

Callers 1

timer_handlerFunction · 0.85

Calls 2

get_mutFunction · 0.85
time_stamp_counterFunction · 0.70

Tested by

no test coverage detected