Kernel: Implement CLOCK_{PROCESS,THREAD}_CPUTIME_ID

This commit is contained in:
2025-06-26 13:38:50 +03:00
parent 4fa40de557
commit 83c0ef3514
5 changed files with 63 additions and 4 deletions

View File

@@ -103,6 +103,10 @@ namespace Kernel
bool is_userspace() const { return m_is_userspace; }
uint64_t cpu_time_ns() const;
void set_cpu_time_start();
void set_cpu_time_stop();
void set_tls(vaddr_t tls) { m_tls = tls; }
vaddr_t get_tls() const { return m_tls; }
@@ -155,6 +159,10 @@ namespace Kernel
SpinLock m_signal_lock;
static_assert(_SIGMAX < 64);
mutable SpinLock m_cpu_time_lock;
uint64_t m_cpu_time_ns { 0 };
uint64_t m_cpu_time_start_ns { UINT64_MAX };
BAN::Atomic<uint32_t> m_spinlock_count { 0 };
BAN::Atomic<uint32_t> m_mutex_count { 0 };