LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Solaris / OpenSolaris (https://www.linuxquestions.org/questions/solaris-opensolaris-20/)
-   -   os command doubt===urgent (https://www.linuxquestions.org/questions/solaris-opensolaris-20/os-command-doubt%3D%3D%3Durgent-73767/)

google_man 07-18-2003 03:33 AM

os command doubt===urgent
 
Hi experts,
I'm developing a c program in solaris machine. Iam stuck in a situation. I want to know the amount of virtual memory a particuliar process will take.for exmaple a process align.c is running currently. I want to know the amount of virtual memory align.c takes..........

Thanks in advance

MS

stickman 07-18-2003 07:50 AM

You could go with ps or prstat to get basic info.

fishsponge 07-31-2003 10:43 AM

try and visit /proc/ and change into the directory of the PID. you will see stuff that looks similar to the following:
Code:

bash-2.05# pwd
/proc/444
bash-2.05# ls -l
total 35837
-rw-------  1 hobbs    staff    18317312 Jun 29 07:26 as
-r--------  1 hobbs    staff        152 Jun 29 07:26 auxv
-r--------  1 hobbs    staff        32 Jun 29 07:26 cred
--w-------  1 hobbs    staff          0 Jun 29 07:26 ctl
lr-x------  1 hobbs    staff          0 Jun 29 07:26 cwd ->
dr-x------  2 hobbs    staff      8208 Jun 29 07:26 fd
-r--r--r--  1 hobbs    staff        120 Jun 29 07:26 lpsinfo
-r--------  1 hobbs    staff        912 Jun 29 07:26 lstatus
-r--r--r--  1 hobbs    staff        536 Jun 29 07:26 lusage
dr-xr-xr-x  3 hobbs    staff        48 Jun 29 07:26 lwp
-r--------  1 hobbs    staff      2112 Jun 29 07:26 map
dr-x------  2 hobbs    staff        544 Jun 29 07:26 object
-r--------  1 hobbs    staff      4480 Jun 29 07:26 pagedata
-r--r--r--  1 hobbs    staff        336 Jun 29 07:26 psinfo
-r--------  1 hobbs    staff      2112 Jun 29 07:26 rmap
lr-x------  1 hobbs    staff          0 Jun 29 07:26 root ->
-r--------  1 hobbs    staff      1472 Jun 29 07:26 sigact
-r--------  1 hobbs    staff      1232 Jun 29 07:26 status
-r--r--r--  1 hobbs    staff        256 Jun 29 07:26 usage
-r--------  1 hobbs    staff          0 Jun 29 07:26 watch
-r--------  1 hobbs    staff      3344 Jun 29 07:26 xmap
bash-2.05#

This is the place where all info about all running processes is stored. you should be able to find quite a lot out here... :D

dharmender_rai 08-01-2003 02:41 PM

"top" will help you apart from "ps" .

fishsponge 08-04-2003 05:36 AM

i don't think top is available as standard on Solaris though... you can get it from here though:
http://www.sunfreeware.com/

stickman 08-04-2003 07:59 AM

On a Solaris system, prstat offers similar information.

acid_kewpie 08-04-2003 08:02 AM

please don't use words like urgent, all our members are voluntary and it's not fair to ask for urgent replies etc...

fishsponge 08-04-2003 08:23 AM

Quote:

Originally posted by stickman
On a Solaris system, prstat offers similar information.
but the problem with prstat (and top) is the fact that they run indefinitely without user intervention.

something like the 'ps -ef' command, but with the detail from the 'prstat' command is needed i think :D

stickman 08-04-2003 09:07 AM

prstat works like the iostat and vmstat. You can specify the interval and count as options, ie prstat 1 1. top has a similar option to specify the number of interations.

fishsponge 08-04-2003 09:22 AM

wow! that's cool! :D
Code:

bash-2.05$ prstat 1 1
  PID USERNAME  SIZE  RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP     
  444 hobbs      17M  16M run      0  19 419:55:51  46% setiathome/1
  1246 hobbs    2456K 1680K run      0  19 380:56:13  46% dnetc/2
  8080 root    4544K 2736K sleep  59    0  0:00:00 2.7% sshd/1
  301 root      170M  66M sleep  49    0  11:27:20 1.3% Xsun/1
  422 hobbs      15M 8464K sleep  49    0  8:49:47 0.8% gnome-terminal/1
  8087 hobbs    4440K 4160K cpu0    39    0  0:00:00 0.5% prstat/1
<<snip>>
Total: 77 processes, 146 lwps, load averages: 2.31, 2.32, 2.30
bash-2.05$

Code:

hobbs@turnip:~$ top -n 1
94 processes: 90 sleeping, 4 running, 0 zombie, 0 stopped
CPU states:  8.6% user,  4.7% system,  85.9% nice,  0.9% idle
Mem:    190472K total,  162236K used,    28236K free,    14496K buffers
Swap:  498004K total,    4660K used,  493344K free,    72964K cached

  PID USER    PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM  TIME COMMAND
 3081 hobbs    20  19 14284  13M  608 R N  44.7  7.4 336:06 setiathome
 3118 hobbs    19  19  576  576  504 R N  43.8  0.3 335:53 dnetc
30225 hobbs    18  0  976  976  748 R    8.2  0.5  0:00 top
    1 root      8  0  480  436  416 S    0.0  0.2  0:12 init
    2 root      9  0    0    0    0 SW    0.0  0.0  0:00 keventd
    3 root      19  19    0    0    0 SWN  0.0  0.0  0:00 ksoftirqd_CPU0
<<snip>>
hobbs@turnip:~$

what does the first 1 and the second 1 do to the prstat command though? i can't find anything about it in the man pages... 'prstat 1' appears to do exactly the same as 'prstat'... but when the second 1 is added, it only does one iteration! :D

stickman 08-04-2003 09:35 AM

That's 1 second intervals and 1 count.


All times are GMT -5. The time now is 07:13 PM.