Suse11.1 high cpu clock speed/freq

Not sure which one would be right section to put this thread on.

I installed Suse 11.1 and slightly modified the original kernel to obtain required CPU clock ticks

Un-check the Tickless option

Timer Frequency - 1000Hz

Below is the piece of code, which actually shows Frequency and clock ticks. it suppose to print a statement to konsole every 1000Hz


#include <signal.h>
#include <sys/time.h>
#include <iostream>
#include <cstdlib>


using namespace std;

long long int counter = 0;
struct timeval last_time;
struct timeval curr_time;
double dif = 0.0;
double freq_sum = 0.0;
double reps = 0.0;
double freq_min = 99999.0;
double freq_max = 0.0;
long long int num_too_low = 0;

void time_check(int data)
{
    // work out the frequecy of the SIGALRMs
    ++counter;
    if (counter >= 1000)
    {

        // need to work out time since last 1000 ticks
	gettimeofday(&curr_time, NULL);
	dif = ((curr_time.tv_usec + curr_time.tv_sec * 1000000)
		- (last_time.tv_usec + last_time.tv_sec * 1000000));
        double freq = (counter / dif)  * 1000000;

        freq_sum = ((freq_sum * reps) + freq) / (reps + 1) ;

        ++reps;
//         if (freq < 800)
                cout << "Frequency = " << freq << " reps= " << dif / 1000000 << endl;
        if (freq_min > freq) freq_min = freq;
        if (freq_max < freq) freq_max = freq;
        if (freq < 950) 
            ++num_too_low;
        last_time = curr_time;
        counter = 0;
    }
}


int main (int argc, char * argv])
{
    cout << "go" /* << "\a \a \a" */ << endl;
	
    int res;
    gettimeofday(&last_time, NULL);
    struct sigaction action;

    struct itimerval timer_value;

    timer_value.it_value.tv_sec = 0;
    timer_value.it_value.tv_usec = 1;
    timer_value.it_interval.tv_sec = 0;
    timer_value.it_interval.tv_usec = 1;

    action.sa_handler = time_check;
    action.sa_flags = SA_NOMASK;
    sigemptyset(&action.sa_mask);

    sigaction( SIGALRM, &action, NULL);
    res = setitimer( ITIMER_REAL, &timer_value, NULL );
    if (res == -1)
        cout << "error in setitimer" << endl;

    cout << "Starting CPU Test program" << endl;
    // loop for a long time

    while (reps < 3000.0)
    {
        sleep(1);
    }
    cout << "average CPU frequency = " << freq_sum << endl;
    cout << "reps = " << reps << endl;
    cout << "Min = " << freq_min << "  Max = " << freq_max << endl;
    cout << "number of low = " << num_too_low << endl;
    return 0;
}


My observations on Suse


SUSE Version    AVG. Frequency        AVG. REPS
Suse 9.3  -     999.xxx 990.xxx  reps > 1 (on average)
Suse 10.2 -     999.xxx 998.xxx  reps (1 - 1.001)
Suse 10.3 -    1000.xxx 912.xxx  reps (1 - 1.090)

but on 11.1

Suse 11.1       0 -  324263.xxx  reps (-2e-0.6 upto 0.005112)

I dont know where things are going wrong. It is too wierd output. This issue was initially observerd on 10.3 where this was happend on and off but lack the cpu clock time. but in case of 11.1 its gone right above the graphs.

On Suse 9.3 it was ok not very good but could be the hardware issue.
On Suse 10.2 everything was spot on
On Suse 10.3 a bit slow but not very accurate
On Suse 11.1 no way near the required values

anyone knows how to fix this in suse 11.1, thanks for help in-advance.

the hardware i am using is

HP Pavilion Slimline s3821uk Desktop PC (NQ808AA) specifications - HP Home & Home Office products

correction to the above observations for suse 11.1:

Suse 11.1       0 to  324263.xxx  reps (-2e-0.6 upto 0.005112)

another option i have tried is to turn off acpi in option when booting.

i did try this along with clock=tsc | clock=pit

this apparently seems to high frequency rate but not stable still

the new observations for suse 11.1 with options acpi=off and clock=tsc | clock=pit are below


         AVG. frequency       reps
         982.xxx 999.xxx      1.16xx 1.0002

does anyone knows anyother option to try to make this as stable as 10.2 results above.

anyone … ?

I suggest reporting your own thread, and requesting that it be moved to the ‘programming’ subforum, where people will be more likely able to answer your question.

[Not by the way intended as a criticism - I can see why you put it here.]

I am happy to move the thread anywhere as far as i got answer.
Mainly i am not concerned with the small program above but my exact purpose of this post is to ask KERNEL Gurus

“how to fix the cpu clock ticks in kernel”

though you might be right moving this post in programming section i might be able to get solution of this question to be done in code instead of kernel.

Can you guide me how to move the post in programming section ?

Thanks

> Can you guide me how to move the post in programming section ?

you can’t do it, you have to ask a monitor to do it for you…it
should be possible to use a private message to do that…

or, do as Confuseling suggested and just begin another thread in the
programming section…i mean, its not like this one is getting any
attention…


platinum

thanks guys,… i have posted a new thread in programming section,… lets see if anyone reply to that. :frowning:

by the way have you guys tested CPU clock tiks by any chance or know about if this is an issue with 11.1 kernel ?