03-19-2013 09:05 AM
@TechnoSam wrote:
This could be what I need if the problem is that it's so short of a time that it can't be measured.
It is. In your example you're only performing a very small number of operations and it takes very little time to execute. There's no way you will be able to measure how long that takes with any accuracy.
What is that you actually want to measure?
03-19-2013 09:12 AM
I'm actually using Mac.
I replaced the timer functions with the High Resolution Relative Seconds.vi's but it didn't change anything. In fact, now when I run continuously, I don't even see the flickering that let me know something was going on...
I tried adding more decimal places again but that didn't change a thing, even when going through the debugger, it returned a whole number value when I formatted the output with "%.6f" into a string display.
I'm sorry I'm having so much trouble with this... I can't figure out why...
03-19-2013 09:15 AM
[quote]
It is. In your example you're only performing a very small number of operations and it takes very little time to execute. There's no way you will be able to measure how long that takes with any accuracy.
What is that you actually want to measure?[/quote]
Just the execution time... I don't really know how else to describe it. I need to know which is faster and by how much of the two processes in the VI I attached. The Arithmetic or Function.
But even with the high resolution, it's still turning up 0.
03-19-2013 09:30 AM
03-19-2013 09:37 AM
@TechnoSam wrote:
I need to know which is faster and by how much of the two processes in the VI I attached. The Arithmetic or Function.
Most likely the LV code is faster, but unless you're going to be calling it millions of times every second, the difference is negligble. To measure something like this, you would usually do something like calling it 10 million times in a loop, but that's when the optimizations I talked about can come into play and skew your results. If you want, you can look at the code of the express VI - you need to right click and select Convert to SubVI and then you will be able to look at the actual code.
03-19-2013 09:37 AM
Typically for something fast like this, I will put the code into a FOR loop and run it 100,000 to 1,000,000 times and just look at the total execution time. I doubt you will see much difference between the two options.
03-19-2013 09:41 AM
tst wrote:
If you want, you can look at the code of the express VI - you need to right click and select Convert to SubVI and then you will be able to look at the actual code.
Interesting enough, there's just a formula node in there with a case structure around it to not run when there's an error.
03-19-2013 09:47 AM
We are talking about the VI called "McFalls_Samuel_D2_7[Timer].vi", true?
There is a simple rule:
A subVI call adds overhead.
When running the code in a for loop 10M times, execution times start to differ at a measurable amount in favor for the "Arithmetic" setting. Everything with an elapsed time <10ms is near to worthless on Windows (and other non-deterministic) OSes. Since 10M iterations gives about 100ms (Function) and 70ms (Arithmetic), we are still very close to normal jitter of the OS. Still, it is save now to guess that the Function (ExpressVI) is about 20% slower than the Arithmetic ("primitives").
But as most already stated before:
Unless you are not calling the code many, many, maaaannnyyyyy times, the difference is really neglectable.
Norbert
03-19-2013 09:50 AM
Ok, so it's working now, I'm running it at 10M loops. I'm still getting problems with the Hi Res function, its only returning whole numbers.
Using the millisecond timer now displays something that's actually worth seeing. I suppose that it's imposible for it to return anything but a whole ms value, right?
So my problem is in essence solved, but it's curious that I can't get decimal values of milliseconds out of the high resolution timer...
I can't decide which post to put the solution on, because it was a combination of posts that helped me make it work...
03-19-2013 09:57 AM
First, you have to run it many times. Even with 10M iterations, you will see a big difference. So probably you want to increase the number of iterations to 50M or even >100M.
Second, the high resolution timer VI returns a double value representing the time in seconds. So replace both "tick count" functions in your benchmark with that function.
Additionally, your display element "Execution Time" is limited to 2 digits of precision. Increase that to somthing like 5.
Norbert