Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-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
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

?? Shouldn't it simply be the loop latency?

TTFN
I can do absolutely anything. I'm an expert!
faq731-376 forum1529
 
what do you mean by loop latency? (for loop)?
what is the correlation?
how should i do it?

thanks
 
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.

Part and Inventory Search

Sponsor