# profile

Definition: | profile(bool bOn)
Description: | Enable or disable profiling at run-time. This works for both execution-count and time-profiling. If bOn is true(1) then profiling will be enabled, and samples/counts will be recorded. If bOn is false(0) then profiling will be disabled and samples/counts will not be recorded. An ex.pro file containing a special listing of your program is produced by the interpreter when the program finishes execution.
pwa/p2js: | Not supported. It would of course be rather difficult for the browser to write an ex.pro file.
Comments: | After a with profile or with profile_time statement, profiling is turned on automatically. Use profile(0/false) to turn it off. Use profile(1/true) to turn it back on when execution reaches the code that you wish to focus the profile on. Profiling does not apply to inline assembly (#ilASM{}), only hll code. The comments in the technicalia drop-down on the trace documentation apply equally to profiling.
Example 1: |
    profile(0)
      ...
    procedure slow_routine()
    profile(1)
      ...
    profile(0)
    end procedure
Implementation: | via :%opProfile in builtins\VM\pProfile.e (an autoinclude/part of the compiler).
See Also: | trace, profiling, special top-level statements