LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 08-18-2004, 03:42 PM   #1
brynjarh
Member
 
Registered: May 2004
Location: Iceland
Distribution: Ubuntu Dapper Drake
Posts: 172

Rep: Reputation: 30
Can I somehow accurately measure the time an operation like 'unzip -x foo.zip' takes?


Is it possible to somehow measure the time accurately from when an operation starts to when it ends?
So I can measure how long it takes for me to unzip a file for example?

Last edited by brynjarh; 08-18-2004 at 03:50 PM.
 
Old 08-18-2004, 03:52 PM   #2
ranger_nemo
Senior Member
 
Registered: Feb 2003
Location: N'rn WI -- USA
Distribution: Kubuntu 8.04, ClarkConnect 4
Posts: 1,142

Rep: Reputation: 47
Start the command with "time "...

time unzip -x foo.zip
 
Old 08-18-2004, 04:04 PM   #3
brynjarh
Member
 
Registered: May 2004
Location: Iceland
Distribution: Ubuntu Dapper Drake
Posts: 172

Original Poster
Rep: Reputation: 30
Thanks, I tried it out and this is what I got:
Code:
HAL:/home/brynjarh# time unzip -x foo_zip.zip
Archive:  foo_zip.zip
  inflating: screenshot.bmp

real    0m0.094s
user    0m0.010s
sys     0m0.000s
I'm a little confused by the difference on real <time> and user <time>, what's the difference?
 
Old 08-18-2004, 04:08 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,976
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
man time



Cheers,
Tink
 
Old 08-18-2004, 08:49 PM   #5
bröggle
LQ Newbie
 
Registered: Aug 2004
Distribution: Mandrake 10.0
Posts: 15

Rep: Reputation: 0
thanks for the time tip, but
man time shows me only something about the system call time in order to get a unix timestamp (right spelling?)
and something about posix standard etc, but nothing about the time "tool".


neither about any options from time (time --help)

So what? Online-Man? Is time some kind of alias?

(if anybody wants it, I could paste the german man page of it ;-)
 
Old 08-18-2004, 08:59 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,976
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
Try
man 1 time
then ...



Strange that it should default to man 2 in this case.



Code:
TIME(1)                                                   TIME(1)

NAME
       time - time a simple command or give resource usage

SYNOPSIS
       time [options] command [arguments...]

DESCRIPTION
       The  time  command runs the specified program command with
       the given arguments.  When command finishes, time writes a
       message  to standard output giving timing statistics about
       this program run.  These statistics  consist  of  (i)  the
       elapsed real time between invocation and termination, (ii)
       the user CPU time (the sum of the tms_utime and tms_cutime
       values in a struct tms as returned by times(2)), and (iii)
       the  system  CPU  time  (the  sum  of  the  tms_stime  and
       tms_cstime   values   in  a  struct  tms  as  returned  by
       times(2)).

Cheers,
Tink
 
Old 08-18-2004, 09:02 PM   #7
CSIXTY4
LQ Newbie
 
Registered: Mar 2004
Location: Lombard, IL.
Distribution: SUSE 9.0 & Fedora Core 2
Posts: 21

Rep: Reputation: 15
The "manual" is divided into the following sections:

1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]

The "time" command would be found in section 1, and you can read that man page by typing:

Code:
man 1 time
Hope that helps!
 
Old 08-18-2004, 09:18 PM   #8
bröggle
LQ Newbie
 
Registered: Aug 2004
Distribution: Mandrake 10.0
Posts: 15

Rep: Reputation: 0
I tried but heres the german output of it :
Keine Handbuch-Seite time in der Sektion 1

or in english,please:
there is no time man page in section one.




 
Old 08-18-2004, 09:24 PM   #9
ranger_nemo
Senior Member
 
Registered: Feb 2003
Location: N'rn WI -- USA
Distribution: Kubuntu 8.04, ClarkConnect 4
Posts: 1,142

Rep: Reputation: 47
Code:
TIME(1)                                                   TIME(1)



NAME
       time - time a simple command or give resource usage

SYNOPSIS
       time[options] command [arguments...]

DESCRIPTION
       The  time  command runs the specified program command with
       the given arguments.  When command finishes, time writes a
       message  to standard output giving timing statistics about
       this program run.  These statistics  consist  of  (i)  the
       elapsed real time between invocation and termination, (ii)
       the user CPU time (the sum of the tms_utime and tms_cutime
       values in a struct tms as returned by times(2)), and (iii)
       the  system  CPU  time  (the  sum  of  the  tms_stime  and
       tms_cstime   values   in  a  struct  tms  as  returned  by
       times(2)).

OPTION
       -p     When in the POSIX locale, use  the  precise  tradi_
              tional format
                   "real %f\nuser %f\nsys %f\n"
              (with numbers in seconds) where the number of deci_
              mals in the output for %f  is  unspecified  but  is
              sufficient  to express the clock tick accuracy, and
              at least one.

ENVIRONMENT
       The  variables  LANG,   LC_ALL,   LC_CTYPE,   LC_MESSAGES,
       LC_NUMERIC,  NLSPATH  and  PATH  are used. The last one to
       search for command.  The remaining ones for the  text  and
       formatting of the output.

EXITSTATUS
       If  command  was  invoked, the exit status is that of com_
       mand.  Otherwise it is 127 if command could not be  found,
       126  if  it  could  be found but could not be invoked, and
       some other nonzero value (1-125) if  something  else  went
       wrong.

SEEALSO
       times(2),



