By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,310 Members | 1,466 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,310 IT Pros & Developers. It's quick & easy.

Timing a python program run

P: n/a
Hi,

In matlab, I'd calculate the time for a script named test.m to run
with:
>tic, run, toc
Is there some way to do this in python on a mac os x from the terminal
window? Or whatever?

Jul 7 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
David <dw********@suddenlink.netwrote:
Is there some way to do this in python on a mac os x from the terminal
window? Or whatever?
You can use:

% time script.py

from the command line of the terminal

--
Lawrence, oluyede.org - neropercaso.it
"It is difficult to get a man to understand
something when his salary depends on not
understanding it" - Upton Sinclair
Jul 7 '07 #2

P: n/a
On Jul 8, 12:21 am, David <dwarnol...@suddenlink.netwrote:
Hi,

In matlab, I'd calculate the time for a script named test.m to run
with:
tic, run, toc

Is there some way to do this in python on a mac os x from the terminal
window? Or whatever?
The timeit module may be of use:
http://docs.python.org/lib/module-timeit.html

Jul 8 '07 #3

P: n/a
simplest way is just put a timer on start and another on the end,
then calc the elapse. You can also take a look timeit module too
which provides similar but more powerful functions...

-Jim

On Jul 7, 2007, at 12:21 PM, David wrote:
Hi,

In matlab, I'd calculate the time for a script named test.m to run
with:
>>tic, run, toc

Is there some way to do this in python on a mac os x from the terminal
window? Or whatever?

--
http://mail.python.org/mailman/listinfo/python-list
Jul 8 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.