From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Profiling problems

I have a VI working which takes over 50 hours to complete, and I obviously want to optimize it for speed; however, when I use the profiler it lists the total run time as approximately one tenth of the actual time. I read somewhere that LabVIEW may not take memory operations (allocations/deallocations?) into account in its profiling, but then I have no way of telling which sub-VI is taking the most time, including memory operations.

 

Anyone have any advice as to how to approach this problem? I can come up with some method of adding up the total run-time for suspect sub-VIs, but I'm concerned I might do it in such a way that I significantly add to the running time of said sub-VI, especially considering some of them run thousands or millions of times.

0 Kudos
Message 1 of 9
(2,742 Views)

Hm, do you use any external code like ActiveX, .NET or DLLs? Is the application waiting for user interaction?

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 9
(2,729 Views)

I'm not aware of any external code (I didn't write all of the code, but I've looked through it and haven't noticed anything of the sort). The application isn't waiting for any user input during the time in question
0 Kudos
Message 3 of 9
(2,719 Views)

Odd.... the profiler logs the times the VIs are "running", so if there are "missing times", the VIs are idle in between. This happens if e.g. dialogs wait for input or if external code is executed.

So, if the time total is less than the overall time of execution, there must be time slots, where (all) VIs are waiting for something.....

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 9
(2,715 Views)
I looked again at the code, and I just noticed there are DLL calls in the NI-Motion sub-VIs that the application is using (checking the status of the hardware) Is there a good way to check how long these are taking to execute?
0 Kudos
Message 5 of 9
(2,712 Views)

Sure, you can benchmark around the motion VIs. But if you are using motion VIs, i asume that you have motion hardware in your system as well.

Because motion is not arbitrarily fast, you can only identify parts which probably can be optimized. This requires testing because motion will get quite unstable if you try to move something too fast.....

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 9
(2,710 Views)

Of course I intend to test the hardware, but I also want to be sure that it is, in fact, the motion hardware that accounts for the "missing" time.

 

So how can I time the motion VIs? Manually add timing code in each VI? 

0 Kudos
Message 7 of 9
(2,699 Views)

If you need reliable information about the biggest software execution times, i suggest you to insert (timing) benchmarking elements around every major part of your application.

Example:

Application has motion, vision, file IO and DAQ. The application works like a sequencer controlling those for parts.

Just include "Tick Count (ms)" before entering one of the four parts in your sequencer. After returning to the sequencer, take another tick count and subtract the first from the current one. Now you have the "excessed" time for the part. Do the same for the other parts. So maybe you find out:

Motion 45%

Vision 30%

DAQ 15%

File IO 10%

So motion is a good place to dig deeper in order to optimize execution times... so repead the approach for the major parts of motion...

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 8 of 9
(2,697 Views)

That's kind of what I was thinking, except it's more like Motion->Data Acquisition->Data Analysis->Repeat Many Times->.........->Finally, File Output

 

The potential problem is that the motion VIs run more times than the data acquisition and analysis VIs, so I thought that adding benchmarking may skew the results. But maybe it's safe to assume that the time required for benchmarking is insignificant...

0 Kudos
Message 9 of 9
(2,693 Views)