GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 05-Nov-2009, 22:14
ahbi82 ahbi82 is offline
Member
 
Join Date: Jul 2006
Posts: 143
ahbi82 will become famous soon enough

Help in measuring running time.


I have done a computer vision application in C++, and well due to the real time constraint, the algorithm will be implemented in VHDL and deployed in a FPGA. I'm using Intel Atom as my "Main" processor, and the FPGA is connected via PCIe. As the implementation on some formulas are too complex in VHDL (impact on development time), i would like to implement those formulas using C++ which runs on the Atom. From the PCIe specs ( x16 ~ 6.4GBps), i suppose i'm able to meet the real time constraint. And with OpenMP and other intel IPP, compiler (stated on its site that its able to achieve 30% to 50% perfromace......) etc, i hope i can achieve the timing i need........

Now my problem is, after i implemented the formula in C++. Whats the test way to measure the execution time. One common way is to get clock tick at the start and end of the program. A generic way is to compute the Big ' O notation for worst, average and best cases. But for the later way, its hard to define as there are exponents, trigo functions. I hope someone who is expert can give me some pointers on which is the best and near accurate way to measure the execution time. I'm using Visual Studio 2005 Pro.

By the way, i'm using Windows XP embedded. I already tried to and successfully deploy it on the atom. I search the web, they only guide on generating the image. But i need more knowledge on how can i generate an image which is best optimized, ie, i don't wan any unnecessary task to run except mine. I guess i need to have an in dept knowledge of windows... . Kindly suggest me some books or website on Windows XP embedded.


I know its a long paragraph..... BUT THANKS IN ADVANCE!!!!!!
Last edited by ahbi82 : 05-Nov-2009 at 23:01.
  #2  
Old 06-Nov-2009, 03:07
Mexican Bob's Avatar
Mexican Bob Mexican Bob is offline
Member
 
Join Date: Mar 2008
Location: Chicxulub, Yucatán
Posts: 226
Mexican Bob is a jewel in the roughMexican Bob is a jewel in the roughMexican Bob is a jewel in the rough

Re: Help in measuring running time.


You probably want to write your code in Win32 and not necessarily C++. I'd probably recommend that you consider producing your timing critical code in C using the Win32 SDK for all of your needs.

What you'll want to do is use the high-resolution timer available through the:

QueryPerformanceCounter function and similar.

...you'll also want to modify your thread priority so that it runs at an elevated priority that reflects the needs of the system.

Having an in-depth knowledge of Windows SDK is a life-long pursuit. I've been working with the Win32 since about 1992 (?) with the Windows NT 3.1 beta...and I *think* that I know perhaps half of the API...maybe less, particularly when you consider all of the changes going on for more recent versions. Perhaps a year or so ago, I tossed the 5-1/4" floppy disks that the beta distro came on (kept the 3-1/2s). However, weirdly enough, I do still have a 5-1/2" floppy drive for whatever reason one could possibly imagine...maybe nostalgia and because there was a time when that was the only drive type that I had in a computer?

A good way to test your PCIe performance (I've done Xilinx-based FPGA designs using a PCIe IP core) is to query the performance counter at the beginning of a body of code for the "before" time and then "after" it executes. Subtract the QuadPart(s) and you'll have a fairly good representation of how long it took the code to execute.

You can use QueryPerformanceFrequency to determine the resolution of your high performance timer. In many systems, it is the processor internal clocking rate.

Start by writing a stupid-simple little C application that includes windows.h and has a main function. Query the performance frequency and print it to the console. Add a query counter above and below the printf (or however you elect to print to console) and then print the difference between the "after" less "before" using the QuadParts as your operands. It will likely tell you how many clocks are consumed by printf (less the overhead of the queries).

In your real code, you'll want to be careful about "reporting" performance data in a manner that significantly slows down the system.



MxB
  #3  
Old 06-Nov-2009, 04:18
ahbi82 ahbi82 is offline
Member
 
Join Date: Jul 2006
Posts: 143
ahbi82 will become famous soon enough

Re: Help in measuring running time.


Thanks for the info. I think maybe i'll be developing the driver for the PCIe communication. Here's a REAL GOOD article i source upon.

http://www.codeproject.com/KB/system/driverdev.aspx

Another alternative is to use jungo WinDriver http://www.jungo.co.uk/

By the way i'm using the latest Altera FPGA.

Now i'm trying the write the driver and and system service to simulate the driver.

If i've a GUI (MFC), how can i communicate with the driver i wrote? Both are in different context, process. I guess i need to STUDY HARDER....lolz.

Again thanks for the reply.
  #4  
Old 07-Nov-2009, 11:59
ahbi82 ahbi82 is offline
Member
 
Join Date: Jul 2006
Posts: 143
ahbi82 will become famous soon enough

Re: Help in measuring running time.


I'm sort of stuck in implementing the driver. For example, if the purpose of my driver is just to send/receive data to HW via PCIe, which i classify as layer 1. Layer 2 will be parsing of the data into meaning structures. Layer 3 will be the actual computation. Should all this be done in a single thread or should i run different thread for each of them? Maybe someone have a better idea. I never implement a driver before, therefore someone with exp can guide me. THANKS!!
 
 

Recent GIDBlogProblems with the Navy (Chiefs) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with running time ktg C Programming Language 10 26-Oct-2007 08:27
constructors/classes mapes479 C++ Forum 3 19-Nov-2006 18:34
Measuring time? Help! smoothdogg00 C++ Forum 1 10-Apr-2006 09:19
Running several Programs at the same time expi12 C Programming Language 2 02-Jan-2006 01:30

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 02:57.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.