11-15-2011
if you see a process in nmon consuming 99% than that means that it is consuming 99% of one thread (lcpu) what is in most cases not really a reason for concern, particularly not if you i.e. have an oracle DB server
Regards
zxmaus
10 More Discussions You Might Find Interesting
1. AIX
Hello All,
I wanna find the CPU utilization of a specific process running on AIX OS. I have its pid, but not sure about the command.
iostat
sar 5 5
vmstat
All the above give me system CPU utilization. Is there a way to find for a specific pid???
Thanks,
Ankita (11 Replies)
Discussion started by: Ankita
11 Replies
2. UNIX for Dummies Questions & Answers
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
3. AIX
Hi.
I am looking for a command that will return me the amount of CPU used by a specific process in AIX environment.
I know there is TOPAS - but it is interactive and I need to get this information from system that connects remotely via SSH.
Using writing to files and than reading them is also... (1 Reply)
Discussion started by: yamsin789
1 Replies
4. Programming
Hi,
may be this is an AIX noob question:
my current C++ application runs on Linux and is quite memory consuming. Therefore, the application writes a logfile after it has finished containing memory information, CPU information, information on the running other processes besides my application... (0 Replies)
Discussion started by: DarthVader77
0 Replies
5. AIX
Hi,
may be this is an AIX noob question:
my current C++ application runs on Linux and is quite memory consuming. Therefore, the application writes a logfile after it has finished containing memory information, CPU information, information on the running other processes besides my application... (5 Replies)
Discussion started by: DarthVader77
5 Replies
6. UNIX for Dummies Questions & Answers
I've been more used to Solaris, but am now working on an IBM AIX box, P650
Certain commands like "top" are no longer available. Any ideas on where I can find help on this matter?
Christopher Freville
Alberquerque, NM (6 Replies)
Discussion started by: Solariums
6 Replies
7. Shell Programming and Scripting
Hi
Hope you are having a great weeknd !! I had a question and need your expertise for this :
I have 2 files File1 & File2(of same structure) which I need to compare on some columns. I need to find the values which are there in File2 but not in File 1 and put the Differences in another file... (5 Replies)
Discussion started by: newbie_8398
5 Replies
8. UNIX for Advanced & Expert Users
I have started a new job which requires AIX admin skills, which I have, and RHEL skills. Does anyone have a cheat sheet that if I know how to solve the problem in AIX how would I do that in RHEL? I was an IBM pre-sales technical trying to keep sales guys honest - not possible. Any other links to... (5 Replies)
Discussion started by: SpenceSnyder
5 Replies
9. Shell Programming and Scripting
i am using the below command in order to find the cpu utilization by a user..now i want to mail if the cpu utilization goes beyond 5%....can someone please help me ?
ps auxw | sort -r +2 | awk '{ print $3,$1 }' | head -6 | egrep "USER|#anonymous#"
%CPU USER
2.0 anonymous
Regards,... (6 Replies)
Discussion started by: arorap
6 Replies
10. Shell Programming and Scripting
OS: AIX
so we frequently receive a lot of cpu related alerts. all types of checks have been created to keep an eye on the cpu but a lot of these checks make too much noise as the CPU is always being seen as high. the system and application owners say there's no issue with the cpu.
so now,... (6 Replies)
Discussion started by: SkySmart
6 Replies
LEARN ABOUT XFREE86
pthread_getcpuclockid
PTHREAD_GETCPUCLOCKID(3) Linux Programmer's Manual PTHREAD_GETCPUCLOCKID(3)
NAME
pthread_getcpuclockid - retrieve ID of a thread's CPU time clock
SYNOPSIS
#include <pthread.h>
#include <time.h>
int pthread_getcpuclockid(pthread_t thread, clockid_t *clock_id);
Compile and link with -pthread.
DESCRIPTION
The pthread_getcpuclockid() function returns the clock ID for the CPU time clock of the thread thread.
RETURN VALUE
On success, this function returns 0; on error, it returns a nonzero error number.
ERRORS
ENOENT Per-thread CPU time clocks are not supported by the system.
ESRCH No thread with the ID thread could be found.
VERSIONS
This function is available in glibc since version 2.2.
ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7).
+------------------------+---------------+---------+
|Interface | Attribute | Value |
+------------------------+---------------+---------+
|pthread_getcpuclockid() | Thread safety | MT-Safe |
+------------------------+---------------+---------+
CONFORMING TO
POSIX.1-2001, POSIX.1-2008.
NOTES
When thread refers to the calling thread, this function returns an identifier that refers to the same clock manipulated by clock_gettime(2)
and clock_settime(2) when given the clock ID CLOCK_THREAD_CPUTIME_ID.
EXAMPLE
The program below creates a thread and then uses clock_gettime(2) to retrieve the total process CPU time, and the per-thread CPU time con-
sumed by the two threads. The following shell session shows an example run:
$ ./a.out
Main thread sleeping
Subthread starting infinite loop
Main thread consuming some CPU time...
Process total CPU time: 1.368
Main thread CPU time: 0.376
Subthread CPU time: 0.992
Program source
/* Link with "-lrt" */
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <string.h>
#include <errno.h>
#define handle_error(msg)
do { perror(msg); exit(EXIT_FAILURE); } while (0)
#define handle_error_en(en, msg)
do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)
static void *
thread_start(void *arg)
{
printf("Subthread starting infinite loop
");
for (;;)
continue;
}
static void
pclock(char *msg, clockid_t cid)
{
struct timespec ts;
printf("%s", msg);
if (clock_gettime(cid, &ts) == -1)
handle_error("clock_gettime");
printf("%4ld.%03ld
", ts.tv_sec, ts.tv_nsec / 1000000);
}
int
main(int argc, char *argv[])
{
pthread_t thread;
clockid_t cid;
int j, s;
s = pthread_create(&thread, NULL, thread_start, NULL);
if (s != 0)
handle_error_en(s, "pthread_create");
printf("Main thread sleeping
");
sleep(1);
printf("Main thread consuming some CPU time...
");
for (j = 0; j < 2000000; j++)
getppid();
pclock("Process total CPU time: ", CLOCK_PROCESS_CPUTIME_ID);
s = pthread_getcpuclockid(pthread_self(), &cid);
if (s != 0)
handle_error_en(s, "pthread_getcpuclockid");
pclock("Main thread CPU time: ", cid);
/* The preceding 4 lines of code could have been replaced by:
pclock("Main thread CPU time: ", CLOCK_THREAD_CPUTIME_ID); */
s = pthread_getcpuclockid(thread, &cid);
if (s != 0)
handle_error_en(s, "pthread_getcpuclockid");
pclock("Subthread CPU time: 1 ", cid);
exit(EXIT_SUCCESS); /* Terminates both threads */
}
SEE ALSO
clock_gettime(2), clock_settime(2), timer_create(2), clock_getcpuclockid(3), pthread_self(3), pthreads(7), time(7)
COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the
latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
Linux 2017-09-15 PTHREAD_GETCPUCLOCKID(3)