linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Wojciech Kromer <wojciech.kromer@dgt.com.pl>
To: linuxppc-embedded@ozlabs.org
Subject: HZ manipulation
Date: Tue, 13 Dec 2005 09:31:24 +0100	[thread overview]
Message-ID: <439E86DC.4010901@dgt.com.pl> (raw)

[-- Attachment #1: Type: text/plain, Size: 1771 bytes --]

I have 2.4.25 kernel from denx.de and latest uClibc running on mpc8248.
I'm trying to change HZ value, but still have strange results with 
simple test
Recompiling whole uClibc does not change the results.

What could be wrong?

with HZ==1000:
# 
alarm_test                                                                    

alarm fired after 
0.099092s                                                    
slept 0.999769s


with HZ==500:
# 
alarm_test                                                                    

alarm fired after 
0.199622s                                                    
slept 0.999761s

with HZ==100:
# alarm_test
alarm fired after 0.999693s
slept 0.999760s


- here is procesor id :

... by kernel:
# cat /proc/cpuinfo
processor       : 0
cpu             : 8280
core clock      : 400 MHz
CPM  clock      : 200 MHz
bus  clock      : 100 MHz
revision        : 32.20 (pvr 8082 2014)
bogomips        : 266.24

... and by u-boot:
MPC8248 Reset Status: External Soft, External 
Hard                             
                                                                                

MPC8248 Clock 
Configuration                                                    
 - Bus-to-Core Mult 4x, VCO Div 2, 60x Bus Freq  25-75 , Core Freq 
100-300     
 - dfbrg 1, corecnf 0x1a, busdf 3, cpmdf 1, plldf 0, pllmf 
3                   
 - vco_out  400000000, scc_clk  100000000, brg_clk   
25000000                  
 - cpu_clk  400000000, cpm_clk  200000000, bus_clk  
100000000                  
 - pci_clk   
66666666                                                          
                                                                                

CPU:   MPC8248 (HiP7 Rev 14, Mask 1.0 1K50M) at 400 MHz


- test code included


[-- Attachment #2: alarm_test.c --]
[-- Type: text/x-csrc, Size: 908 bytes --]

#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sys/time.h>

static void sighand(int sig)
{
}

int main()
{
 struct timeval tv1, tv2;
 sigset_t set;
    
 sigfillset(&set);
 sigdelset(&set, SIGALRM);
 sigdelset(&set, SIGINT);
          
 signal(SIGALRM, sighand);
 gettimeofday(&tv1, NULL);
 
 alarm(1);
 sigsuspend(&set);
 gettimeofday(&tv2, NULL);
 
 tv1.tv_sec = tv2.tv_sec - tv1.tv_sec - (tv2.tv_usec < tv1.tv_usec);
 tv1.tv_usec = tv2.tv_usec - tv1.tv_usec + (tv2.tv_usec < tv1.tv_usec) * 1000000;
 
 printf("alarm fired after %ld.%06lds\n",tv1.tv_sec, tv1.tv_usec);

 //--------------------
 gettimeofday(&tv1, NULL);
 sleep(1);
 gettimeofday(&tv2, NULL);
 
 tv1.tv_sec = tv2.tv_sec - tv1.tv_sec - (tv2.tv_usec < tv1.tv_usec);
 tv1.tv_usec = tv2.tv_usec - tv1.tv_usec + (tv2.tv_usec < tv1.tv_usec) * 1000000;
 
 printf("slept %ld.%06lds\n",tv1.tv_sec, tv1.tv_usec);
 
 return 0;
}

             reply	other threads:[~2005-12-13  8:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-13  8:31 Wojciech Kromer [this message]
2005-12-13 13:36 ` HZ manipulation Wojciech Kromer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=439E86DC.4010901@dgt.com.pl \
    --to=wojciech.kromer@dgt.com.pl \
    --cc=linuxppc-embedded@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).