01-19-2006
Finding cpu usage of another process is generally a hardware dependent kind of thing.
What hardware and OS are you using?
Plus, most of the tools available for system information usually work better in a shell script. C is normally not the best choice.
10 More Discussions You Might Find Interesting
1. Programming
how can i monitor usages of CPU, Memory, Hard disk etc. under SUN Solaries
through a c program or java program
i want to store that data into database so i can show it graphically
thanks in advance (2 Replies)
Discussion started by: Gajanad Bihani
2 Replies
2. Shell Programming and Scripting
For analysis, I need to gather CPU usage from say 1:00 PM to 2:00 PM every 10 seconds on a given day. I heard this can be done with awk, but my UNIX is kind of rusty. (4 Replies)
Discussion started by: WG1
4 Replies
3. Programming
Please tell me solaris functions/api for getting following information
1- Function that tells how much memory used by current process
2- Function that tells how much memory used by all running processes
3- Function that tells how much CPU is used by current process
4- Function that tells how... (1 Reply)
Discussion started by: mansoorulhaq
1 Replies
4. Solaris
Folks,
I need to find out from the system logs ( or elsewhere ) if the CPU utilization reached say 90% an hour ago from now.
Is there a way out. (2 Replies)
Discussion started by: kavera
2 Replies
5. HP-UX
how can I find cpu usage memory usage swap usage and
I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times
my final destination is monitor process
logical volume usage above X % and number of Logical voluage above
can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies
6. Solaris
Hi,
I want to monitor the current cpu usage, monitor usage , disk I/o and network utlization for solaris using SNMP.
I want the oids for above tasks.
can you please tell me that
Thank you (2 Replies)
Discussion started by: S_venkatesh
2 Replies
7. Solaris
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. AIX
How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies
9. UNIX for Advanced & Expert Users
Hi,
By using time command we can determine the execution time of a process or command.
bash-2.04$ time ls -l
total 0
-rw-r--r-- 1 admin tac 0 Oct 6 04:46 file1
-rw-r--r-- 1 admin tac 0 Oct 6 04:46 file2
real 0m0.002s
user 0m0.000s
sys 0m0.001s... (5 Replies)
Discussion started by: learn more
5 Replies
10. BSD
Hi,
If anyone know Please answer me the following question :
How to find the usage of individual core cpu usage in FreeBsd server?
What command is used for that?
Thanks,
Maruthu (2 Replies)
Discussion started by: maruthu
2 Replies
TASKSET(1) Linux User's Manual TASKSET(1)
NAME
taskset - retrieve or set a process's CPU affinity
SYNOPSIS
taskset [options] mask command [arg]...
taskset [options] -p [mask] pid
DESCRIPTION
taskset is used to set or retrieve the CPU affinity of a running process given its PID or to launch a new COMMAND with a given CPU affin-
ity. CPU affinity is a scheduler property that "bonds" a process to a given set of CPUs on the system. The Linux scheduler will honor the
given CPU affinity and the process will not run on any other CPUs. Note that the Linux scheduler also supports natural CPU affinity: the
scheduler attempts to keep processes on the same CPU as long as practical for performance reasons. Therefore, forcing a specific CPU
affinity is useful only in certain applications.
The CPU affinity is represented as a bitmask, with the lowest order bit corresponding to the first logical CPU and the highest order bit
corresponding to the last logical CPU. Not all CPUs may exist on a given system but a mask may specify more CPUs than are present. A
retrieved mask will reflect only the bits that correspond to CPUs physically on the system. If an invalid mask is given (i.e., one that
corresponds to no valid CPUs on the current system) an error is returned. The masks are typically given in hexadecimal. For example,
0x00000001
is processor #0
0x00000003
is processors #0 and #1
0xFFFFFFFF
is all processors (#0 through #31)
When taskset returns, it is guaranteed that the given program has been scheduled to a legal CPU.
OPTIONS
-p, --pid
operate on an existing PID and not launch a new task
-c, --cpu-list
specify a numerical list of processors instead of a bitmask. The list may contain multiple items, separated by comma, and ranges.
For example, 0,5,7,9-11.
-h, --help
display usage information and exit
-V, --version
output version information and exit
USAGE
The default behavior is to run a new command with a given affinity mask:
taskset mask command [arguments]
You can also retrieve the CPU affinity of an existing task:
taskset -p pid
Or set it:
taskset -p mask pid
PERMISSIONS
A user must possess CAP_SYS_NICE to change the CPU affinity of a process. Any user can retrieve the affinity mask.
AUTHOR
Written by Robert M. Love.
COPYRIGHT
Copyright (C) 2004 Robert M. Love
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU-
LAR PURPOSE.
SEE ALSO
chrt(1), nice(1), renice(1), sched_setaffinity(2), sched_getaffinity(2)
See sched_setscheduler(2) for a description of the Linux scheduling scheme.
AVAILABILITY
The taskset command is part of the util-linux-ng package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.
schedutils Apr 2003 TASKSET(1)