Time measurement in Microseconds - VxWorks

This is a discussion on Time measurement in Microseconds - VxWorks ; Hi All 1) I want to measure the time difference of the orders of microseconds. But if the difference is of this order than the programe is showing me zero diffence. - I have a interrupt rate set to 60 ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Time measurement in Microseconds

  1. Time measurement in Microseconds

    Hi All

    1) I want to measure the time difference of the orders of microseconds.
    But if the difference is of this order than the programe is showing me
    zero diffence.

    - I have a interrupt rate set to 60 ticks per second.
    sysClkRateGet( ) gives 60 ticks/sec

    1.a) How can i get the time diffence of around 5 microseconds?

    2) tickGet( ) gives new time in number of ticks.
    2.a) My question is that how this number of ticks are updated?
    2.b) Will the nubmer of ticks returned by the tickGet( ) function
    be incremented by 60 because sysClkRateGet( ) is showing 60 ticks/sec?
    2.c) What is the relation of sysClkRateGet( ) & tickGet( )?

    I am using vxWorks 5.4.2 with Tornado 2 on solaris platform.

    Please help me to solve the queries

    Thanks in Advance.

    Regards,

    Äshwani Kathuria.


  2. Re: Time measurement in Microseconds

    Hi there,

    I'll try and answer some of your queries:

    1.
    a) Based solely on your clock rate, the smallest delay you can measure
    is 1 / 60 = 0.0167 seconds, or about 17 milliseconds (~17000
    microseconds). There's no way you can measure a time difference that
    small without using some other higher-resolution clock. I work with PPC
    architecture, and we use the timebase registers onboard to measure
    delays of that order. I'm not knowledgeable about what is available to
    you on Solaris, maybe someone else will know.

    2.
    a) An interrupt function connected to the system clock updates the tick
    counter, 60 times a second in your case. See the VxWorks docs for the
    function tickAnnounce() and usrClock() for more info (and/or look
    around on this newsgroup).
    b) The number of ticks returned by the tickGet() function will be
    updated 60 times a second, as per your clock rate. So, if you ran
    tickGet() once every second exactly, the value would be updated by
    exactly 60 (assuming no other overhead). If you ran tickGet() twice a
    second, you would see it updated by exactly 30, etc.
    c) sysClkRateGet() returns the number of times the system tick counter
    is updated every second; tickGet() shows the current value of the tick
    counter.

    HTH,
    Ben.


  3. Re: Time measurement in Microseconds

    Hi Ben,

    Thanks for the information.

    Äshwani Kathuria


  4. Re: Time measurement in Microseconds

    HI Ben,

    I am usnig PPC processor as the target, could you please help me how to measure the time in terms of at least microseconds on this chip. I am using VxWorks as the OS. I want to measure the time taken by different function calls in my code.

    Thanks
    Anwar

    Quote Originally Posted by Ben View Post
    Hi there,

    I'll try and answer some of your queries:

    1.
    a) Based solely on your clock rate, the smallest delay you can measure
    is 1 / 60 = 0.0167 seconds, or about 17 milliseconds (~17000
    microseconds). There's no way you can measure a time difference that
    small without using some other higher-resolution clock. I work with PPC
    architecture, and we use the timebase registers onboard to measure
    delays of that order. I'm not knowledgeable about what is available to
    you on Solaris, maybe someone else will know.

    2.
    a) An interrupt function connected to the system clock updates the tick
    counter, 60 times a second in your case. See the VxWorks docs for the
    function tickAnnounce() and usrClock() for more info (and/or look
    around on this newsgroup).
    b) The number of ticks returned by the tickGet() function will be
    updated 60 times a second, as per your clock rate. So, if you ran
    tickGet() once every second exactly, the value would be updated by
    exactly 60 (assuming no other overhead). If you ran tickGet() twice a
    second, you would see it updated by exactly 30, etc.
    c) sysClkRateGet() returns the number of times the system tick counter
    is updated every second; tickGet() shows the current value of the tick
    counter.

    HTH,
    Ben.

  5. Re: Time measurement in Microseconds

    HI Ben,

    I want to measure the time taken by each portion of my code. I am looking for a resolution in micro seconds. I dont think using ticks will help in this matter. The target processor is MPC 8323 (Power PC). could you please help me in this matter. I am using VxWorks-6.6 as the OS.

    Thanks
    Anwar

+ Reply to Thread