SaltyCrane Blog — Notes on JavaScript and web development

How to measure execution time for a portion of VxWorks code using VxWorks 5.5 and Tornado 2

Use sysTimestamp() as documented in "VxWorks Device Driver Developer's Guide 6.2". This is the library used to measure time in WindView. If not already included, you need to include the system-defined timestamping in the VxWorks kernel. From the VxWorks tab of your bootable project in Tornado go to: "development tool components" -> "Windview components" -> "select timestamping" Right click on "system-defined timestamping" and choose "include 'system-defined timestamping'...", click "OK" Use sysTimestamp as shown in the example below:
void my_task()
{
    UINT32 timestamp1, timestamp2;
    double tsperiod, delta_time;

    sysTimestampEnable();
    tsperiod = (double)sysTimestampPeriod();

    timestamp1 = sysTimestamp();

    /* execute some code */

    timestamp2 = sysTimestamp();
    delta_time = (double)(timestamp2 - timestamp1)/tsperiod/sysClkRateGet();

    exit(0);    
}
Technorati tags:

Comments


#1 Bruce Cran commented on :

sysTimestampPeriod returns the number of ticks the timer counts before resetting - I think sysTimestampFreq should be used to get the frequency in ticks per second in order to calculate the delta time.


#2 Elia commented on :

Hello, please let me know if you have an example code for multiplication the 2 floating point vectors using Altivec-MPC7457 and VxWorks-6.2.

Thank you in advance.

Elia


#3 Nick commented on :

That is incorrect, the line should read: delta_time = (double)(timestamp2 - timestamp1)/sysTimestampFreq();