mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-29 12:49:08 +00:00
For now, this can only query microseconds since boot. Use this to print a timestamp every second. This busy-loops until a second has passed. This might be a good first use of interrupts soon. qemu used to not implement this timer at some point, but it seems to work fine even in qemu now (qemu v 5.2.0).
28 lines
347 B
C++
28 lines
347 B
C++
/*
|
|
* Copyright (c) 2021, Nico Weber <thakis@chromium.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Types.h>
|
|
|
|
namespace Prekernel {
|
|
|
|
struct TimerRegisters;
|
|
|
|
class Timer {
|
|
public:
|
|
static Timer& the();
|
|
|
|
u64 microseconds_since_boot();
|
|
|
|
private:
|
|
Timer();
|
|
|
|
TimerRegisters volatile* m_registers;
|
|
};
|
|
|
|
}
|