Sponsored Content
Operating Systems HP-UX how could I get a process Memory Usage Post 302309439 by alert0919 on Tuesday 21st of April 2009 11:56:16 PM
Old 04-22-2009
how could I get a process Memory Usage

I use pstat API to get Process Infomation
I would like to get a process
1.process owner
2.how many physical memory and virtual memory and total memory used(KB) and usage(%)
3.a process excution file create time
4.a process excution file access time

I do't know which attribute it i need

thanks
_T_LONG_T pst_uid; /* Real UID */
_T_LONG_T pst_pid; /* Process ID */
_T_LONG_T pst_ppid; /* Parent process ID */
_T_LONG_T pst_dsize; /* # real pages used for data */
_T_LONG_T pst_tsize; /* # real pages used for text */
_T_LONG_T pst_ssize; /* # real pages used for stack */
_T_LONG_T pst_nice; /* Nice value */
struct __psdev pst_term;/* TTY of this process; -1/-1 if there isn't one */
_T_LONG_T pst_pgrp; /* Process group of this process */
_T_LONG_T pst_pri; /* priority of process */
_T_LONG_T pst_addr; /* address of process (in memory) */
_T_LONG_T pst_cpu; /* processor utilization for scheduling */
_T_LONG_T pst_utime; /* user time spent executing (in seconds) */
_T_LONG_T pst_stime; /* system time spent executing (in seconds) */
_T_LONG_T pst_start; /* time process started (seconds since epoch) */
_T_LONG_T pst_flag; /* flags associated with process */
_T_LONG_T pst_stat; /* Current status */
_T_LONG_T pst_wchan; /* If state PS_SLEEP, value sleeping on */
_T_LONG_T pst_procnum; /* processor this proc last run on */
char pst_cmd[PST_CLEN]; /* Command line for the process, if available */
_T_LONG_T pst_time; /* resident time for scheduling */
_T_LONG_T pst_cpticks; /* ticks of CPU time */
_T_LONG_T pst_cptickstotal; /* total ticks for life of process */
_T_LONG_T pst_fss; /* fair share scheduler group ID */
float pst_pctcpu; /* %CPU for this process during p_time */
_T_LONG_T pst_rssize; /* resident set size for process (private pages)*/
_T_LONG_T pst_suid; /* saved UID */
char pst_ucomm[PST_UCOMMLEN]; /* executable basename the process is running*/
_T_LONG_T pst_shmsize; /* # real pages used for shared memory */
_T_LONG_T pst_mmsize; /* # real pages used for memory mapped files */
_T_LONG_T pst_usize; /* # real pages used for U-Area & K-Stack */
_T_LONG_T pst_iosize; /* # real pages used for I/O device mapping */
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

how to restrict memory usage by a process

we are running red hat ES4 and i would like to know if there is anyway of restrcting the maximum amount of memory that a process can get? I have a single preocess that is taking >13GB. Thanks, Frank (4 Replies)
Discussion started by: frankkahle
4 Replies

2. Solaris

RAM Physical Memory usage by each Process.

Hi All, I am trying to find the physical memory usage by each process/users. Can you please let me know how to get the memory usage?. Thanks, bsraj. (12 Replies)
Discussion started by: bsrajirs
12 Replies

3. Shell Programming and Scripting

Memory usage of a process

hi all, i want to write a script that checks the memory usage of processes and send a mail with the name of the process witch is using more then 300mb RAM. dose anybody have a sample script or an idea how i can make it ? PROCCESSES="snmpd sendmail" for myVar in $PROCCESSES do ... (7 Replies)
Discussion started by: tafil
7 Replies

4. AIX

How to trace cpu/memory usage for a process

I don't know when the process will start and end, I need write a script to trace it's cpu/memory usage when it is runing. How to write this script? (2 Replies)
Discussion started by: rainbow_bean
2 Replies

5. Programming

Memory usage of a process having shared libraries

Hi, I have the following two processes that's built with static libraries. Both the process have many common libraries. -rwxr-xr-x 1 xxx xxx 152946280 Oct 15 08:38 server1 -rwxr-xr-x 1 xxx xxx 41633880 Oct 15 08:39 server2. I built these two server processes making all the... (1 Reply)
Discussion started by: srivatsan_vn
1 Replies

6. Emergency UNIX and Linux Support

Memory usage of a process having shared libraries

Hi, I have the following two processes that's built with static libraries. Both the process have many common libraries. -rwxr-xr-x 1 xxx xxx 152946280 Oct 15 08:38 server1 -rwxr-xr-x 1 xxx xxx 41633880 Oct 15 08:39 server2. I built these two server processes making all the... (1 Reply)
Discussion started by: srivatsan_vn
1 Replies

7. UNIX for Advanced & Expert Users

collecting memory usage by a process

Hi Guys, I work on a AIX environment and I'm trying to write a script where I can collect all the memory used by a process. Basically I'm executing the command 'ps -fu userid' to get all the process ids and then executing the 'ps v PID' to get all the memory allocated by PPID. My question is... (2 Replies)
Discussion started by: arizah
2 Replies

8. HP-UX

Virtual Memory Usage a Process

Hi all, Is there any command which shows the virtual memory usage of a particular process in HP-UX machine. I have tried with ps, top but could not get what I want. Kindly provide me a solution. Thanks in Advance ARD (4 Replies)
Discussion started by: ard
4 Replies

9. Solaris

Process memory usage

hi all gurus: I want to find out Solaris process memory usage, but got a bit confused, see if any one can provide me some guidance. i tend to use prstat -a to get total memory consumption by user (I know prstat likely have a bug that simply sum up the memory, regardless if the memory being... (5 Replies)
Discussion started by: oakville
5 Replies

10. Solaris

Find memory usage for a process

I have multiple oracle databases on one server. All the database are running from the same user i.e. oraent. The process for each database can be distinguished by the ps -ef command Eg : ps -ef | grep oraentThe Output : oraent 5361 1 0 20:58:05 ? 0:00 oracledb1... (11 Replies)
Discussion started by: yashreads
11 Replies
GETRUSAGE(2)							System Calls Manual						      GETRUSAGE(2)

NAME
getrusage - get information about resource utilization SYNOPSIS
#include <sys/time.h> #include <sys/resource.h> #define RUSAGE_SELF 0 /* calling process */ #define RUSAGE_CHILDREN -1 /* terminated child processes */ getrusage(who, rusage) int who; struct rusage *rusage; DESCRIPTION
Getrusage returns information describing the resources utilized by the current process, or all its terminated child processes. The who parameter is one of RUSAGE_SELF or RUSAGE_CHILDREN. The buffer to which rusage points will be filled in with the following structure: struct rusage { struct timeval ru_utime; /* user time used */ struct timeval ru_stime; /* system time used */ long ru_maxrss; long ru_ixrss; /* integral shared text memory size */ long ru_idrss; /* integral unshared data size */ long ru_isrss; /* integral unshared stack size */ long ru_minflt; /* page reclaims */ long ru_majflt; /* page faults */ long ru_ovly; /* overlay changes */ long ru_nswap; /* swaps */ long ru_inblock; /* block input operations */ long ru_oublock; /* block output operations */ long ru_msgsnd; /* messages sent */ long ru_msgrcv; /* messages received */ long ru_nsignals; /* signals received */ long ru_nvcsw; /* voluntary context switches */ long ru_nivcsw; /* involuntary context switches */ }; The fields are interpreted as follows: ru_utime the total amount of time spent executing in user mode. ru_stime the total amount of time spent in the system executing on behalf of the process(es). ru_maxrss the maximum resident set size utilized (in kilobytes). ru_ixrss an "integral" value indicating the amount of memory used by the text segment that was also shared among other processes. This value is expressed in units of kilobytes * seconds-of-execution and is calculated by summing the number of shared mem- ory pages in use each time the internal system clock ticks and then averaging over 1 second intervals. ru_idrss an integral value of the amount of unshared memory residing in the data segment of a process (expressed in units of kilo- bytes * seconds-of-execution). ru_isrss an integral value of the amount of unshared memory residing in the stack segment of a process (expressed in units of kilo- bytes * seconds-of-execution). ru_minflt the number of page faults serviced without any I/O activity; here I/O activity is avoided by "reclaiming" a page frame from the list of pages awaiting reallocation. ru_majflt the number of page faults serviced that required I/O activity. the number of times a process requested a text overlay switch - only available under 2_10BSD. ru_nswap the number of times a process was "swapped" out of main memory. ru_inblock the number of times the file system had to perform input. ru_outblock the number of times the file system had to perform output. ru_msgsnd the number of IPC messages sent. ru_msgrcv the number of IPC messages received. ru_nsignals the number of signals delivered. ru_nvcsw the number of times a context switch resulted due to a process voluntarily giving up the processor before its time slice was completed (usually to await availability of a resource). ru_nivcsw the number of times a context switch resulted due to a higher priority process becoming runnable or because the current process exceeded its time slice. NOTES
The numbers ru_inblock and ru_outblock account only for real I/O; data supplied by the caching mechanism is charged only to the first process to read or write the data. ERRORS
The possible errors for getrusage are: [EINVAL] The who parameter is not a valid value. [EFAULT] The address specified by the rusage parameter is not in a valid part of the process address space. SEE ALSO
gettimeofday(2), wait(2) BUGS
There is no way to obtain information about a child process that has not yet terminated. 4th Berkeley Distribution May 13, 1986 GETRUSAGE(2)
All times are GMT -4. The time now is 05:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy