Problem with nmon, actual CPU usage per process


 
Thread Tools Search this Thread
Operating Systems AIX Problem with nmon, actual CPU usage per process
# 8  
Old 03-12-2013
Yes, that's correct.

Where I currently have a doubt is, that I have no process, that is running a long time yet, but having a peak at the moment so that I can see that the values tprof shows are relevant for the interval and not again just some kind of average etc.

When I have a infinite loop running, it will be at a certain level for all of it's life span. So I can't tell if the output is because of the actual CPU usage in the interval or just the average, since it was always at this level.
I checked boxes in my environment, that have some amount of traffic, but sadly the involved processes have a very jumpy behaviour about CPU usage and are so with not suitable for my test to proof the output of tprof.

If you have such processes, that are running for some hours or days etc. already, you could check that for me, if you like Smilie
# 9  
Old 03-12-2013
Can you give us the breakout of what the options do in your version of nmon?
# 10  
Old 03-12-2013
Sure, there you go (nmon comes these days as part of AIX - same as topaz or replaced it):

Code:
notroot@somehost:/home/notroot# nmon -v
nmon version TOPAS-NMON build AIX
notroot@somehost:/home/notroot# oslevel -s
6100-06-05-1115
notroot@somehost:/home/notroot# which nmon
/usr/bin/nmon
notroot@somehost:/home/notroot# lslpp -w /usr/bin/nmon
  File                                        Fileset               Type
  ----------------------------------------------------------------------------
  /usr/bin/nmon                               bos.perf.tools        File
notroot@somehost:/home/notroot# nmon -h

Hint: topas_nmon [-h] [-s <seconds>] [-c <count>] [-f -d -t -r <name>] [-x]
 Command: TOPAS_NMON
        -h            FULL help information - much more than here
        Interactive-Mode:
        read startup banner and type: "h" once it is running
        For Data-Collect-Mode (-f)
        -f            spreadsheet output format [note: default -s300 -c288]
        optional
        -s <seconds>  between refreshing the screen [default 2]
        -c <number>   of refreshes [default millions]
        -t            spreadsheet includes top processes
        -x            capacity planning (15 min for 1 day = -fdt -s 900 -c 96)

For Interactive-Mode
        -s <seconds>  between refreshing the screen [default 2]
        -c <number>   of refreshes [default millions]
        -g <filename> User decided Disk Groups
                      - file = on each line: group_name <hdisk_list> space separated
                      - like: rootvg hdisk0 hdisk1 hdisk2
                      - upto 32 groups hdisks can appear more than once
        -b            black and white [default is colour]
        -B            no boxes [default is show boxes]
        example: topas_nmon -s 1 -c 100

For Data-Collect-Mode = spreadsheet format (comma separated values)
        Note: use only one of f,F,z,x or X and make it the first argument
        -f            spreadsheet output format [note: default -s300 -c288]
                         output file is <hostname>_YYYYMMDD_HHMM.nmon
        -F <filename> same as -f but user supplied filename
        -r <runname>  goes into spreadsheet file [default hostname]
        -t            include top processes in the output
        -T            as -t plus saves command line arguments in UARG section
        -Y            like -t but all commands with the same name are added up and reported
                      Note: you can have only one of -t, -T or -Y (last on the cmd line wins)
        -s <seconds>  between snap shots
        -c <number>   of refreshes
        -w <number>   Timestamp size (Tnnnn), values4 to 16, for analyser use 4 or 8
        -l <dpl>      disks/line default 150 to avoid spreadsheet issues. For EMC use 64
        -g <filename> User decided Disk Groups (see above -g)
        -d            Include Disk Service time sections
        -k <disklist> Only report these disks also works online  (Example -k hdisk3,hdisk23,hdisk44)
        -G            Use UTC/GMT standard time (not local time)
        -K            Include RAW Kernel & LPAR sections (RAWLPAR & RAWCPUTOTAL)
        -D            Skip disk configuration sections
        -E            Skip ESS  configuration sections
        -J            Skip JFS sections
        -V            Include disk Volume Group section
        -P            Include Paging Space section
        -M            Include MEMPAGES section = detailed memory stats per page size
        -N            Include NFS section, use -NN for NFSv4 stats.
        -W            Include WLM sections
        -S            Include WLM sections with SubClasses
        -^            Include Fibre Channel (FC) sections
        -O            Include Shared Ethernet Adpater (SEA) VIOS only sections
        -L            Include LARGE page section
        -I <percent>  Ignore process percent threshold (default 0.1)
                      don't save TOP stats if proc using less CPU than this %
        -A            Include Async I/O Section
        -m <dir>      nmon changes to this directory before saving data to a file
        -Z <priority> set nice priority -20=important to 20=unimportant (negative only for root user)
        example: collect for 1 hour at 30 second intervals with top procs
                 topas_nmon -f -t -r Test1 -s30 -c120

        To load into a spreadsheet like Lotus 1-2-3:
        sort -A *nmon >stats.csv
        transfer the stats.csv file to your PC
        Start 1-2-3 and then Open <char-separated-value ASCII file>

