"...User code time... + system code time... = real time..."
Yes:
From the docs:
"The time utility executes and times the specified utility. After the
utility finishes, time writes to the standard error stream, (in seconds):
the total time elapsed, the time used to execute the utility process and
the time consumed by system overhead."
Some observations:
karls-mac-mini:monks karl$ ls -hl very_huge10GB.file
-rw-r--r-- 1 karl karl 10G 25 Mai 00:53 very_huge10GB.file
karls-mac-mini:monks karl$ time grep karl very_huge10GB.file
nose cuke karl
nose cuke karl
nose cuke karl
nose cuke karl
nose cuke karl
real 2m42.126s
user 0m20.437s
sys 0m5.645s
karls-mac-mini:monks karl$ ./mce_loop.pl
nose cuke karl
nose cuke karl
nose cuke karl
nose cuke karl
nose cuke karl
Took 150.555 seconds
#!/usr/bin/env perl
use Time::HiRes qw( time );
use feature qw(say);
my $start = time;
say qx (grep karl very_huge10GB.file);
printf "Took %.3f seconds\n", time - $start;
__END__
karls-mac-mini:monks karl$ ./wrap.pl
nose cuke karl
nose cuke karl
nose cuke karl
nose cuke karl
nose cuke karl
Took 157.265 seconds
For the grep example 60+60+42=162 which is 2m42s. But user+sys (20+5) is 0m25s. What do i miss?
Perhaps it's too late tonight. Or too early in the morning?
Best regards, Karl
«The Crux of the Biscuit is the Apostrophe»
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|