file time compare / run time

file time compare / run time

Post by Brian Bilt » Thu, 12 Apr 2001 22:43:25



New guy, bourne shell, using freebsd 4.2

I am touching files at the beginning and the ending of a simple shell
script for gathering the running time of the script. How could I
capture or compare the difference of the two files at the end of the
script rather than manually looking at the two files?

 
 
 

file time compare / run time

Post by Ari Makel » Thu, 12 Apr 2001 23:49:42



> I am touching files at the beginning and the ending of a simple shell
> script for gathering the running time of the script.

You really want to get acquaintated with command time. Your method is
not only laborous but also lacking useful information. Real time is
not usually not interesting but CPU time is.

For example:

$ time ls /etc/apache
conf                conf.orig.tgz  httpd.conf  mime.types  perl
conf.orig-perl.tgz  cron.conf      logformats  modules     startup.pl

real    0m0.019s
user    0m0.000s
sys     0m0.010s

--

use strict; print "Just Another Perl Hacker\n";    http://www.iki.fi/hauva/ #

"Father, I have done questionable things." - Roy

 
 
 

file time compare / run time

Post by Anthony Borl » Thu, 12 Apr 2001 22:58:21



Quote:> New guy, bourne shell, using freebsd 4.2

> I am touching files at the beginning and the ending of a simple shell
> script for gathering the running time of the script. How could I
> capture or compare the difference of the two files at the end of the
> script rather than manually looking at the two files?

You may consider using the 'time' command; it provides run-time statistics
about an executable, be it an shell script or a binary executable.

To time a shell script you could try something like:

       time ./myShellScript

Check the on-line documentation for additional information on 'time'.

I hope this helps.

 
 
 

file time compare / run time

Post by Bart » Fri, 13 Apr 2001 05:59:55


"Real time is not usually not interesting but CPU time is."

Ah, there speaks a developer ;-)



> > I am touching files at the beginning and the ending of a simple shell
> > script for gathering the running time of the script.

> You really want to get acquaintated with command time. Your method is
> not only laborous but also lacking useful information. Real time is
> not usually not interesting but CPU time is.

> For example:

> $ time ls /etc/apache
> conf                conf.orig.tgz  httpd.conf  mime.types  perl
> conf.orig-perl.tgz  cron.conf      logformats  modules     startup.pl

> real    0m0.019s
> user    0m0.000s
> sys     0m0.010s

> --
> #!/usr/bin/perl -w --                          Ari Makela


Quote:> use strict; print "Just Another Perl Hacker\n";

http://www.iki.fi/hauva/ #

- Show quoted text -

Quote:

> "Father, I have done questionable things." - Roy

 
 
 

1. date/time of a file compare with current date/time

Hi,

I hope i can drop my question about Linux shell programming here?

I'm writing a script in bash to find files. I'm using the slocate
programm, which is being runned every hour using a cron job, to create
it's database.

Now i want to know how long it is ago that the database has been
recreated. Zo i need to check the date and time from that file and
compare it with the current date and time. I know there must be easy to
do but i can't find the trick to do it.

Maikel van Gorkom

Sent via Deja.com http://www.deja.com/
Before you buy.

2. Updated Release of TIGER (2.2.1), UNIX Security Checking System

3. convert UT time in local time / local time in UT time

4. Keyboard kills windows in X

5. time time time how can I tell the time

6. Linux with virtual hosts?

7. Compiles run 10 times slower with LGX compared to SLS

8. tin v1.5.4

9. Daylight time (label) but standard time (time)

10. Compile-time versus run-time

11. run time date and syslog date/time conflict

12. Daylight Savings time, system time, hardware time....

13. Need help with 'time' C Run-Time Library functions under HP-UX