How to access process and cpu info on AIX?


 
Thread Tools Search this Thread
Operating Systems AIX How to access process and cpu info on AIX?
# 1  
Old 05-31-2009
How to access process and cpu info on 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 etc.
On Linux I use the /proc/ pseudo-filesystem to access this information.
How can I do this for AIX? Is there any "standard" way how to do this?

Thank you very much for your help!!
# 2  
Old 05-31-2009
The "time" command (time a process) sounds like what you want.

Also relevant for viewing system usage are "topas" and "nmon". (Nmon is particularly nice as a system-wide real-time information viewer.)
# 3  
Old 06-01-2009
Thank you for your quick answer!
Where does "nmon" get its information from? E.g. number of cpus or cpu type? I'd like to access this information directly instead of calling a "tool" like nmon.
# 4  
Old 06-01-2009
I tried running nmon, then doing "truss" on the process and pressing "r" to show resources. The system calls it does might allow you to track down this information. The following was on an 8 CPU machine:

Code:
ptx_get_cpuinfo(0xFFFFFFFF, 0x00000000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x30106AC8) = 0x00000008
ptx_get_wparsysinfo(0x00000000, 0x2FF215D0, 0x00000000, 0x00000004, 0x2FF21570, 0xF053CC78, 0xD01357E0, 0x00000000) = 0x00000000
ptx_get_wparsysstats(0x00000000, 0x2FF21748, 0x301322F8, 0x0000D032, 0x00000000, 0x000003D0, 0x00000000, 0x00000000) = 0x00000000
ptx_get_syswait(0x2FF21580, 0x00000000, 0x301322F8, 0x0000D032, 0x00000000, 0x000003D0, 0x00000000, 0x00000000) = 0x00000000
ptx_get_sysstats(0x2FF21790, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x30106E18) = 0x00000000
lpar_get_info(0x00000001, 0x2FF21488, 0x00000178, 0x7DD53DC5, 0x25F14E58, 0x00000001, 0x00000000, 0x00000000) = 0x00000000
lpar_get_info(0x00000002, 0x2FF213C0, 0x000000C8, 0x0000D032, 0x00000000, 0x000003C0, 0x00000000, 0x00000000) = 0x00000000
vmgetinfo(0x00000000, 102, 0)                   = 4
vmgetinfo(0x3061F588, 102, 4)                   = 4
vmgetinfo(0x2FF21600, 103, 400)                 = 0
ptx_get_cpuinfo(0xFFFFFFFF, 0x00000000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x30106AC8) = 0x00000008
ptx_get_wparsysinfo(0x00000000, 0x2FF215D0, 0x00000000, 0x00000004, 0x2FF21570, 0xF053CC78, 0xD01357E0, 0x00000000) = 0x00000000
ptx_get_wparsysstats(0x00000000, 0x2FF21748, 0x301322F8, 0x0000D032, 0x00000000, 0x000003C0, 0x00000000, 0x00000000) = 0x00000000
ptx_get_syswait(0x2FF21580, 0x00000000, 0x301322F8, 0x0000D032, 0x00000000, 0x000003C0, 0x00000000, 0x00000000) = 0x00000000
lpar_get_info(0x00000001, 0x30111C18, 0x00000178, 0x00000000, 0x00000000, 0x000003C0, 0x00000000, 0x00000000) = 0x00000000
lpar_get_info(0x00000002, 0x30111D90, 0x000000C8, 0x0000D032, 0x00000000, 0x000003C0, 0x00000000, 0x00000000) = 0x00000000
ptx_get_cpuinfo(0xFFFFFFFF, 0x2FF21618, 0x304B09E8, 0x00000210, 0x00000008, 0x43300000, 0x00000000, 0x00000000) = 0x00000008
ptx_get_cpuinfo(0x00000000, 0x2FF21618, 0x2FF20E54, 0xD03E84C0, 0xD03E84C0, 0xD03EA194, 0x00000000, 0xFFFFFFFF) = 0x00000000
ptx_get_wparcpustats(0x00000000, 0x00000000, 0x2FF21718, 0x0000D032, 0x00000000, 0x000003C0, 0x00000000, 0x00000000) = 0x00000000
wpar_vmgetinfo(0, 0x30683EF8, 13, 0)            = 0
ptx_get_cpuinfo(0x00000001, 0x2FF21618, 0x2FF20E54, 0xD03E84C0, 0xD03E84C0, 0xD03EA194, 0x00000000, 0xFFFFFFFF) = 0x00000000
ptx_get_wparcpustats(0x00000000, 0x00000001, 0x2FF21718, 0x0000D032, 0x00000000, 0x000003C0, 0x00000000, 0x00000000) = 0x00000000
wpar_vmgetinfo(0, 0x30683EF8, 13, 0)            = 0
ptx_get_cpuinfo(0x00000002, 0x2FF21618, 0x2FF20E54, 0xD03E84C0, 0xD03E84C0, 0xD03EA194, 0x00000000, 0xFFFFFFFF) = 0x00000000
ptx_get_wparcpustats(0x00000000, 0x00000002, 0x2FF21718, 0x0000D032, 0x00000000, 0x000003C0, 0x00000000, 0x00000000) = 0x00000000
wpar_vmgetinfo(0, 0x30683EF8, 13, 0)            = 0
ptx_get_cpuinfo(0x00000003, 0x2FF21618, 0x2FF20E54, 0xD03E84C0, 0xD03E84C0, 0xD03EA194, 0x00000000, 0xFFFFFFFF) = 0x00000000
ptx_get_wparcpustats(0x00000000, 0x00000003, 0x2FF21718, 0x0000D032, 0x00000000, 0x000003B0, 0x00000000, 0x00000000) = 0x00000000
wpar_vmgetinfo(0, 0x30683EF8, 13, 0)            = 0
ptx_get_cpuinfo(0x00000004, 0x2FF21618, 0x2FF20E54, 0xD03E84C0, 0xD03E84C0, 0xD03EA194, 0x00000000, 0xFFFFFFFF) = 0x00000000
ptx_get_wparcpustats(0x00000000, 0x00000004, 0x2FF21718, 0x0000D032, 0x00000000, 0x000003C0, 0x00000000, 0x00000000) = 0x00000000
wpar_vmgetinfo(0, 0x30683EF8, 13, 0)            = 0
ptx_get_cpuinfo(0x00000005, 0x2FF21618, 0x2FF20E54, 0xD03E84C0, 0xD03E84C0, 0xD03EA194, 0x00000000, 0xFFFFFFFF) = 0x00000000
ptx_get_wparcpustats(0x00000000, 0x00000005, 0x2FF21718, 0x0000D032, 0x00000000, 0x000003C0, 0x00000000, 0x00000000) = 0x00000000
wpar_vmgetinfo(0, 0x30683EF8, 13, 0)            = 0
ptx_get_cpuinfo(0x00000006, 0x2FF21618, 0x2FF20E54, 0xD03E84C0, 0xD03E84C0, 0xD03EA194, 0x00000000, 0xFFFFFFFF) = 0x00000000
ptx_get_wparcpustats(0x00000000, 0x00000006, 0x2FF21718, 0x0000D032, 0x00000000, 0x000003D0, 0x00000000, 0x00000000) = 0x00000000
wpar_vmgetinfo(0, 0x30683EF8, 13, 0)            = 0
ptx_get_cpuinfo(0x00000007, 0x2FF21618, 0x2FF20E54, 0xD03E84C0, 0xD03E84C0, 0xD03EA194, 0x00000000, 0xFFFFFFFF) = 0x00000000
ptx_get_wparcpustats(0x00000000, 0x00000007, 0x2FF21718, 0x0000D032, 0x00000000, 0x000003C0, 0x00000000, 0x00000000) = 0x00000000

# 5  
Old 06-01-2009
lsconf or prtconf will show processor number and type as well as other info.
From AIX 6.1 nmon is shipped with AIX as an option on the topas command.
# 6  
Old 06-06-2009
Thanks all for your help.
I found the perfstat library, which seems to contain access to the information I need:

Help -

As I need this information in my C++ coding without calling system commands, this seems to be the solution.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Tricky situation with process cpu usage - AIX

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

2. Shell Programming and Scripting

Cpu utilization by a process has to be mailed if more than 5% on AIX

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

3. AIX

Aix process CPU differences.

Hi, I'm trying to create a script to catch a process which is consuming high CPU which I have pretty much done but it's just finding the correct place to pull the current CPU for that process. When viewed in Topas it's consuming 99.*% cpu But if I try using ps avg or ps -eo pcpu ... (5 Replies)
Discussion started by: elmesy
5 Replies

4. Shell Programming and Scripting

Generic command for CPU info

Dear all, Is there any generic command working on all Unix listing the CPU of a server? I found different command line per OS but I am looking for a more generic one. Thanks for your answer. (5 Replies)
Discussion started by: sgoiffon
5 Replies

5. HP-UX

CPU Info

Hi, I am going to buy a software that is licenced per CORE. I have a HPUX B1123 64 bit with 8 cpus. How can i know how many cores are in my machine ? Thanks (3 Replies)
Discussion started by: yoavbe
3 Replies

6. Programming

C++ application: how to access AIX process and cpu information?

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

7. AIX

Find CPU per process in 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

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

9. AIX

Cmd to find CPU utiliz of a process in 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

10. HP-UX

cpu info

is there a single command or location from which one can get information like cpu Mhz,cpu cache...etc in HP UX:) (1 Reply)
Discussion started by: vijayca
1 Replies
Login or Register to Ask a Question