X
7531 Rate this article:
No rating

Getting the IDL process identifier on Linux

Anonym

Atle Borsholm showed me this technique for getting IDL's process identifier (or process id or pid) on Linux (though it should work on any UNIX-based system):

IDL> pid = call_external('libc.so.6', 'getpid')
IDL> print, pid
       22468

I used this recently with pmap to get the memory map of an IDL process; I was curious to see how the OS reported the memory use of IDL plus the shared libraries it uses. For example, SPAWN a call to pmap:

IDL> spawn, 'pmap' + string(pid), pid_memory
IDL> print, ulong((strsplit(pid_memory[-1], /extract))[-1])
      137672

where pmap returns the total memory use in kilobytes, and compare this with the output from MEMORY, scaled to KB:

IDL> print, memory(/current) / 1024
        1029

The difference is that MEMORY (as noted on its Help page) doesn't include memory used by shared libraries.