[Tarantool-patches] [PATCH luajit 3/3] sysprof: fix a message with stop without run

Sergey Kaplun skaplun at tarantool.org
Wed Mar 5 17:52:53 MSK 2025


Hi, Sergey!
Thanks for the patch!
LGTM, with a few nits regarding the commit message and 1 ignorable
comment to the code style.

On 25.02.25, Sergey Bronnikov wrote:
> The function `misc.sysprof.stop()` reports that profiler is

Typo: s/profiler/the profiler/

> already running:
> 
> | $ ./src/luajit -e 'print(misc.sysprof.stop())'
> | nil     profiler is running already     22
> 
> both in `sysprof_error()` and fixes aforementioned problem.

Don't get this sentence.

Typo: s/aforementioned/the aforementioned/

> 
> Follows up tarantool/tarantool#781
> ---
>  src/lib_misc.c                                              | 6 ++++++
>  .../tarantool-tests/profilers/misclib-sysprof-lapi.test.lua | 5 +++--
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lib_misc.c b/src/lib_misc.c
> index c4b40996..74888d20 100644
> --- a/src/lib_misc.c
> +++ b/src/lib_misc.c
> @@ -335,6 +335,12 @@ LJLIB_CF(misc_sysprof_stop)
>    return prof_error(L, PROFILE_ERRUSE, err_details);
>  #else
>    int status = luaM_sysprof_stop(L);
> +  if (LJ_UNLIKELY(status == PROFILE_ERRRUN)) {
> +      lua_pushnil(L);
> +      lua_pushstring(L, err2msg(LJ_ERR_PROF_NOTRUNNING));
> +      lua_pushinteger(L, EINVAL);
> +      return 3;
> +  }
>    if (LJ_UNLIKELY(status != PROFILE_SUCCESS))

It looks like more natural now to use else if here now.

>      return prof_error(L, status, NULL);
>  
> diff --git a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua
> index ebd80cf6..770b5736 100644
> --- a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua
> +++ b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua

<snipped>

> -- 
> 2.43.0
> 

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list