Low timer resolution (but it shouldn't be!)

Jeronimo Pellegrini via Rosegarden-user <rosegarden-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org> Tue, 28 Jan 2025 20:46:59 -0300
Newsgroups gmane.comp.audio.rosegarden.user
Message-ID <[email protected]>
Hello,

I have been seeing the warning about low timer frequency every time I 
start Rosegarden. I have tried this:

- I'm using an RT kernel (6.12.11-rt-amd64 from Debian)
- Added myself to the audio group
- The clocksource is hpet (because 
/sys/devices/system/clocksource/clocksource0/current_clocksource 
contains "hpet")
- I have measured the clock frequency, and it seems much better than 
250HZ [1] [2]

But still, Rosegarden says the frequency is 250Hz.

What am I missing?

Thanks!
J.

[1] First method:
#include <stdio.h>
#include <time.h>

int main() {
     struct timespec res;

     // Get the resolution of the CLOCK_MONOTONIC clock
     if (clock_getres(CLOCK_MONOTONIC, &res) == -1) {
         perror("clock_getres");
         return 1;
     }

     // Calculate total resolution in seconds
     long double total_resolution_seconds = res.tv_sec + (res.tv_nsec / 
1e9);

     // Calculate frequency in Hertz
     long double frequency_hz = 1.0 / total_resolution_seconds;

     // Print the resolution and frequency
     printf("Timer resolution:\n");
     printf("Seconds: %ld\n", res.tv_sec);
     printf("Nanoseconds: %ld\n", res.tv_nsec);
     printf("Frequency: %.2Lf Hz\n", frequency_hz);

     return 0;
}

[2] Second method:
https://advenage.com/topics/linux-timer-interrupt-frequency