MATLAB: How to measure FLOPS of a MatLab function

flopslightspeedMATLAB Compilermeasure functions

I'm running MS-OS XP, service pack 3, Pentium 4, CPU 3.4GHz.
Matlab 7.11.0.584, 32 BIT.
BACKGROUND:
I recently installed a FLOPS toolbox called Lightspeed by Tom Minka. http://research.microsoft.com/en-us/um/people/minka/software/lightspeed/
The install went well, and I'm able to access the commands.
I'm running a function I've created that involves addition, subtraction, index searching, if-statements, for-loops, conditional statements, large database structures, etc…
QUESTION:
How do I use the FLOPS commands from the Lightspeed Toolbox to measure the number of flops performed by the function? I only want the total number of flops performed by the function.
And if that doesn't work, what other method exists to measure flops of a function in Matlab and how do I use those?

Best Answer

You cannot use the flops() command from that toolbox to measure the number of flops performed by one function: you have to rewrite the code so that every operation you want to be counted is specifically measured, such as by changing multiplication calls to flops_mult() calls.
What are you trying to measure, exactly? "Idealized" floating point operation counts sometimes have only a rough resemblance to actual code execution times.