Groups > Unix Linux > Linux > Re: How to measure program memory usage?




How to measure program memory usage?

How to measure program memory usage?
Wed, 02 Apr 2008 02:27:09 +030
  I want to measure the memory usage of a program.

  'top' is not good because the program only runs for a few seconds.
/usr/bin/time -f "%M" always gives 0.

Post Reply
Re: How to measure program memory usage?
Wed, 02 Apr 2008 14:23:41 +020
Juha Nieminen wrote:
>   I want to measure the memory usage of a program.
> 
>   'top' is not good because the program only runs for a few seconds.
> /usr/bin/time -f "%M" always gives 0.

no ... top is an interactive program

>   How can this be done?

Post Reply
Re: How to measure program memory usage?
Wed, 2 Apr 2008 22:48:36 +0200
The carbonbased lifeform Juha Nieminen inspired alt.os.linux with:
>   I want to measure the memory usage of a program.
>
>   'top' is not good because the program only runs for a few seconds.
> /usr/bin/time -f "%M" always gives 0.
>
>   How can this be done?

$ cat /proc/7062/status 
Name:   amarokapp
State:  S (sleeping)
SleepAVG:       98%
Tgid:   7062
Pid:    7062
PPid:   1
TracerPid:      0
Uid:    1000    1000    1000    1000
Gid:    100     100     100     100
FDSize: 32
Groups: 10 14 16 33 100 1001 
VmPeak:   156860 kB
VmSize:   153204 kB
VmLck:         0 kB
VmHWM:     54532 kB
VmRSS:     52428 kB
VmData:    98984 kB
VmStk:        88 kB
VmExe:       144 kB
VmLib:     46580 kB
VmPTE:       120 kB
Threads:        7
SigQ:   1/8191
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000001000
SigIgn: 0000000000001000
SigCgt: 00000001800104a8
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000
Cpus_allowed:   00000001
Mems_allowed:   1

Theo
-- 
theo at van-werkhoven.nl    ICQ:277217131                      SuSE Linux
linuxcounter.org: 99872  Jabber:muadib at jabber.xs4all.nl  AMD XP3000+ 1024MB
"ik _heb_ niets tegen Microsoft, ik heb iets tegen
Post Reply
Re: How to measure program memory usage?
Thu, 03 Apr 2008 21:06:20 +020
Juha Nieminen wrote:
>   I want to measure the memory usage of a program.
> 
>   'top' is not good because the program only runs for a few seconds.
> /usr/bin/time -f "%M" always gives 0.
> 
>   How can this be done?

You could run vmstat and see the difference in the values between when your 
program ain't running and when it's running.

-- 

Post Reply
Re: How to measure program memory usage?
Thu, 03 Apr 2008 21:50:13 +030
Theo v. Werkhoven wrote:
>> the program only runs for a few seconds.

> $ cat /proc/7062/status 

Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact