1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

Kernel: Use a separate timer for profiling the system

This updates the profiling subsystem to use a separate timer to
trigger CPU sampling. This timer has a higher resolution (1000Hz)
and is independent from the scheduler. At a later time the
resolution could even be made configurable with an argument for
sys$profiling_enable() - but not today.
This commit is contained in:
Gunnar Beutner 2021-05-13 22:15:13 +02:00 committed by Andreas Kling
parent d6b3513aab
commit 8614d18956
5 changed files with 46 additions and 8 deletions

View file

@ -16,6 +16,7 @@
namespace Kernel {
#define OPTIMAL_TICKS_PER_SECOND_RATE 250
#define OPTIMAL_PROFILE_TICKS_PER_SECOND_RATE 1000
class HardwareTimerBase;
@ -55,6 +56,9 @@ public:
static bool is_hpet_periodic_mode_allowed();
void enable_profile_timer();
void disable_profile_timer();
u64 uptime_ms() const;
static Time now();
@ -90,6 +94,9 @@ private:
RefPtr<HardwareTimerBase> m_system_timer;
RefPtr<HardwareTimerBase> m_time_keeper_timer;
Atomic<u32> m_profile_enable_count { 0 };
RefPtr<HardwareTimerBase> m_profile_timer;
};
}