LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get the process ID (pid)

Hi!

 

It seems the PID is "PID" in most languages. But for example the memory usage is translated and it uses some human readable format which needs to be parsed.

 

I have used this .NET-based solution to find out the PID and it also gives information about memory usage and CPU time in the property node:

 

pid.png

 

Also, if the VI is compiled into an executable, this code will automatically return the PID of this executable, which is not LabVIEW.exe.

 

 

 

By the way:

I'd use ^PID:\s*(\d*)$ as RegEx.

^ and $ are markers for the beginning and end of line. Not really necessary here, but maybe in other use cases.

\s* finds as many whitespaces as possible.

(\d*) finds the PID. The parentheses make this result a "group". If you extend the RegEx-Vi, addidtional string outputs for groups will appear, and the first of them will give just the PID - so no need for a second search for numbers.

 

0 Kudos
Message 11 of 11
(532 Views)