Several changes for timestamp bundle:

Fully defined the structure.
Single copy of it + single timer across all modules, managing it is now the responsibility of KernelState.

add global_critical_region::PrepareToAcquire, which uses Prefetchw on the global crit. We now know we can use Prefetchw on all cpus that have AVX.
add  KeQueryInterruptTime, which is used by some dashboards.

add threading::NanoSleep
This commit is contained in:
chss95cs@gmail.com
2023-04-16 10:08:01 -04:00
parent 12c9135843
commit ab21e1e0f0
15 changed files with 147 additions and 54 deletions

View File

@@ -148,7 +148,16 @@ void MaybeYield() {
// memorybarrier is really not necessary here...
// MemoryBarrier();
}
void NanoSleep(int64_t ns) {
//nanosleep is done in 100 nanosecond increments
int64_t in_nt_increments = ns / 100LL;
if (in_nt_increments == 0 && ns != 0) {
//if we're explicitly requesting a delay of 0 ns, let it go through, otherwise if it was less than a 100ns increment we round up to 100ns
in_nt_increments = 1;
}
in_nt_increments = -in_nt_increments;
NtDelayExecutionPointer.invoke(0, &in_nt_increments);
}
void SyncMemory() { MemoryBarrier(); }
void Sleep(std::chrono::microseconds duration) {