GNUVERSION
       Below  a description of the GNU 1.7 version of time.  Dis_
       regarding the name of the utility,  GNU  makes  it  output
       lots  of useful information, not only about time used, but
       also on other resources like memory,  I/O  and  IPC  calls
       (where available).  The output is formatted using a format
       string that can be specified using the -f  option  or  the
       TIME environment variable.

       The default format string is
          %Uuser %Ssystem %Eelapsed %PCPU (%Xtext+%Ddata %Mmax)k
          %Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps

       When the -p option is given the (portable) output format
          real %e
          user %U
          sys %S
       is used.

   Theformatstring
       The  format  is  interpreted in the usual printf-like way.
       Ordinary characters are directly copied, tab, newline  and
       backslash  are escaped using \t, \n and \\, a percent sign
       is represented by %%, and otherwise % indicates a  conver_
       sion.  The program time will always add a trailing newline
       itself.  The conversions follow.  All  of  those  used  by
       tcsh(1) are supported.

       Time

       %E     Elapsed real time (in [hours:]minutes:seconds).

       %e     (Not in tcsh.) Elapsed real time (in seconds).

       %S     Total  number of CPU-seconds that the process spent
              in kernel mode.

       %U     Total number of CPU-seconds that the process  spent
              in user mode.

       %P     Percentage  of  the CPU that this job got, computed
              as (%U + %S) / %E.

       Memory

       %M     Maximum resident set size of the process during its
              lifetime, in Kbytes.

       %t     (Not  in  tcsh.)  Average  resident set size of the
              process, in Kbytes.

       %K     Average total (data+stack+text) memory use  of  the
              process, in Kbytes.

       %D     Average  size  of the process's unshared data area,
              in Kbytes.

       %p     (Not  in  tcsh.)  Average  size  of  the  process's
              unshared stack space, in Kbytes.

       %X     Average size of the process's shared text space, in
              Kbytes.

       %Z     (Not in tcsh.) System's page size, in bytes.   This
              is  a  per-system constant, but varies between sys_
              tems.

       %F     Number of major page faults that occurred while the
              process  was  running.   These are faults where the
              page has to be read in from disk.

       %R     Number  of  minor,  or  recoverable,  page  faults.
              These  are  faults for pages that are not valid but
              which have not yet been claimed  by  other  virtual
              pages.   Thus  the  data in the page is still valid
              but the system tables must be updated.

       %W     Number of times the process was swapped out of main
              memory.

       %c     Number  of  times  the process was context-switched
              involuntarily (because the time slice expired).

       %w     Number of waits: times that the  program  was  con_
              text-switched voluntarily, for instance while wait_
              ing for an I/O operation to complete.

       I/O

       %I     Number of file system inputs by the process.

       %O     Number of file system outputs by the process.

       %r     Number of socket messages received by the  process.

       %s     Number of socket messages sent by the process.

       %k     Number of signals delivered to the process.

       %C     (Not  in  tcsh.) Name and command line arguments of
              the command being timed.

       %x     (Not in tcsh.) Exit status of the command.

GNUOPTIONS
       -f FORMAT,--format=FORMAT
              Specify output format, possibly overriding the for_
              mat specified in the environment variable TIME.

       -p,--portability
              Use the portable output format.

       -o FILE,--output=FILE
              Do  not  send  the results to stderr, but overwrite
              the specified file.

       -a,--append
              (Used together  with  -o.)  Do  not  overwrite  but
              append.

       -v,--verbose
              Give  very  verbose  output  about  all the program
              knows about.

GNUSTANDARDOPTIONS
       --help Print a usage message on standard output  and  exit
              successfully.

       -V,--version
              Print  version information on standard output, then
              exit successfully.

       --     Terminate option list.

BUGS
       Not all resources are measured by all versions of Unix, so
       some of the values might be reported as zero.  The present
       selection was mostly inspired by the data provided by  4.2
       or 4.3BSD.

       GNU  time version 1.7 is not yet localized.  Thus, it does
       not implement the POSIX requirements.

       The environment variable TIME was badly chosen.  It is not
       unusual  for systems like autoconf or make to use environ_
       ment variables with the name of a utility to override  the
       utility  to be used. Uses like MORE or TIME for options to
       programs (instead of program path names) tend to  lead  to
       difficulties.

       It   seems  unfortunate  that  -o  overwrites  instead  of
       appends.  (That is, the -a option should be the  default.)

       Mail suggestions and bug reports for GNU time to
       bug-utilsprep.edu
       Please  include the version of time, which you can get by
       running
       time --version
       and the operating system and C compiler you used.

SEEALSO
       tcsh(1), times(2), wait3(2)

AUTHORS
       David Keppel
              Original version

       David MacKenzie
              POSIXization, autoconfiscation, GNU getopti_
              zation,  documentation,  other bug fixes and
              improvements.

       Arne Henrik Juul
              Helped with portability

       Francois Pinard
              Helped with portability



                            2000-12-11                    TIME(1)
 
Old 08-18-2004, 09:26 PM   #10
bröggle
LQ Newbie
 
Registered: Aug 2004
Distribution: Mandrake 10.0
Posts: 15

Rep: Reputation: 0
Thank you very much.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
unzip .zip >4gb dkw Linux - General 1 07-07-2005 07:27 PM
accurately measure time rasselin Programming 1 09-05-2003 05:18 PM
how to accurately measure processing time rasselin Programming 3 09-01-2003 11:45 AM
Zip and Unzip concoran Linux - General 4 08-02-2002 07:12 PM
how do i unzip a .zip? lax2sman Linux - General 2 02-11-2002 05:17 PM


All times are GMT -5. The time now is 05:05 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration