Mercurial > octave
changeset 33433:761b404e9569
profile.m: Stop profiler when "clear" option given.
* profile.m: Document that option "clear" will also stop profiler. In "clear"
case statement, call "__profiler_enable__ (false)" if profiler is running.
Simplify "status" case statement by using ifelse function. Remove obsolete
BIST test.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 18 Apr 2024 19:43:23 -0700 |
parents | 83352d86f20d |
children | 69eb4c27d8c8 |
files | scripts/profiler/profile.m |
diffstat | 1 files changed, 5 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/profiler/profile.m Thu Apr 18 21:03:51 2024 +0200 +++ b/scripts/profiler/profile.m Thu Apr 18 19:43:23 2024 -0700 @@ -41,7 +41,7 @@ ## with @code{T = profile ("info")}. ## ## @item profile clear -## Clear all collected profiler data. +## Clear all collected profiler data and stop profiling. ## ## @item profile resume ## Restart profiling without clearing the old data. All newly collected @@ -84,18 +84,16 @@ __profiler_enable__ (false); case "clear" + if (__profiler_enable__ ()) + __profiler_enable__ (false); + endif __profiler_reset__ (); case "resume" __profiler_enable__ (true); case "status" - enabled = __profiler_enable__ (); - if (enabled) - enabled = "on"; - else - enabled = "off"; - endif + enabled = ifelse (__profiler_enable__ (), 'on', 'off'); retval = struct ("ProfilerStatus", enabled); case "info" @@ -156,5 +154,4 @@ ## Test input validation %!error <Invalid call> profile () -%!error profile ("on", 2) %!error profile ("INVALID_OPTION")