Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   how to programatically read 'size' on SunOS? (http://www.go4expert.com/forums/programatically-read-size-sunos-t21048/)

douglaskbell 19Feb2010 21:16

how to programatically read 'size' on SunOS?
How can the 'size' of a process shown by 'top', be read programatically in C on SunOS?

I'm fixing a memory leak in a large (20,000 lines) C program on Solaris.

abubacker1 20Feb2010 12:36

Re: how to programatically read 'size' on SunOS?
Top controls your terminal by using some special terminal characters , thats
for bold the text and highlights it like that ,

If you want to take the process details which has been showned by the top
U better go for ps command ( probably u may use inside the C code too) ,

use the option

for example
ps -eo "%p %y %x %c"

      %C    pcpu    %CPU
      %G    group    GROUP
      %P    ppid    PPID
      %U    user    USER
      %a    args    COMMAND
      %c    comm    COMMAND
      %g    rgroup  RGROUP
      %n    nice    NI
      %p    pid      PID
      %r    pgid    PGID
      %t    etime    ELAPSED
      %u    ruser    RUSER
      %x    time    TIME
      %y    tty      TTY
      %z    vsz      VSZ

For more information refer

man ps

All times are GMT +5.5. The time now is 15:43.