How to get information about Linux, whether my program is running or not?

More specifically: I want to find this information from within the program, preferably just before it starts replacing so that I can respond. So far I have discovered:

  • Information inside /proc, which is not very useful.

  • mincore syscall, which seems to be available on linux and bsd but requires me to go through all the pages you are interested in (maybe enough, but it's a little tedious)

Any ideas?

+5
source share
1 answer

vmstat

To run every 2 seconds you say "vmstat 2". It gives you output, for example:

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0  16124 431352 439000    0    0     4     2   37   18  0  0 100  0  0

"si" "so" "swap-in" "swap-out". Swapd - . Swapd , si .

:

: " " - " ". - .. , - d... i..e... s....

+2

All Articles