help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Implementing a trace() function for stack/timing information


From: Joshua Redstone
Subject: Implementing a trace() function for stack/timing information
Date: Sun, 20 Apr 2008 09:45:10 -0700

Hi all,
Does anyone know how to implement a function trace(), that prints the elapsed time since
it was last called and also prints the file/line information of the trace() caller?
Such a thing would be usefull for debugging performance issues.
I tried:

warning("on","backtrace");
global last_time;
last_time = time();
function trace()
  global last_time;
  new_time = time();
  lastwarn("");
  lasterr("");
  lastwarn("");
  lasterror("reset");
  warning("on","backtrace");
  warning("delta t = %6.3f seconds\n", new_time - last_time);
  last_time = new_time;
endfunction

but it does not print stack information.  I can't figure out the right combination of warn/err calls to get it to do it.
Many thanks for any suggestions!
Josh

reply via email to

[Prev in Thread] Current Thread [Next in Thread]