Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
* ps aux (oddity)
@ 2000-07-28  4:00 Mathew Lee
  2000-07-28  4:00 ` Tony Hammitt
  0 siblings, 1 reply; 3+ messages in thread
From: Mathew Lee @ 2000-07-28  4:00 UTC (permalink / raw)


I was curious if anyone has seen this type of problem, or if it's
nothing to worry about...

when I preform a ps aux on one of my digital 500au machines (running
linux or course) (kernel 2.2.16)

USER       PID %CPU %MEM   VSZ     RSS TTY      STAT START   TIME
COMMAND

userx       4182   71.7         3.2       40960    4096     ?
RN     Jul26      1808:51  ./simulation copper1
usery      4329    49.9       16.2       22360   20496    ?
RN      Jul27       633:16   ./simulation copper2

The problem here is the third column (% CPU)....now if my Engineering
degree serves me correctly....that's greater than 100%...(actually 121.6
%)...how can this be...or is this expected...
I am using binaries that were compiled using the Compaq C compiler.  Any
suggestions are greatly appreciated....

Thanks,


Matt Lee
Undergraduate Research Assistant
Mechanical and Aerospace Engineering
Oklahoma State University





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ps aux (oddity)
  2000-07-28  4:00 ps aux (oddity) Mathew Lee
@ 2000-07-28  4:00 ` Tony Hammitt
  2000-07-30  4:00   ` Mathew Lee
  0 siblings, 1 reply; 3+ messages in thread
From: Tony Hammitt @ 2000-07-28  4:00 UTC (permalink / raw)


Hi Matthew,

Perhaps you need a second opinion.  Try this script, it adds up system and user time
for processes and reports more accurately than ps:

#!/bin/sh

# 'sec', written by Tony Hammitt, (C) 2000, GPL 2.0 or higher, www.gnu.org

# Alphas: Tix is 1000 ticks per second
# i386's: Tix is 100 ticks per second

Tix=100

helpm()
	{
	echo "Usage: sec <process ID|command|all>"
	echo "    Prints out CPU time and percent for the matching processes."
	exit 0
	}

case "$1" in
  '--help')
	helpm
    ;;
  '-h')
	helpm
	;;
esac

tn=`cat /proc/self/stat | awk '{print $22}'`

tused()
	{
	tu=`cat /proc/$1/stat | awk '{print ($14+$15)}'`
	pst=`cat /proc/$1/stat | awk '{print $22}'`
	ptu=$(echo "scale=3; 100.0*$tu/($tn-$pst)" | bc -l)
	#" <- this quote is here fer nedits colorizer...
	printf "  %g%% time used since program start\n" $ptu
	}

seconds()
	{
	if [ -f /proc/$1/stat ]; then
		bob=`cat /proc/$1/stat | awk '{print $14+$15}'`
		bthy=$(echo "scale=3; $bob/$Tix" | bc -l)
		echo -n $bthy "seconds used"
		tused $1
	fi
	}

if [ -d /proc/$1 ]; then
	seconds $1
else
	if [ $1 = 'all' ]; then
		ppp=`ps ax | awk '{print $1}'`
	else
		ppp=`ps ax | awk '{print $1,$5}' | grep $1 | awk '{print $1}'`
	fi
	nl=`echo $ppp | wc -w | awk '{print $1}'`
	if [ $nl -eq 1 ]; then
		seconds $ppp
	else
		ss=0
		for i in $ppp; do
			if [ -f /proc/$i/stat ]; then
				th=`cat /proc/$i/stat | awk '{print $14+$15}'`
				name=`cat /proc/$i/stat | awk '{print $2}'`
				thy=$(echo "scale=3; $th/$Tix" | bc -l)
				echo -n $thy "seconds used by PID" $i $name
				tused $i
				ss=$(( $th + $ss ))
			fi
		done
		thy=$(echo "scale=3; $ss/$Tix" | bc -l)
		if [ $1 = 'all' ]; then
			printf "\n%s total seconds used in all running processes\n" $thy
		else
			printf "\n%s total seconds used in all %s's\n" $thy $1
		fi
	fi
fi

exit 0



======



Mathew Lee wrote:
> 
> I was curious if anyone has seen this type of problem, or if it's
> nothing to worry about...
> 
> when I preform a ps aux on one of my digital 500au machines (running
> linux or course) (kernel 2.2.16)
> 
> USER       PID %CPU %MEM   VSZ     RSS TTY      STAT START   TIME
> COMMAND
> 
> userx       4182   71.7         3.2       40960    4096     ?
> RN     Jul26      1808:51  ./simulation copper1
> usery      4329    49.9       16.2       22360   20496    ?
> RN      Jul27       633:16   ./simulation copper2
> 
> The problem here is the third column (% CPU)....now if my Engineering
> degree serves me correctly....that's greater than 100%...(actually 121.6
> %)...how can this be...or is this expected...
> I am using binaries that were compiled using the Compaq C compiler.  Any
> suggestions are greatly appreciated....
> 
> Thanks,
> 
> Matt Lee
> Undergraduate Research Assistant
> Mechanical and Aerospace Engineering
> Oklahoma State University



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ps aux (oddity)
  2000-07-28  4:00 ` Tony Hammitt
@ 2000-07-30  4:00   ` Mathew Lee
  0 siblings, 0 replies; 3+ messages in thread
From: Mathew Lee @ 2000-07-30  4:00 UTC (permalink / raw)


Tony Hammitt,

A second opinion is always nice.  Thanks for help :)


Mathew Lee
Undergraduate Research Assistant
Mechanical and Aerospace Engineering
Oklahoma State University



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-07-30  4:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-07-28  4:00 ps aux (oddity) Mathew Lee
2000-07-28  4:00 ` Tony Hammitt
2000-07-30  4:00   ` Mathew Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox