From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 254AD13E2B9D; Wed, 4 Jun 2025 14:07:39 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 254AD13E2B9D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1749035259; bh=7AMue9KeqYOvn2oCIVAQ0oHrFw3ulumnRcekyFTHPMs=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=N8n+trhyscLaXVTtHVj8izoH1SkJ1UfIYMx8YNr99zQGyTQO2IPkQ1no/jZmsi0T3 +fpkIC5M0jeStweD7l/N4ltgqnhII1XB+4bWcmOoXYoZwUdhR7Gzqci3cZSSuW05wT pV9Imb7Hp08IuCAcMrrQEf3bAV8RaZKC34GvU0rY= Received: from send127.i.mail.ru (send127.i.mail.ru [89.221.237.222]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 6A6C613E2B9B for ; Wed, 4 Jun 2025 14:07:38 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6A6C613E2B9B Received: by exim-smtp-75656d46d5-cj6sc with esmtpa (envelope-from ) id 1uMly5-00000000C0N-1wkC; Wed, 04 Jun 2025 14:07:37 +0300 Content-Type: multipart/alternative; boundary="------------87P30EoGD0BIYxbBcFHLJCbj" Message-ID: Date: Wed, 4 Jun 2025 14:07:37 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun , Sergey Bronnikov Cc: tarantool-patches@dev.tarantool.org References: <6aefeed4eee55e77e7c79ac9b31c284b014d2c7a.1747399055.git.sergeyb@tarantool.org> In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9851146C857904EAB410B746AC0898F9C060310F8BD47E1C0182A05F5380850402BC071F9432980A13DE06ABAFEAF670519F14DF87A12AEEC4B9AA7BA5DD669DDB76EC74E5D6971C8 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7E9C44F3538ABC873EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB553375662BC6C8E92A5ED8237DBFB384DB5577BCD23FF96ECD01749E3BCE45D33E3152DD389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C07E7E81EEA8A9722B8941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B64854413538E1713FCC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C22498454CE1F0CC570F276E601842F6C81A12EF20D2F80756B5FB606B96278B59C4276E601842F6C81A127C277FBC8AE2E8B737A71E5A7855C703AA81AA40904B5D99C9F4D5AE37F343AD1F44FA8B9022EA23BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735A3CCBC2573AEBDE1C4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A50A2D8D326321EA165002B1117B3ED69662BB8D3987D2F04730C8F815570A3530823CB91A9FED034534781492E4B8EEADEF0AF71940E62277BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFFE0E0DF0896208F253A781818F443C88A981EAF265354B427426B42ADE7A861975F3776783CA996B3968DBE8110FF34EE647307F233F137962CCDDFE6E5D2CC8DC558BBD229CBE335F4332CA8FE04980913E6812662D5F2AB9AF64DB4688768036DF5FE9C0001AF333F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVSykAyseJQ6/NI0XCUjsy+g= X-Mailru-Sender: 520A125C2F17F0B1E52FEF5D219D61401587CB2BF62141810578E6996F38341311ED0ACE894490A00152A3D17938EB451EB5A0BCEC6A560B3DDE9B364B0DF289BE2DA36745F2EEB5CEBA01FB949A1F1EEAB4BC95F72C04283CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit][v1] sysprof: allow calling sysprof.report before stopping X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This is a multi-part message in MIME format. --------------87P30EoGD0BIYxbBcFHLJCbj Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi, Sergey, thanks for the comments! See my replies below. On 6/4/25 11:35, Sergey Kaplun via Tarantool-patches wrote: > Hi, Sergey! > Thanks for the patch! > LGTM, with minor comments below. > > On 16.05.25, Sergey Bronnikov wrote: >> It is not allowed to call a function `sysprof.report()` without >> stopping profiler. However, sometimes it may be useful to analyze > Typo: s/profiler/the profiler/ Fixed. >> numbers provided by the report without stopping the profiler. The >> patch removes the appropriate condition and allows reporting >> without stopping. >> >> Resolves tarantool/tarantool#11229 >> --- >> Branch:https://github.com/tarantool/luajit/tree/ligurio/gh-11229-misc.sysprof.report >> Issue:https://github.com/tarantool/tarantool/issues/11229 >> >> src/lj_sysprof.c | 2 -- >> .../profilers/misclib-sysprof-lapi.test.lua | 18 ++++++++++++++++-- >> 2 files changed, 16 insertions(+), 4 deletions(-) >> >> diff --git a/src/lj_sysprof.c b/src/lj_sysprof.c >> index 88c7a41b..cf6161a5 100644 >> --- a/src/lj_sysprof.c >> +++ b/src/lj_sysprof.c > > >> diff --git a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua >> index f316c390..3e774a53 100644 >> --- a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua >> +++ b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua > > >> @@ -166,13 +166,27 @@test:is(err, nil, "no error with good interval 1") >> test:is(errno, nil, "no errno with good interval 1") >> misc.sysprof.stop() >> >> +-- Intermediate sysprof.report(). >> +res, err, errno = misc.sysprof.start{ >> + mode = "C", > I suppose we don't need to run the profiler in "C" mode. Let's use "D" > here. Fixed. --- a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua +++ b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua @@ -168,7 +168,7 @@ misc.sysprof.stop()  -- Intermediate sysprof.report().  res, err, errno = misc.sysprof.start{ -    mode = "C", +    mode = "D",      interval = 1,      path = "/dev/null",  } > >> + interval = 1, >> + path = "/dev/null", >> +} >> +test:is(res, true, "res is correct") >> +test:is(err, nil, "no error") >> +test:is(errno, nil, "no errno") > I suppose that 2 last checks are excess. The first one is enough to be > sure that the profiler is started. Also, we may use `assert()` here > instead of `test:is()` check, since we don't want to _test_ the starting of > the profiler only to _assert_ that the sysprof has been started. > last two checks were removed and test:is() replaced with assert() >> + >> +local report = misc.sysprof.report() >> +test:ok(report.samples == 0, "total number of samples is non-zero") > I'm not sure that this will always be true (for example, in coverage > workflow). I suggest increasing the interval dramatically to avoid false > positives here. Updated. >> +misc.sysprof.stop() >> + > > >> 2.43.0 >> --------------87P30EoGD0BIYxbBcFHLJCbj Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hi, Sergey,

thanks for the comments! See my replies below.


On 6/4/25 11:35, Sergey Kaplun via Tarantool-patches wrote:
Hi, Sergey!
Thanks for the patch!
LGTM, with minor comments below.

On 16.05.25, Sergey Bronnikov wrote:
It is not allowed to call a function `sysprof.report()` without
stopping profiler. However, sometimes it may be useful to analyze
Typo: s/profiler/the profiler/
Fixed.

      
numbers provided by the report without stopping the profiler. The
patch removes the appropriate condition and allows reporting
without stopping.

Resolves tarantool/tarantool#11229
---
Branch: https://github.com/tarantool/luajit/tree/ligurio/gh-11229-misc.sysprof.report
Issue: https://github.com/tarantool/tarantool/issues/11229

 src/lj_sysprof.c                               |  2 --
 .../profilers/misclib-sysprof-lapi.test.lua    | 18 ++++++++++++++++--
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/lj_sysprof.c b/src/lj_sysprof.c
index 88c7a41b..cf6161a5 100644
--- a/src/lj_sysprof.c
+++ b/src/lj_sysprof.c
<snipped>

diff --git a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua
index f316c390..3e774a53 100644
--- a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua
+++ b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua
<snipped>

@@ -166,13 +166,27 @@ test:is(err, nil, "no error with good interval 1")
 test:is(errno, nil, "no errno with good interval 1")
 misc.sysprof.stop()
 
+-- Intermediate sysprof.report().
+res, err, errno = misc.sysprof.start{
+    mode = "C",
I suppose we don't need to run the profiler in "C" mode. Let's use "D"
here.

Fixed.

--- a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua
+++ b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua
@@ -168,7 +168,7 @@ misc.sysprof.stop()
 
 -- Intermediate sysprof.report().
 res, err, errno = misc.sysprof.start{
-    mode = "C",
+    mode = "D",
     interval = 1,
     path = "/dev/null",
 }


+    interval = 1,
+    path = "/dev/null",
+}
+test:is(res, true, "res is correct")
+test:is(err, nil, "no error")
+test:is(errno, nil, "no errno")
I suppose that 2 last checks are excess. The first one is enough to be
sure that the profiler is started. Also, we may use `assert()` here
instead of `test:is()` check, since we don't want to _test_ the starting of
the profiler only to _assert_ that the sysprof has been started.

last two checks were removed and test:is() replaced with assert()
+
+local report = misc.sysprof.report()
+test:ok(report.samples == 0, "total number of samples is non-zero")
I'm not sure that this will always be true (for example, in coverage
workflow). I suggest increasing the interval dramatically to avoid false
positives here.
Updated.

      
+misc.sysprof.stop()
+
<snipped>

2.43.0


    
--------------87P30EoGD0BIYxbBcFHLJCbj--