1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to programatically read 'size' on SunOS?

Discussion in 'C' started by douglaskbell, Feb 19, 2010.

  1. douglaskbell

    douglaskbell New Member

    Joined:
    Feb 19, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    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.
     
  2. abubacker1

    abubacker1 New Member

    Joined:
    Feb 20, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    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
    Code:
    for example 
    ps -eo "%p %y %x %c"
    
    since 
     CODE   NORMAL   HEADER
           %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
    Code:
    man ps 
    
     

Share This Page