Capacity planning mode - use cron to run each day
        -x            sensible spreadsheet output for CP =  one day
                      every 15 mins for 1 day ( i.e. -ft -s 900 -c 96)
        -X            sensible spreadsheet output for CP = busy hour
                      every 30 secs for 1 hour ( i.e. -ft -s 30 -c 120)

Set-up and installation
        To enable disk stats as root: chdev -l sys0 -a iostat=true
        - this adds the disk % busy numbers (otherwise they are zero)
        If you have hundreds of disk this can take 1% to 2% CPU

Interactive Mode Commands
        key --- Toggles to control what is displayed ---
        h   = Online help information
        r   = Resources pSeries type, machine name, cache details and AIX version + LPAR
        p   = Partitions stats
        c   = CPU by processor stats with bar graphs
                 #=toggle PURR based stats (POWER5/6 shared CPUs only)
        C   = CPU by processor stats for high numbers of CPU
        l   = long term CPU (over 75 snapshots) with bar graphs
        m   = Memory and Paging stats
        M   = Multiple Page Size stats in pages - 2nd time in MB's
        k   = Kernel Internal stats
        n   = Network stats
        =   = For Network & Disk Toggle KB/s to MB/s
        O   = Shared Ethernet Adapter VIOS only
        N   = NFS Network File System stats (2nd N gets you NFSv4)
        d   = Disk I/O Graphs (see -k to limit to specific disks)
        D   = Disk I/O Stats - multiple times gets you more stats
        o   = Disk I/O Map (one character per disk showing how busy it is)
        g   = Disk Group I/O Stats (have to use -g commandline option)
        a   = Adapter I/O Stats
        ^   = Fibre Channel Adapter via fcstat command
        [   = Start an On demand nmon recording
        ]   = Stop an On demand nmon recording
        e   = ESS vpath Logical Disk I/O Stats
        V   = Disk Volume Group stats
        P   = Paging Space stats
        j   = JFS Stats
        t   = Top Process Stats  1=Basic-Details 2=Accumulated-CPU
               Performance sorted by 3=CPU 4=Size 5=I/O
        u   = Top but with command arguments shown (used with 3,4 & 5)
               to refresh arguments (for new processes) hit u twice
        U   =  as u plus Workload Classes/WPAR
        W   =  Workload Management (WLM) Stats
        S  =  WLM with SubClasses
        w   = use with top to show AIX wait processes (good for SMP)
        A   = Summarise Async I/O (aioserver) processes
        v   = Verbose this highlights problems on the machine and
              categorises them as either danger, warnings or OK
        b   = black and white mode (or use -b option)
        .   = minimum mode i.e. only busy disks and processes
        ~   = switch to topas screen

        key --- Other Controls ---
        +   = double the screen refresh time
        -   = halves the screen refresh time
        q   = quit (also x)
        0   = reset peak counts to zero (peak = ">")
        space = refresh screen now

Startup Control
        If you find you always type the same toggles every time you start
        then place them in the NMON shell variable. For example:
         export NMON=cmdrvtan

Others:
        a)   Do you want to stop nmon - kill -USR2 <nmon-pid>
        b) Use -p and nmon outputs the background process pid
        c) To limit the processes nmon lists (online and to a file)
           Either set NMONCMD0 to NMONCMD63 to the program names
           or use -C cmd:cmd:cmd etc. example: -C ksh:vi:syncd
        d) To limit the disks nmon lists up to 64 (online only)
           Use -k diskname,diskname,diskname (Example -k hdisk2,hdisk0,hdisk3)

As said, even in other combinations of switches etc., like without -C etc. there was not the output I expected.

