Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tlug: Timing in Linux and 686 Cache



>>>>> "Manuel" == Manuel Chakravarty <chak@example.com> writes:

    Manuel> * Does anybody have an idea whether it is possible in
    Manuel> Linux to time the execution of user-level code below a
    Manuel> resolution of 10ms?  Using the function `getrusage', a
    Manuel> resolution of 10ms is the best that I can get.  Is there
    Manuel> anything better?

Try gettimeofday. It returns:

       struct timeval {
                      long tv_sec;        /* seconds */
                      long tv_usec;  /* microseconds */
                      };

I've never tried this on linux, but I know it works on SunOS and
Solaris on sparc. I do know what resolution Intel hardware supports.

    Manuel> * Is there a OS function that lets me invalidate the data
    Manuel> cache of the processor?  If not, does anybody know which
    Manuel> `asm' section achieves this effect for a MMX Pentium Pro?

    Manuel> For the curious: We are trying to time some cache effects
    Manuel> on a Pentium Pro machine.  With a resolution of 10ms, we
    Manuel> have to use a loop, repeating the test to measure the
    Manuel> accumulated runtime.  Without invalidating the cache at
    Manuel> the beginning of the loop, the results are probably
    Manuel> distorted.

The only thing I can think of is the brute force approach of causing
it to be used for something else, effectively invalidating it.

Andy
--------------------------------------------------------------
Next Meeting: 8 August, Tokyo Station Yaesu central gate 12:30
featuring Linux on multiple platforms:
i386, Sparc, PA-Risc, Amiga, SGI, Alpha, PalmPilot, ...
Next Nomikai: September, 19:30 Tengu TokyoEkiMae 03-3275-3691
--------------------------------------------------------------
Sponsor: PHT, makers of TurboLinux http://www.pht.co.jp


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links