Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: How can I keep track of computation time ?


From   Brendan Halpin <[email protected]>
To   [email protected]
Subject   Re: st: How can I keep track of computation time ?
Date   Mon, 21 May 2007 19:11:32 +0100

[email protected] writes:

> How can I keep track of computation time within stata do files? Matlab has
> a built-in tic and toc stop-watch, doesn't stata?

On Linux, for running programs batch-style, I use a bash script
which essentially runs the following commands:

nice time -f "$progname: Elapsed: %E; System: %S; User: %U; Major PFs: %F"\
        stata $arg2 -b do $statacode 2> /tmp/stb$$timelog
    cat /tmp/stb$$timelog >> ${statacode}.log
    echo "$progname: Finished: `date`" >> ${statacode}.log

This appends a block like this:

stb: Elapsed: 7:45.04; System: 0.87; User: 434.70; Major PFs: 29
stb: Finished: Tue Apr 17 23:14:33 IST 2007

at the end of the log. 

Perhaps not what you had in mind (timing individual commands
interactively?) but I find it very useful to have this info by
default. Also, jobs that take long enough for it to matter are well
worth doing batch-wise anyway.

Brendan
-- 
Brendan Halpin,  Department of Sociology,  University of Limerick,  Ireland
Tel: w +353-61-213147 f +353-61-202569 h +353-61-338562; Room F2-025 x 3147
mailto:[email protected]  http://www.ul.ie/sociology/brendan.halpin.html
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index