Saltycrane logo

SaltyCrane Blog

Notes on Python, Django, and web development on Ubuntu Linux

    

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:

1 Comment — feed icon Comments feed for this post


#1 Bruce Cran commented on 2007-10-18:

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.

Post a comment

Required
Required, but not displayed
Optional

Format using Markdown. (No HTML.)
  • Code blocks: prefix each line by at least 4 spaces or 1 tab (and a blank line before and after)
  • Code span: surround with backticks
  • Blockquotes: prefix lines to be quoted with >
  • Links: <URL>
  • Links w/ description: [description](URL)
Created with Django | Hosted by Slicehost