- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- The output of ps -u command and pstat_getproc() is...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2005 03:15 AM
03-22-2005 03:15 AM
The output of ps -u command and pstat_getproc() is different.
I'm trying to get the size of the process, for that I'm using the command "UNIX95= ps -u udb -o vsz -o args".
I also have a program which gives the size of the process it uses pstat_getproc.
The following is the code that is used to get the process size,
struct pst_status pst;
unsigned long process_size;
if (pstat_getproc(&pst, sizeof(pst), (size_t)0, pid) != -1)
{
process_size = (size_t) (pst.pst_dsize+ pst.pst_tsize+ pst.pst_ssiz
e);
process_size *= sysconf(_SC_PAGE_SIZE); //convert # of pages to byt
es
process_size /= (1024); //return value is in KB
if (cmd != (char *) NULL)
strcpy(cmd, pst.pst_ucomm);
}
variable process_size will have the size of the process.
The output of ps -u is different from that of pstat_getproc(). ps -u value is larger than pstat_getproc.
Can any one tell me the reason for this and suggest me the correct command
Your help is appreciated.
Thanks,
RamaRao
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2005 03:21 AM
03-22-2005 03:21 AM
Re: The output of ps -u command and pstat_getproc() is different.
Based on your calculations it would seem your command might be more accurate than the ps command. But its supposedly reading the process table, so it can be confusing.
It might be how pstat_getproc works introducing the error.
It would be useful for us to see the output prior to making suggestions on how to change your code.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2005 03:28 AM
03-22-2005 03:28 AM
Re: The output of ps -u command and pstat_getproc() is different.
The difference between ps -u output and pstat_getproc() is very huge.
ps -u output is 696MB and pstar_getproc() output is 350MB. Now I'm in dilema on to use which command.
So please recommend the correct one and reason why it should be used would be great.
I would like to know the reason also, so could you please help me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2005 08:01 PM
03-22-2005 08:01 PM
Re: The output of ps -u command and pstat_getproc() is different.
I would suggest you look at glance output for the process and then decide - perhaps one tool is giving the RSS (resident set size) and the other is reporting the total virtual memory set size (VSS)...?
Personally, I would trust the output from the ps command (assuming you have latest patches - latest for ps(1) is PHCO_31978)
HTH
Regards,
Nick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2005 01:44 AM
03-23-2005 01:44 AM
Re: The output of ps -u command and pstat_getproc() is different.
manpage of ps is misleading. You need to use '-o sz' to get the footprint of process in physical memory. The other option '-o vsz' gives the virtual memory footprint i.e. physical+swap area size.
-Amit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2005 04:49 PM
03-23-2005 04:49 PM
Re: The output of ps -u command and pstat_getproc() is different.
sz = pst.pst_dsize + pst.pst_tsize + pst.pst_ssize
vsz = (pst.pst_vdsize + pst.pst_vtsize + pst.pst_vssize) * _SC_PAGE_SIZE