On Fri, Jul 31, 2009 at 11:23:15AM +0700, Mulyadi Santosa wrote:
> On Fri, Jul 31, 2009 at 6:52 AM, Karel Zak<k...@redhat.com> wrote:
> >  Linux exports HZ to userspace via AT_CLKTCK auxiliary vector entry,
> >  for more details see include/linux/auxvec.h.
> >
> >  The vector is area between process's environ[] and argv[]. I guess glibc
> >  reads the vector for the sysconf() call.
> >
> >    Karel
> 
> Hi Karel...
> 
> I checked that using the following command:
> $ LD_SHOW_AUXV=1 sleep 1
> AT_SYSINFO:      0xb7fed414
> AT_SYSINFO_EHDR: 0xb7fed000
> AT_HWCAP:    fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca
> cmov clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe
> AT_PAGESZ:       4096
> AT_CLKTCK:       100
> AT_PHDR:         0x8048034
> AT_PHENT:        32
> AT_PHNUM:        8
> AT_BASE:         0x0
> AT_FLAGS:        0x0
> AT_ENTRY:        0x8048c50
> AT_UID:          500
> AT_EUID:         500
> AT_GID:          500
> AT_EGID:         500
> AT_SECURE:       0
> AT_??? (0x19): 0xbf84ba4b
> AT_??? (0x1f): 0xbf84cff1
> AT_PLATFORM:     i686
> 
> It seems that user space sees HZ as 100, while in fact my current
> running kernel is compiled with HZ=300. What do you think about it? Or
> is there something wrong with my conclusion?

The following C program should properly show you the kernel HZ.

thanks,

greg k-h

--------------

#include <unistd.h>
#include <time.h>
#include <stdio.h>

int main()
{
        struct timespec res;
        double resolution;

        printf("UserHZ   %ld\n", sysconf(_SC_CLK_TCK));

        clock_getres(CLOCK_REALTIME, &res);
        resolution = res.tv_sec + (((double)res.tv_nsec)/1.0e9);

        printf("SystemHZ %ld\n", (unsigned long)(1/resolution + 0.5));
        return 0;
}


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to