LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.

Notices

Reply
 
Search this Thread
Old 07-18-2003, 04:33 AM   #1
google_man
LQ Newbie
 
Registered: Jul 2003
Posts: 1

Rep: Reputation: 0
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
 
Old 07-18-2003, 08:50 AM   #2
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
You could go with ps or prstat to get basic info.
 
Old 07-31-2003, 11:43 AM   #3
fishsponge
Member
 
Registered: Apr 2003
Location: Cambridge, UK
Distribution: Debian/Solaris
Posts: 147

Rep: Reputation: 15
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...
 
Old 08-01-2003, 03:41 PM   #4
dharmender_rai
Member
 
Registered: Aug 2002
Location: Pune,India
Posts: 39

Rep: Reputation: 15
"top" will help you apart from "ps" .
 
Old 08-04-2003, 06:36 AM   #5
fishsponge
Member
 
Registered: Apr 2003
Location: Cambridge, UK
Distribution: Debian/Solaris
Posts: 147

Rep: Reputation: 15
i don't think top is available as standard on Solaris though... you can get it from here though:
http://www.sunfreeware.com/
 
Old 08-04-2003, 08:59 AM   #6
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
On a Solaris system, prstat offers similar information.
 
Old 08-04-2003, 09:02 AM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967
please don't use words like urgent, all our members are voluntary and it's not fair to ask for urgent replies etc...
 
Old 08-04-2003, 09:23 AM   #8
fishsponge
Member
 
Registered: Apr 2003
Location: Cambridge, UK
Distribution: Debian/Solaris
Posts: 147

Rep: Reputation: 15
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
 
Old 08-04-2003, 10:07 AM   #9
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
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.

Last edited by stickman; 08-04-2003 at 10:09 AM.
 
Old 08-04-2003, 10:22 AM   #10
fishsponge
Member
 
Registered: Apr 2003
Location: Cambridge, UK
Distribution: Debian/Solaris
Posts: 147

Rep: Reputation: 15
wow! that's cool!
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!
 
Old 08-04-2003, 10:35 AM   #11
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
That's 1 second intervals and 1 count.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
!!!! Urgent, using chown command ? AQG Linux - Security 8 08-12-2005 04:21 PM
URGENT : pb with insmod command pierre44 Linux - Newbie 1 07-11-2005 07:59 AM
"Doubt in Implementing top command " manikantha Programming 1 09-24-2004 08:20 AM
Problem with ls command URGENT pony85 Linux - Newbie 32 08-05-2004 03:53 PM
tar command problem:urgent imsajjadali Linux - General 1 01-30-2004 05:50 AM


All times are GMT -5. The time now is 09:04 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration