bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

/usr/bin/time can't grok memory useage?


From: Florian Liekweg
Subject: /usr/bin/time can't grok memory useage?
Date: Mon, 31 Jan 2005 13:30:18 +0100
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041123

It appears to me that /usr/bin/time can't seem to deliver
any stats about memory usage.  The following happens on
the (admittedly slightly ancient Red Hat Linux release 8.0 (Psyche)):

Script started on Mon Jan 31 13:08:14 2005
bash$ /usr/bin/time --version
GNU time 1.7
bash$ cat usemem.c
# include <stdlib.h>
# include <assert.h>

# define CHUNK 1024 * 64

int main (int argc, char **argv)
{
  int *buf = 0;
  int i = 0;

  for (i = 0; i < 1024; i ++)
    {
          buf = malloc (CHUNK * sizeof (int));

          assert (buf);

          int j;
          for (j = 0; j < CHUNK; j ++)
            buf [j] = 0;
    }

  exit (EXIT_SUCCESS);
}
bash$ gcc usemem.c -o usemem
bash$ /usr/bin/time -f '%M max res %t avg res %K avg unshared %F major %R minor 
page faults %W swapped %c ctx' ./usemem
0 max res 0 avg res 0 avg unshared 71 major 66568 minor page faults 0 swapped 0 
ctx
bash$ exit
exit

Script done on Mon Jan 31 13:08:35 2005

cheers,
Florian




reply via email to

[Prev in Thread] Current Thread [Next in Thread]