time-fnc.hlp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. Time-fnc.sl : code to time function calls.
  2. Usage:
  3. do
  4. (timef function-name-1 function-name-2 ...)
  5. Timef is a fexpr.
  6. It will redefine the functions named so that timing information is
  7. kept on these functions.
  8. This information is kept on the property list of the function name.
  9. The properties used are `time' and `number-of-calls'.
  10. (get function-name 'time) gives you the total time in the function.
  11. (not counting gc time).
  12. Note, this is the time from entrance to exit.
  13. The timef function redefines the function with an
  14. unwind-protect, so calls that are interrupted
  15. by *throws are counted.
  16. (get function-name 'number-of-calls) gives you the number of times
  17. the function is called.
  18. To stop timing do :
  19. (untimef function-name1 ..)
  20. or do (untimef) for all functions.
  21. (untimef) is a fexpr.
  22. To print timing information do
  23. (print-time-info function-name-1 function-name-2 ..)
  24. or do (print-time-info) for timing information on all function names.
  25. special variables used:
  26. *timed-functions* : list of all functions currently being timed.
  27. *all-timed-functions* : list of all functions ever timed in the
  28. current session.
  29. Comment: if tr is called on a called on a function that is already
  30. being timed, and then untimef is called on the function, the
  31. function will no longer be traced.