openSUSE Forums > Programming/Scripting » Suse11.1 high cpu clock speed/freq - with kernel / C++ code

Go Back   openSUSE Forums > Programming/Scripting
Forums FAQ Members List Search Today's Posts Mark Forums Read


Programming/Scripting Questions about programming, bash scripts, perl, php, cron jobs, ruby, python, etc.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 16-Sep-2009, 07:01
Puzzled Penguin
 
Join Date: May 2009
Posts: 42
subhan222 hasn't been rated much yet
Default Suse11.1 high cpu clock speed/freq - with kernel / C++ code

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
* preempt kernel


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

Code:
#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
Code:
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 to  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

Hardware i am using is

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


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

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
Code:
         AVG. frequency       reps
         976.xxx 999.xxx      1.16xx 1.0002
does anyone knows anyother option to try to make this as stable as 10.2 results above.
Reply With Quote
  #2 (permalink)  
Old 18-Sep-2009, 03:53
Puzzled Penguin
 
Join Date: May 2009
Posts: 42
subhan222 hasn't been rated much yet
Default Re: Suse11.1 high cpu clock speed/freq - with kernel / C++ c

Over 2 days,.. 79 hits but no one dare to reply,...

add this point to the list why people avoid linux and prefer windows over it.

where it gets complicated its beyond the level of expertise avaliable...
Reply With Quote
  #3 (permalink)  
Old 18-Sep-2009, 06:21
platinum
Guest
 
Posts: n/a
Default Re: Suse11.1 high cpu clock speed/freq - with kernel / C++ code

> add this point to the list why people avoid linux and prefer windows
> over it.


are you for real? this is a forum of USERS..

most USERS don't have any interest whatsoever in why, after you
"slightly modified" the kernel you have questions!!

go find the kernel hackers who _might_ care, isn't it yet obvious they
are NOT here..

so, add this to _your_ list of why people should avoid linux:
they can't figure out where the kernel hackers are, hint take a look
at http://www.kernel.org/ to start..

there you will probably find a mailing list that _might_ entertain
your question..

--
platinum
Reply With Quote
  #4 (permalink)  
Old 18-Sep-2009, 11:20
Puzzled Penguin
 
Join Date: Aug 2009
Posts: 22
Ferentix hasn't been rated much yet
Default Re: Suse11.1 high cpu clock speed/freq - with kernel / C++ c

Quote:
Originally Posted by subhan222 View Post
Over 2 days,.. 79 hits but no one dare to reply,...

add this point to the list why people avoid linux and prefer windows over it.

where it gets complicated its beyond the level of expertise avaliable...
Please, be reasonable. This is a public forum, and nobody here is obliged to answer your question, especially if they don't know the answer- sure, 79 people have looked, but what makes you think any of them knew the answer? This is going to be quite an esoteric area for a lot of users; though if someone who knew had checked here, they would most likely have answered your question- people on these forums are usually quite helpful with problems that they can actually address. Plus, why bring Windows into it, when it's completely unrelated to your problem?

Anyway, if you're getting no feedback on these forums, you might want to try some more generalised/populated forums like LinuxQuestions.org , or a forum more oriented around technical issues to do with the kernel, like Kerneltrap's Linux Kernel forum Linux kernel | KernelTrap . Good luck!
Reply With Quote
  #5 (permalink)  
Old 23-Sep-2009, 04:01
Puzzled Penguin
 
Join Date: May 2009
Posts: 42
subhan222 hasn't been rated much yet
Default Re: Suse11.1 high cpu clock speed/freq - with kernel / C++ c

thanks for your replies. very helpfull but can not avoid reality.

Thanks again!
Reply With Quote
Reply

Bookmarks

Tags
c++ cpu clock, cpu freq, higher speed clock, kernel, suse11.1


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2