LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically Monitoring RT Memory Remotely

Hello,

 

Does anyone know if there's a way to monitor the memory of an RT target remotely without using RT System Manager?  I've been given an RT application that appears to have a memory leak.  I'd really like to set up a logging VI to watch the memory usage over time, but without that ability it's hard to get a clear picture of what's going on.  I'm aware of "RT Get Memory Usage.vi" and I've used it before, but I can't use it except locally on the target, and I'd rather not log to my cRIO's flash memory if I can help it.  I suppose I could write some TCP code to regularly transfer the memory usage over to a Windows application, but what if the TCP code itself is causing the memory leak?

 

If such a VI or function exists, I'd love to know about it, and if it doesn't exist, it would be really nice if someone at NI released one.

 

Any ideas?

 

Thanks in advance,

 

Jim

Message 1 of 13
(4,270 Views)

Hi Mr. Jim,

 

Why can you not use the RT system manager? I would say that would be the best way to do what you are describing. As far as creating a TCP transfer and your worry about that causing more memory problems, I believe that any method of monitoring the performance of the remote system would either take up system resources on the target itself, or would require some method of communication, which could theoretically cause memory issues of its own.

 

Regards,

Stephen S.
National Instruments
Applications Engineering
Message 2 of 13
(4,228 Views)

Hi Stephen,

 

Thanks for your reply.  Well, it's not that I can't use RT System Manager - it's just that it's a crude tool for what I'm trying to do.  What I mean by this is that I'm using System Manager to keep an eye on the memory over a prolonged period of time.  System Manager is a bit awkward because, to see memory usage all the time as an "alert," I've got to set up an alert that occurs when memory usage exceeds zero.  Then, all the alerts occur at regular intervals.  No problem; this works well enough.  To log the alerts, there's no way to set up a file and have a sort of disk-streaming setup.  The only way to log alerts is after the fact.  This isn't so bad, but I'm working on a lot of really large applications all the time and I regularly crash LabVIEW, and when that happens, I lose all of the memory data.  (I'm not at all saying that LabVIEW is unstable; Most of the time I have great luck with it.  I'm just dealing with some very complex and unusal code on a regular basis)  So then, as I said, it's not that I can't use it - I'm just hoping that there's a better way.

 

Apparently there is a better way!  After I wrote some slightly frustrated feedback to NI's product support, Mike from NI got back to me, and he said:

 

"There is a new feature in LabVIEW RT 8.6 that should solve your problem (logging Memory usage on an RT Target). Every RT Target now publishes its CPU and Memory usage levels as variables under the NI_SystemState process. Specifically, you can read the value of


\\target\NI_SystemState\Memory\Allocated

to see the current memory usage of your target. If you have DSC, you can bind this to a variable with logging, or you can just read and log the value yourself."

 

Mike, if you're reading this, I hope you don't mind my quoting you on this one, but I'm very grateful for your response and I thought I'd share the wealth.  I'm not using DSC, but I did successfully retrieve the variable using LOGOS via the datasockets protocol.  For those unfamiliar with the process, I've attached a screenshot.

 

Thanks again to Mike!  (And to Stephen for replying to my post)

 

Jim

0 Kudos
Message 3 of 13
(4,206 Views)

Hi Jim,

 

Thanks for sharing that tip - definitely very useful.

 

Just for reference, one method I've used with older LabVIEW versions is to call the 'RT Get Memory Usage.vi' remotely (see attached).

 

Ian

 

 

Message 4 of 13
(4,175 Views)

Hi Ian,

 

Right!  Of course, I could've used VI server... I forgot about that for some reason.  Maybe it's because I'm used to creating completely autonomous stuff for use on RT platforms.  I've used that VI a bunch of times locally on the RT host, but I didn't think to call it remotely.  (That would've actually made sense!)  Thanks for helping me out with that.

 

Jim

0 Kudos
Message 5 of 13
(4,162 Views)

Jim,

 

I agree it's best to avoid VI server wherever possible for RT applications - the new way sounds much better.

 

Do you know how I can get a list of what other variables/properties are available this way?

 

Thanks,

Ian

0 Kudos
Message 6 of 13
(4,156 Views)

No, unfortunately, I don't have any sort of listing, and as far as I know there's no way to enumerate the variables.  However, I did ask the NI folks the same question and I haven't heard anything yet.  I'd love to know what the other variables are, too, because it sounds like there's a lot of useful information there.

 

If I hear anything, I'll certainly post it here, though.

0 Kudos
Message 7 of 13
(4,154 Views)

Ian,

 

I guess you learn something new every day.  Mike at NI got back to me, and there's a tool that's new with LabVIEW 8.6 called the Distributed System Manager.  It's included with LabVIEW 8.6, but it's also available as a standalone installer.  I searched NI's site, and there's been a little discussion on it here and there, but it's so new that I guess a lot of people (including myself) were unaware of it.  It's under the Tools->Distributed System Manager, about midway down the menu.  What a great tool!  It lists all of the variables that are accessible on remote systems, including network-published shared variables.  There aren't too many system variables listed under my RT target, but maybe that's because it's so new.  Here's an online manual that explains all of the features and capabilities.  The only caveat I could see is that there are now several places to configure and view remote targets: MAX, Project Explorer, and now the Distributed System Manager.  Even so, this looks to be rather handy.

 

 

Jim

 

0 Kudos
Message 8 of 13
(4,145 Views)

That's great, thank you.

 

I was going to wait for 8.6.1 before upgrading, but this might tip the balance!

 

Ian

0 Kudos
Message 9 of 13
(4,131 Views)
You could try the standalone installer without installing LabVIEW 8.6, but from what I gather, targets running previous versions of LabVIEW RT may not have the variables published.  (If anyone knows for sure, feel free to correct me)  It might be worth a try if you think you'll use the features.
0 Kudos
Message 10 of 13
(4,128 Views)