Cornell University Cornell University CISER

CISER Computing

How to Measure CPU for Stata Jobs

Q:Is there a way to tell how much CPU time Stata takes to
run a particular command or do-file? I know about c(current_time), which
gives clock time, but is there an equivalent to the FULLSTIMER option in

A: You can use the -timer- command to record the time spent on sections of code.
Here is a simple example.

---begin log file---

. timer on 1

. sysuse auto, clear
(1978 Automobile Data)

. sum mpg

Variable | Obs Mean Std. Dev. Min Max
mpg | 74 21.2973 5.785503 12 41

. timer off 1

. timer list 1
1: 11.22 / 1 = 11.2190

--end log file---