result of os.times() is different with 'time' command Options
hiral
hiralsmaillist at gmail.com
Mon Mar 15 02:51:28 EDT 2010
On Mar 15, 7:14 am, Tim Roberts <t... at probo.com> wrote:
> hiral<hiralsmaill... at gmail.com> wrote:
> >...
> >Output:
> >real 0.0m0.0100000002421s
> >user 0.0m0.0s
> >sys 0.0m0.0s
>
> >Command:
> >$ time ls
>
> >Output:
> >real 0m0.007s
> >user 0m0.000s
> >sys 0m0.000s
>
> >Is this the intended behaviour?
>
> What is it that you are wondering about? The formatting difference is due
> to your code. The difference between 10 milliseconds and 7 milliseconds
> could be due to any number of things. First, you have the overhead of
> Python involved in your measurements. Second, you have the variability of
> memory caching and disk caching. Your Python code causes /bin/ls to be
> loaded into memory, and it's probably still in a file cache when you run
> the second command.
>
> You can't really do an analysis like this with a task that only takes a few
> milliseconds. There are too many variables.
> --
> Tim Roberts, t... at probo.com
> Providenza & Boekelheide, Inc.- Hide quoted text -
>
> - Show quoted text -
Thanks for your explanation.
More information about the Python-list
mailing list