Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

computation load calculation

Status
Not open for further replies.

Vladikpri

Mechanical
Apr 20, 2016
2
0
0
IL
Hi
I am implementing a controller but I want to compare it with some other by their calculation load.
what are the methods to do ti?
I am using matlab for design and simulation of the controller

thanks
 
Replies continue below

Recommended for you

You should get a programmer to do this, as this typically requires sufficient pseudo-code hand assemble and count instruction cycles. An experience programmer can probably look at the code and make an educated guess.

TTFN
I can do absolutely anything. I'm an expert!
faq731-376 forum1529
 
I put the code I want to time in a loop and read a hard ware counter before and after the loop to find the time in micro or nano seconds. Then I divide by the number of times the code was execute.
Warning. If there is a cache this method will not work if the code in question will be flush out each iteration.
Counting clock cycles may work with a DSP but modern micro controllers have long pre-fetch queues and the timing of instructions may be altered by the execution of previous instructions.



Peter Nachtwey
Delta Computer Systems
 
For an accurate count, for sure, but that assumes that you already have functional code, or that you are comparing two different functional codes. That might not be an option.

TTFN
I can do absolutely anything. I'm an expert!
faq731-376 forum1529
 
Status
Not open for further replies.
Back
Top