Results 1 to 2 of 2

Thread: Pentium TSC for Linux _mlOSGetUSTinternal

  1. #1
    Email address no longer exists
    Join Date
    Mar 2004
    Sydney, Australia

    Pentium TSC for Linux _mlOSGetUSTinternal

    I was a little bit surprised to see gettimeofday being used for _mlOSGetUSTinternal. As far as I know, this clock is adjusted by the various subsystems used to correct out of sync clocks (like ntpd). For Pentium and later, I think a much better option would be the Pentium TSC (realistically are sub Pentiums being used much for multimedia?, although they should be catered for I guess). It is a single asembler (misspelled to get throught fascist rude word filter) call to get the full 64 bit TSC value:

    u_int64_t d;
    __asm__ __volatile__ ("rdtsc" : "=&A" (d));

    UST is meant to be unadjusted, right? gettimeofday is adjusted.

    edit to fix the expletive filter of ***embler -> asembler, sigh!

    [ March 14, 2004: Message edited by: tmander ]

  2. #2
    Join Date
    Jul 2003

    Re: Pentium TSC for Linux _mlOSGetUSTinternal

    Yes, you are correct -- gettimeofday is not at all a good source of UST. In a "production system", this call should not be used.

    The way UST is supposed to work in the latest Beta is that one or more modules register a UST handler. The modules are expected to obtain UST timestamps from the hardware they control -- video and audio cards will often have hardware on-board that is suitable for UST. Thus the modules register their ability to provide UST, and the ML library selects one of them to be "the" source on the system.

    The function "_mlOSGetUSTInternal" is simply the emergency fall-back for systems that have no suitable hardware.

    The CPU's timer is not ideal because on some multi-CPU architectures, the processor timers are not in-sync. Thus, the result of a get-UST call will depend on the CPU currently executing the thread.

Similar Threads

  1. OpenCl and Linux
    By fresh in forum OpenCL
    Replies: 8
    Last Post: 01-25-2011, 03:04 PM
  2. how to use on Embedded linux or linux?
    By Ulimit77 in forum OpenGL ES
    Replies: 1
    Last Post: 05-29-2005, 07:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean