timer

Accession:50185
return amount of processor time used by a hoc call<br> only tested under LINUX (other UNIX systems may require changing #include -- see 'man clock') <br> // time("job()") will return processor time required to run job<br> // if tmstr is set then time() will run job listed there (default "run()")<br> // prints out date before and after as well as processor time so can assess loading<br> // if CPU is unloaded real elapsed time should equal processor time<br>
Tool Information (Click on a link to find other Tools with that property)
Tool Type: Utility;
Simulation Environment: NEURON;
\
timer
README
prtime.mod
time.hoc
                            
// $Id: time.hoc,v 1.3 2005/03/25 13:24:29 billl Exp $

strdef tmstr
tmstr="run()"

// time("job()") will return processor time required to run job
// if tmstr is set then time() will run job listed there (default "run()")
// prints out date before and after as well as processor time so can assess loading
// if CPU is unloaded real elapsed time should equal processor time
func time () { local tti
  prtime()
  system("date")
  if (numarg()==1) execute1($s1) else execute1(tmstr)
  tti=prtime()
  if (tti<60) print tti,"s" else print tti/60,"m"
  system("date")
  return tti
}

// now() returns time in sec since 01/01/05
// sleepfor(SEC) sleeps for SEC secs
proc testsleep ()  {
  print "Time at beginning:    ",now()
  sleepfor(3)
  print "Time 3 seconds later: ",now()
}