<!DOCTYPE html>
<html data-lt-installed="true">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body style="padding-bottom: 1px;">
    <p>Hi, Sergey,</p>
    <p>the patch series was rebased to the master branch
      (tarantool/master)</p>
    <p>without conflicts.</p>
    <p>Sergey<br>
    </p>
    <div class="moz-cite-prefix">On 05.03.2025 17:52, Sergey Kaplun via
      Tarantool-patches wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:Z8hlRRm2n2m3r8m3@root">
      <pre wrap="" class="moz-quote-pre">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:
</pre>
      <blockquote type="cite">
        <pre wrap="" class="moz-quote-pre">The function `misc.sysprof.stop()` reports that profiler is
</pre>
      </blockquote>
      <pre wrap="" class="moz-quote-pre">
Typo: s/profiler/the profiler/

</pre>
      <blockquote type="cite">
        <pre wrap="" class="moz-quote-pre">already running:

| $ ./src/luajit -e 'print(misc.sysprof.stop())'
| nil     profiler is running already     22

both in `sysprof_error()` and fixes aforementioned problem.
</pre>
      </blockquote>
      <pre wrap="" class="moz-quote-pre">
Don't get this sentence.</pre>
    </blockquote>
    <p>Missed this comment.</p>
    <p>Now commit message is updated, new version is below:</p>
    <p>Author: Sergey Bronnikov <a class="moz-txt-link-rfc2396E" href="mailto:sergeyb@tarantool.org"><sergeyb@tarantool.org></a><br>
      Date:   Tue Feb 4 11:48:05 2025 +0300<br>
      <br>
          sysprof: fix a message with stop without run<br>
          <br>
          When sysprof is not started the function `misc.sysprof.stop()`<br>
          reports that profiler is already running:<br>
          <br>
          | $ ./src/luajit -e 'print(misc.sysprof.stop())'<br>
          | nil     profiler is running already     22<br>
          <br>
          The patch fixes that:<br>
          <br>
          | $ ./src/luajit -e 'print(misc.sysprof.stop())'<br>
          | nil     profiler is not running         22<br>
          <br>
          Follows up tarantool/tarantool#781<br>
    </p>
    <blockquote type="cite" cite="mid:Z8hlRRm2n2m3r8m3@root">
      <pre wrap="" class="moz-quote-pre">

Typo: s/aforementioned/the aforementioned/

</pre>
      <blockquote type="cite">
        <pre wrap="" class="moz-quote-pre">
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))
</pre>
      </blockquote>
      <pre wrap="" class="moz-quote-pre">
It looks like more natural now to use else if here now.

</pre>
      <blockquote type="cite">
        <pre wrap="" class="moz-quote-pre">     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
</pre>
      </blockquote>
      <pre wrap="" class="moz-quote-pre">
<snipped>

</pre>
      <blockquote type="cite">
        <pre wrap="" class="moz-quote-pre">-- 
2.43.0

</pre>
      </blockquote>
      <pre wrap="" class="moz-quote-pre">
</pre>
    </blockquote>
  </body>
  <lt-container></lt-container>
</html>