LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to keep track of your program execution time length?

Solved!
Go to solution

Hi friends,

 

I'm working on a program that displays random numbers based on the user's input (i.e. how many random numbers do you want to display in the output).

For example: if the user input is 4, then 4 random numbers will be displayed.

 

It should also indicate the number of iterations and the time taken for it to display the random numbers.

 

I'm having trouble with the underlined part above.... I have attached my VI.

0 Kudos
Message 1 of 15
(4,525 Views)

Shalins wrote:

It should also indicate the number of iterations and the time taken for it to display the random numbers..


This is nearly impossible to answer, because the display update is asynchronous.

 

I don't understand your VI. Why doesn't it have a toplevel while loop? (are you using "continuous run mode"???). Then you are running three independent code fragments in parallel. I don't see why. Displaying the ms timer value will give you a random U32 without any useful information. Also the wait for FP activity makes no sense. Can you enlighten us with your thought process. I don't get it.

0 Kudos
Message 2 of 15
(4,523 Views)

@altenbach wrote:
I don't understand your VI. Why doesn't it have a toplevel while loop? (are you using "continuous run mode"???).

I have being specified to use a FOR loop, but i really need some way to display time taken in generating the amount of random numbers....

0 Kudos
Message 3 of 15
(4,517 Views)

altenbach wrote:

 Also the wait for FP activity makes no sense.


I didn't know what to use, I just thought may be I needed something to indicate the FP activity.

0 Kudos
Message 4 of 15
(4,514 Views)
Solution
Accepted by Shalins

OK, now you want the time to generate the random numbers. Earlier you wanted to measure the time to display the random numbers. that is very different.

 

Generating a few random numbers will be way too fast to measure. Maybe if you would generate a few millions and then divide by the total number, you could get a reasonable average.

 

Timing a code fragment is typically done using a three frame flat sequence. Put the code in the center and a tick count in each of the other two frames. The difference between the tick counts will give you the time of the central frame in milliseconds.

 

(For better resolution on Windows, you can substitute the "high resolution relative seconds" (found in C:\Program Files (x86)\National Instruments\LabVIEW 2012\vi.lib\Utility), depending on LabVIEW version).

0 Kudos
Message 5 of 15
(4,511 Views)

@Shalins wrote:

@altenbach wrote:

 Also the wait for FP activity makes no sense.


I didn't know what to use, I just thought may be I needed something to indicate the FP activity.


What does this have to do with benchmarking? Also your 1500ms wait makes no sense at all.

Note that you can prompt for a number. That's better than to prmpt for a string and convert it to a number later.

0 Kudos
Message 6 of 15
(4,506 Views)

ok i got it, thanks

0 Kudos
Message 7 of 15
(4,502 Views)

Here's a very quick example.....

0 Kudos
Message 8 of 15
(4,499 Views)

how come your able to do a DBL connection between the user input and N (the count terminal) doesn't it need a conversion??

 

 

 

 

0 Kudos
Message 9 of 15
(4,493 Views)

@Shalins wrote:

how come your able to do a DBL connection between the user input and N (the count terminal) doesn't it need a conversion??


Everybody is able to do that, even you did it in your original attachment. 😄

 

Notice the little red dot? This is a coercion dot, indicating that LabVIEW internally converted to a suitable datatype. (See also this old discussion)

0 Kudos
Message 10 of 15
(4,487 Views)