lkml.org 
[lkml]   [1998]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] Intel clock speed detection
    I was only saying that becaause i didn't understand if this thing worked
    only on pentiums, or whatnot. oh well. i think maybe 3 other people in
    the world still actually use this chip ;) heheh oh well thanks


    -Rob

    On Thu, 1 Jan 1998, Phil Brutsche wrote:

    > On Tue, 30 Dec 1997 p0thead@ooz.net wrote:
    >
    > > I'm a little confuised.. I just tried to run this on my nexgen-90, and it
    > ^^^^^^
    > This chip is the NexGen-P90. To almost all programs, it looks like a
    > '386. It was the first pentium clone on the market - released before the
    > rdtsc instruction was known of - thus the patch fails. As far as I know,
    > it only knows '386 ('486?) instructions. It was originally designed in
    > the days of the '386, but was delayed.
    > > gave me this:
    > >
    > > [root@metallica /root]# ./mhz.estimate
    > > Illegal Instruction (core dumped)
    > >
    > > Now, does this program only work on pentium's, i'm a little confused.
    > >
    > > -Robg
    > >
    > > On Sat, 27 Dec 1997, Robert Woodcock wrote:
    > >
    > > > Phile Brutsche wrote:
    > > > >On another note, I just looked at your patch. It uses the rdtsc
    > > > >instruction; this instruction does not exist on anything less than a
    > > > >Pentium. I'm not sure what the kernel would do on '486 or '386, but it
    > > > >would'nt be pretty. A better solution for this would be to time the bsf
    > > > >instruction on those chips. I have source in C and assembly if you need
    > > > >help.
    > > >
    > > > Can you mail that to me at the return address?
    > > >
    > > > Currently I'm using this userspace code I pieced together myself (well,
    > > > not the rdtsc function, I ripped that from the I/O Port Programming HOWTO)
    > > > which is so consistent that it's making me wonder if my motherboard clock
    > > > chip is a little bit off and is actually running my CPU at 99.57mhz
    > > > instead of 100. (I gave this program to several other people with pentiums
    > > > and it seems to consistently report either high and low depending on the
    > > > system.)
    > > >
    > > > mercury:~$ (while :; do mhz.estimate; done)
    > > > 99.569984 MHz processor.
    > > > 99.569979 MHz processor.
    > > > 99.570001 MHz processor.
    > > > 99.569946 MHz processor.
    > > >
    > > > Kinda makes you wonder about those motherboard benchmarks where all the
    > > > motherboards are within a few tenths of a percent of each other. :)
    > > >
    > > > Compile as usual, gcc mhz.estimate.c -o mhz.estimate.
    > > >
    > > > #include <stdio.h>
    > > > #include <sys/time.h>
    > > >
    > > > /* returns number of clock cycles since last reboot */
    > > > __inline__ unsigned long long int rdtsc()
    > > > {
    > > > unsigned long long int x;
    > > > __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
    > > > return x;
    > > > }
    > > >
    > > > main ()
    > > > {
    > > > struct timezone tz;
    > > > struct timeval tvstart, tvstop;
    > > > unsigned long long int cycles[2]; /* gotta be 64 bit */
    > > > unsigned int microseconds; /* total time taken */
    > > >
    > > > bzero(&tz, sizeof(tz));
    > > >
    > > > /* get this function in cached memory */
    > > > gettimeofday(&tvstart, &tz);
    > > > cycles[0] = rdtsc();
    > > > gettimeofday(&tvstart, &tz);
    > > >
    > > > /* we don't trust that this is any specific length of time */
    > > > sleep(1);
    > > >
    > > > cycles[1] = rdtsc();
    > > > gettimeofday(&tvstop, &tz);
    > > > microseconds = ((tvstop.tv_sec-tvstart.tv_sec)*1000000) +
    > > > (tvstop.tv_usec-tvstart.tv_usec);
    > > >
    > > > printf("%f MHz processor.\n",
    > > > (float)(cycles[1]-cycles[0])/microseconds);
    > > > }
    > > > --
    > > > Robert Woodcock - robert@olex.com
    > > > All I want is a warm bed and a kind word and unlimited power.
    > > > -- Ashleigh Brilliant
    > > >
    > >
    > >
    >
    > ----------------------------------------------------------------------
    > Phil Brutsche
    >
    > "Be of stout heart, Number One. We've handled the Borg. We can
    > certainly handle Admiral Jellico." - Jean-Luc Picard
    >
    > ----------------------------------------------------------------------
    >


    \
     
     \ /
      Last update: 2005-03-22 13:41    [W:0.030 / U:60.440 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site