08-26-2010 12:25 PM
I observe a very weird behavior when using timed loops. My normal load with a while loop is around 0.5-1.5% of CPU time. I am doing simple TCP/IP commmunication in it. When I switch to a time loop It goes up to arond 15-16% on all 4 cores. It does not matter whether I do it at 1Hz or 40Hz (tested).
I run it on RT PC labvier RT 9.01. with labview 2009 SP. The remote target has a fresh OS. The PC is 2.4 GHz quad core. I did not see that behavior on 8.2 or 8.5 labview. I saved my vi under a new name and etc.
When I run profile manager I do not see a major difference between them. The system manager and RT monitor are showing that the version with a timed loop is eating CPU time like crazy. Tried the trace toolkit but it does not mean much to me or sometimes does not make sense.
08-29-2010 08:49 PM
Hi AndyN,
Is this all occurring on the RT PC? What else beside the TCP/IP communication is in the loop? There is some overhead associated with timed loops to ensure that they run at the specified rate, so in general they'll take up more cpu usage than a simple while loop. However, I'm not sure if it should be this much. What kind of information did you get out of the trace toolkit?
08-30-2010 10:57 AM
Is this all occurring on the RT PC - yes
What else beside the TCP/IP communication is in the loop? - I read several local variables, flatten them, send over TCP/IP, I read 3 bytes form TCPIP and write them to local variables. The load does not depend on how often I do it 1Hz- 40Hz same thing. It seems that removing the local variablem does not help neither.
What kind of information did you get out of the trace toolkit. - To be honest I do not quite get it. Even worse - a subvi that is run several times shows up as one continous run. It is run only from one place...
08-31-2010 06:52 PM
Hi Andy,
I think that there is something with your code. I ran the TCP Communication.lvproj target VI, TCP Communication - RT.vi on my 8196 and did not see 15% CPU usage. It was more like 5% and the 8196 is only a single core machine not a quad core like yours.
Try running that and tell me what you see.
08-31-2010 09:18 PM
Well, I am almost sure there is nothing wrong with my code. It was fine under LV 8.5. The code with a while loop takes about 0.5-1.5% on one core. Without any changes the timed loop, same rate hits all four cores at the same time at 13-23% - average 15%.
I will be glad if this is my fault and I know how to fix it. I made a new simple version of the project- just the loop basically. Same problem. I also did a fresh LV RT OS install and sucj and such, no change.
Compare it to this.While doing 33Hz on a single core 1Ghz Linux written in C machine with complicated communication, SVD, and inteface I was using only 5% of the CPU time.
09-01-2010 08:34 AM
Hi Andy,
Could you tell me what percent CPU usage you see when you run the example TCP code that I mentioned from the example finder? Or post the code that you are running so that I could test it?
09-01-2010 09:59 AM
Here it is. I cut it out of the main project. The NIPXI_reciver is just to have somethuing to talk to. The t_loop file has 2 loop; one to establish communication one one to communicate. The second one is the one with the timed loop. Changing its execution rate does not change the CPU usage.
09-01-2010 01:38 PM
It is hilarius. I think I got to the bottom of it. The timed loop does not handle a case structure well when it has an error wire on input.
I removed everything from my loop so it does not do anything. There is only a case structure with a constant hooked up to it. When the constant is boolean type the load on the CPU is 0% . When you hook up an error constant it goes to 100% on one core.
Below are the two vis with a boolean and an error constant. There is something that bothers me though. I saw on one run with the booolean control as an input the CPU reaching 100%. Then I switched to a constant. The load went to 0%. Then I swicthed to a boolean control and ... the load stayed at 0%.
Does it make any sense?
09-07-2010 10:20 AM
For those reading this thread. The timed loop has a serius bug. Justin confirmed that on Thursday.
If you wire anything to the "next frame" ports changing the loop period it starts ignoring the period settings and runs at full clock speed - 1kHz was my case. I lost 3 weeks of work because of that.
The bug is in both 2009 and 2010 version. I do not know if it applies only to the RT PC or not.
Justin you said I can report it somewhere. Where would that be?
09-10-2010 05:36 PM
Andy,
Sorry for not getting back to you earlier. But I created CAR#247324 for this issue. Also, I would like to note that this behavior was present back to at least 8.2.1.
Sorry for any inconvenience
And for future reference you can create bug reports by going to NI.com > Contact NI > Request Support and set question type to Reporting a Bug.