Sponsored Content
Top Forums Programming How can I get a processor's CPU Percentage? Post 8717 by sangjinn on Wednesday 17th of October 2001 01:31:19 AM
Old 10-17-2001
because..

first of all..
thanks for your kindly reply..

I want to know about getting cpu percentage not use structure
because in SCO-UNIX, there is no cpu percentage ..but only
cpu time ( timestruc_t pr_utime; )
so.. I asked get that percantage without structure..

I can get get cpu percentage in HP-UX using pstat.h..
but.. How can I get cpu percentage in SCO-UNIX ??

/** SCO-UNIX , procfs.h **/
typedef struct pstatus {
....
pid_t pr_pid; /* Process id */
pid_t pr_ppid; /* Parent process id */
pid_t pr_pgid; /* Process group id */
pid_t pr_sid; /* Session id */
timestruc_t pr_utime; /* Process user cpu time */
timestruc_t pr_stime; /* Process system cpu time */
timestruc_t pr_cutime; /* Sum of children's user times */
timestruc_t pr_cstime; /* Sum of children's system times */
sigset_t pr_sigtrace; /* Mask of traced signals */
fltset_t pr_flttrace; /* Mask of traced faults */
sysset_t pr_sysentry; /* Mask of system calls traced on
} pstatus_t;
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Clearify what it means under 'WHAT' when hit the 'w'-command

I wonder how I shall read the result below, especially 'what' shown below. The result was shown when I entered 'w'. E.g what is TOP? What is gosh ( what does selmgr mean?)? login@ idle JCPU PCPU what 6:15am 7:04 39 39 TOP 6:34am 6:45 45 45 TOP 6:41am ... (1 Reply)
Discussion started by: Aelgen
1 Replies

2. UNIX for Dummies Questions & Answers

CPU's

I have a question. Is Linux (Redhat 7.2 specifically) set up to run better/faster on a Pentium cpu vs. an AMD? The reason I ask is, I have a PIII 733 w/512 pc133, and a 4mb video card at work, and an AMD 1.4 w/1gb ddr, and a Radeon 64mb DDR at home, and the PIII at work runs a lot faster. I have a... (1 Reply)
Discussion started by: jeremiebarber
1 Replies

3. 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

4. AIX

CPU Processor ID

Hallo, does anybody knows a trick to change the Processor ID in AIX 4.3.3. Thanks a lot (9 Replies)
Discussion started by: UXNI
9 Replies

5. Shell Programming and Scripting

get percentage cpu from pid

Hi all, I need a script that will check the cpu usage of a certain process and then kill the process if the % cpu is greater than 25%. I know i can get the pid of a process by doing pidof <processname>. Once I have the pid number is there a command in bash to return the current % cpu? (2 Replies)
Discussion started by: borderblaster
2 Replies

6. 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

7. 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

8. Hardware

Nodes/Processor/CPU's/threads/packages

Hello, can anyone explain me this jargon "Nodes/Processor/CPU's/threads/packages":confused: and what's the relation between these, I need to work on a cluster and I can not figure out the terminology. Thanks! any good link to read about these would also be very helpful Thanks! ... (1 Reply)
Discussion started by: nonothing
1 Replies

9. Solaris

CPU/processor/cores in M4000

Hi Gurus Can someone help me in explaining the below outputs . psrinfo -p 4 /usr/sbin/psrinfo -pv The physical processor has 4 virtual processors (0-3) SPARC64-VI (portid 1024 impl 0x6 ver 0x93 clock 2150 MHz) The physical processor has 4 virtual processors (8-11) SPARC64-VI... (3 Replies)
Discussion started by: ningy
3 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
pset_create(2)							   System Calls 						    pset_create(2)

NAME
pset_create, pset_destroy, pset_assign - manage sets of processors SYNOPSIS
#include <sys/pset.h> int pset_create(psetid_t *newpset); int pset_destroy(psetid_t pset); int pset_assign(psetid_t pset, processorid_t cpu, psetid_t *opset); DESCRIPTION
These functions control the creation and management of sets of processors. Processor sets allow a subset of the system's processors to be set aside for exclusive use by specified LWPs and processes. The binding of LWPs and processes to processor sets is controlled by pset_bind(2). The pset_create() function creates an empty processor set that contains no processors. On successful return, newpset will contain the ID of the new processor set. The pset_destroy() function destroys the processor set pset, releasing its constituent processors and processes. If pset is PS_MYID, the processor set to which the caller is bound is destroyed. The pset_assign() function assigns the processor cpu to the processor set pset. A processor that has been assigned to a processor set will run only LWPs and processes that have been explicitly bound to that processor set, unless another LWP requires a resource that is only available on that processor. On successful return, if opset is non-null, opset will contain the processor set ID of the former processor set of the processor. If pset is PS_NONE, pset_assign() releases processor cpu from its current processor set. If pset is PS_QUERY, pset_assign() makes no change to processor sets, but returns the current processor set ID of processor cpu in opset. If pset is PS_MYID, processor cpu is assigned to the processor set to which the caller belongs. If the caller does not belong to a proces- sor set, processor cpu is released from its current processor set. These functions are restricted to privileged processes, except for pset_assign() when pset is PS_QUERY. RETURN VALUES
Upon successful completion, these functions return 0. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
These functions will fail if: EBUSY The processor could not be moved to the specified processor set. EFAULT The location pointed to by newpset was not writable by the user, or the location pointed to by opset was not NULL and not writable by the user. EINVAL The specified processor does not exist, the specified processor is not on-line, or an invalid processor set was specified. ENOMEM There was insufficient space for pset_create to create a new processor set. ENOTSUP The pools facility is active. See pooladm(1M) and pool_set_status(3POOL) for information about enabling and disabling the pools facility. EPERM The {PRIV_SYS_RES_CONFIG} privilege is not asserted in the effective set of the calling process. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |Async-Signal-Safe | +-----------------------------+-----------------------------+ SEE ALSO
pooladm(1M), psradm(1M), psrinfo(1M), psrset(1M), p_online(2), processor_bind(2), pset_bind(2), pset_info(2), pool_set_status(3POOL), pset_getloadavg(3C), attributes(5), privileges(5) NOTES
The processor set type of PS_SYSTEM is no longer supported. Processors with LWPs bound to them using processor_bind(2) cannot be assigned to a new processor set. If this is attempted, pset_assign() will fail and set errno to EBUSY. SunOS 5.11 22 Feb 2008 pset_create(2)
All times are GMT -4. The time now is 05:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy