Let's say I have a phone that can process 1 million operations per second and a micro controller that can perform 1000.
Is there a way to tell how many operations a performed by a function or block of code is performing?
I have a function and I can write it a few different ways, an example doesn't matter because I'm talking about all code I might write going forward in the future. I'd like to know how many operations are occurring for a specific block. Is this possible?
If it matters there are cases where I can write code in a variety of ways and get the same outcome:
for (var i:int;i<number;i++) {
// result
}
for (var property in object) {
// result is same as previous
}
for each (var value in object) {
// result is same as previous
}
Again, the code I've written above doesn't matter because it's not about that code!
I want to know if there's a way to measure what each statement, block of code or function costs in terms of operations.
I'm hoping maybe there is a program that is part of the operating system or that comes with Intel or AMD CPU's that I can run when I run my program that, when I press a button, will tell me how many operations were just run on the CPU.
Duplicate question response:
My question is different than the profiling question. When a CPU, GPU or APU(?) says it does 1.4 teraflops and my application can run on that or a microcontroller that can perform 1000 flops I want to know if there is software exists that tells me the operations (not profile the time it takes to run) on a statement, or block of code. Specifically, because I can write the same code multiple ways so knowing this info is valuable to me.