Last edited by zaxxon; 03-12-2013 at 01:40 PM.. Reason: added info
# 11  
Old 03-12-2013
That's one funky help, with -C appname mentioned only parenthetically! A 'B' effort. I guess ignorant riffraff need not apply. Smilie

Well, now you are awash in tools. Do you have one that fits your needs?
This User Gave Thanks to DGPickett For This Post:
# 12  
Old 03-13-2013
I will try the tprof way again like -=xray=- suggested. Thanks all^^
# 13  
Old 03-14-2013
If anybody is interested in the function/code I ended up with, here it is:
Code:
...
get_proccpu()
{
        PATTERN=$1
        INTERVAL=$2
        INTERVAL=${INTERVAL:=10}

        T_FILE=sleep.prof

        tprof -x sleep $INTERVAL > /dev/null 2>&1
        RESULT=$( awk -v p="$PATTERN" '/^Process/ {c++; next} c == 1 && $1 == p {print int($3+0.5)}' $T_FILE )

        # Delete tprof-File
        rm -f ./${T_FILE} 2> /dev/null
}
...

$PATTERN is just a string that matches the process' name in tprof's output file, here "sleep.prof".
$RESULT is later compared against thresholds.
# 14  
Old 03-14-2013
Does using a variable T_FILE add any value?

Can you create a permanent named pipe sleep.prof (sbin/mknod NAME p) and read it real time? No need to remove.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How can I check actual memory usage each Process?

I can't check actual memory usage in the Redhat 5.5... The used memory is 14214 Mb of Total 15919 by Free -m command. I sum the RSS value on PS aux command result and the value is 5428.66Mb. Yes It's quite different actual usage memory and RSS value. So I added Shared memory value... (5 Replies)
Discussion started by: tom8254
5 Replies

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

3. UNIX for Dummies Questions & Answers

Average CPU and RAM usage for a process

Hi, I will be creating a process myself and I want to know the average CPU and RAM used by the process over the lifetime of the process. I see that there are various tools available(pidstat) for doing , I was wondering if it possible to do it in a single command while creation. Thanks in... (3 Replies)
Discussion started by: koustubh
3 Replies

4. Shell Programming and Scripting

CPU Usage of a process

Hi guys, I am currently writing a JAVA script to monitor certain unix processes through JConsole. Upon having lots of trouble with runtime.exec, i decided to bypass the top/ps command call and just get the information straight from /proc/*pid*/whatever. Now i can pull back any... (0 Replies)
Discussion started by: matt9949
0 Replies

5. AIX

How to trace cpu/memory usage for a process

I don't know when the process will start and end, I need write a script to trace it's cpu/memory usage when it is runing. How to write this script? (2 Replies)
Discussion started by: rainbow_bean
2 Replies

6. Shell Programming and Scripting

CPU Usage for a particular process

Hi, I have a shell script. But, upon execution of the same, the cpu usage is sometimes getting 100 % (checked executing top command). At that point of time, my process hangs, doesn't run anymore. I need to kill it manually. My concern is, is there any default method, by which I can check... (1 Reply)
Discussion started by: jitendriya.dash
1 Replies

7. UNIX for Dummies Questions & Answers

process cpu usage

Trying to come up with a command that will show all processes sorted from highest cpu usage to lowest. Any ideas? (9 Replies)
Discussion started by: cwsmichigan
9 Replies

8. UNIX for Advanced & Expert Users

Finding CPU usage by a Unix Process

Hi, I am designing a load balancer for an application. I am trying to find out the CPU usage by a specifc Unix process (PID is known). I guess I can use ps command to find that. can somebody help me in finding what exact command I should use to find? It is on AIX 5.3. Regards Asutosh (2 Replies)
Discussion started by: asutoshch
2 Replies

9. AIX

CPU usage of a process

I'm trying to monitor the CPU usage of a process and output that value to a file or variable. I know topas or nmon can tell me this in interactive mode but what I need is topas-looking output that allows me to write to a file after a discrete interval. Unlike nmon data collection to a file on top... (5 Replies)
Discussion started by: robot23
5 Replies

10. Solaris

Process CPU usage in Solaris 10

Hi All, Please let me know the command (expect top) to view the cpu usage of every process in Solaris 10. Thanks in Advance, Arun (1 Reply)
Discussion started by: arun.viswanath
1 Replies
Login or Register to Ask a Question