Sponsored Content
Full Discussion: get percentage cpu from pid
Top Forums Shell Programming and Scripting get percentage cpu from pid Post 302270393 by honglus on Sunday 21st of December 2008 06:36:02 PM
Old 12-21-2008
Linux: ps -aux
Solaris:/usr/ucb/ps -aux
 

10 More Discussions You Might Find Interesting

1. Programming

printing ppid,child pid,pid

question: for the below program i just printed the value for pid, child pid and parent pid why does it give me 6 values? i assume ppid is 28086 but can't figure out why there are 5 values printed instead of just two! can someone comment on that! #include<stdio.h> #define DIM 8 int... (3 Replies)
Discussion started by: a25khan
3 Replies

2. HP-UX

How to determine cpu&memory percentage usage per user

Using HP-UX v11 Need to monitor cpu and memory usage, total for system and separately for each user in command-line mode. Found out next ways to monitor total cpu usage under hp-ux: 1) vmstat, also shows free memory 2) sar -M ps -eo user,pcpu - does not work, means 'user-defined format'... (4 Replies)
Discussion started by: hp-ux-user
4 Replies

3. UNIX for Dummies Questions & Answers

Session PID & socket connection pid

1. If I use an software application(which connects to the database in the server) in my local pc, how many PID should be registered? Would there be PID for the session and another PID for socket connection? 2. I noticed (through netstat) that when I logged in using the my software application,... (1 Reply)
Discussion started by: pcx26
1 Replies

4. UNIX for Dummies Questions & Answers

Need to get pid of a process and have to store the pid in a variable

Hi, I need to get the pid of a process and have to store the pid in a variable and i want to use this value(pid) of the variable for some process. Please can anyone tell me how to get the pid of a process and store it in a variable. please help me on this. Thanks in advance, Amudha (7 Replies)
Discussion started by: samudha
7 Replies

5. Programming

How can I get a processor's CPU Percentage?

you know that.. in HP-UX.. in sys/pstat.h struct pst_status { long pst_idx; /* Index for further pstat() requests */ long pst_uid; /* Real UID */ long pst_pid; /* Process ID */ .... float pst_pctcpu; /* %cpu for this process during p_time... (3 Replies)
Discussion started by: sangjinn
3 Replies

6. UNIX for Dummies Questions & Answers

how to get persistant cpu utilization values per process per cpu in linux (! top,ps)

hi, i want to know cpu utilizatiion per process per cpu..for single processor also if multicore in linux ..to use these values in shell script to kill processes exceeding cpu utilization.ps (pcpu) command does not give exact values..top does not give persistant values..psstat,vmstat..does njot... (3 Replies)
Discussion started by: pankajd
3 Replies

7. Solaris

Multi CPU Solaris system shows 100% CPU usage.

Hello Friends, On one of my Solaris 10 box, CPU usage shows 100% using "sar", "vmstat". However, it has 4 CPUs and prstat and glance are not showing enough processes to justify high CPU utilization. ========================================================================= $ prstat -a ... (4 Replies)
Discussion started by: mahive
4 Replies

8. Shell Programming and Scripting

Help with bash script - Need to get CPU usage as a percentage

I'm writing a bash script to log some selections from a sensors output (core temp, mb temp, etc.) and I would also like to have the current cpu usage as a percentage. I have no idea how to go about getting it in a form that a bash script can use. For example, I would simply look in the output of... (3 Replies)
Discussion started by: graysky
3 Replies

9. Shell Programming and Scripting

Finding total Percentage CPU usage

Hi, How can I find total CPU usage in percentage? e.g. if my system has 8 CPUs and I want to list total usage for all of them, is it possible through a command? I have tried some of the commands like top, mpstat, sar. The output of those commands has to be manipulated to derive the percentage... (14 Replies)
Discussion started by: jal_capri
14 Replies

10. Solaris

Capture PRSTAT based on CPU usage percentage

Hi, Recently i have write a simple script to capture CPU high usage based on prstat but i found out that it did capture correctly. I need to capture the rows that contains CPU usage more than 3%. Below line which i thought will capture CPU usage based CPU column in prstat(9th parameter) which is... (3 Replies)
Discussion started by: tharmendran
3 Replies
staux(3)						     Library Functions Manual							  staux(3)

Name
       st_auxbtadd,  st_auxbtsize, st_auxisymadd, st_auxrndxadd, st_auxrndxadd, st_addtq, st_tqhigh_aux, st_shifttq, st_iaux_copyty, st_changeaux,
       st_changeauxrndx  - routines that provide scalar interfaces to auxiliaries

Syntax
       #include <syms.h>

       long st_auxbtadd(bt)
       long bt;

       long st_auxbtsize(iaux,width)
       long iaux;
       long width;

       long st_auxisymadd (isym)
       long isym;

       long st_auxrndxadd (rfd,index)
       long rfd;
       long index;

       long st_auxrndxadd (idn)
       long idn;

       void st_addtq (iaux,tq)
       long iaux;
       long tq;

       long st_tqhigh_aux(iaux)
       long iaux;

       void st_shifttq (iaux, tq)
       int iaux;
       int tq;

       long st_iaux_copyty (ifd, psym)
       long ifd;
       pSYMR psym;

       void st_changeaux (iaux, aux)
       long iaux;
       AUXU aux;

       void st_changeauxrndx (iaux, rfd, index)
       long iaux;
       long rfd;
       long index;

Description
       Auxiliary entries are unions with a fixed length of four bytes per entry.  Much information is packed within the auxiliaries.  Rather  than
       have the compiler front-ends handle each type of auxiliary entry directly, the following set of routines provide a high-level scalar inter-
       face to the auxiliaries:

       st_auxbtadd	   Adds a type information record (TIR) to the auxiliaries.  It sets the basic type (bt) to the  argument  and	all  other
			   fields to zero. The index to this auxiliary entry is returned.

       st_auxbtsize	   Sets the bit in the TIR, pointed to by the iaux argument.  This argument says the basic type is a bit field and adds an
			   auxiliary with its width in bits.

       st_auxisymadd	   Adds an index into the symbol table (or any other scalar) to the auxiliaries.  It sets the value to the  argument  that
			   will occupy all four bytes. The index to this auxiliary entry is returned.

       st_auxrndxadd	   Adds  a relative index, RNDXR, to the auxiliaries.  It sets the rfd and index to their respective arguments.  The index
			   to this auxiliary entry is returned.

       st_auxrndxadd_idn   Works the same as st_auxrndxadd except that RNDXR is referenced by an index into the dense number table.

       st_iaux_copyty	   Copies the type from the specified file (ifd) for the specified symbol into the auxiliary table for the  current  file.
			   It returns the index to the new aux.

       st_shifttq	   Shifts  in the specified type qualifier, tq (see sym.h), into the auxiliary entry TIR, which is specified by the `iaux'
			   index into the current file. The current type qualifiers shift up one tq so that the first tq (tq0) is free for the new
			   entry.

       st_addtq 	   Adds a type qualifier in the highest or most significant non-tqNil type qualifier.

       st_tqhigh_iaux	   Returns the most significant type qualifier given an index into the files aux table.

       st_changeaux	   Changes the iauxth aux in the current file's auxiliary table to aux.

       st_changeauxrndx    Converts the relative index (RNDXR) auxiliary, which is specified by iaux, to the specified arguments.

See Also
       stfd(3)

								       RISC								  staux(3)
All times are GMT -4. The time now is 01:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy