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 DA4D839BE3F; Thu, 12 Mar 2026 20:04:08 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DA4D839BE3F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1773335049; bh=CyTqC+cmTiP2avWwkNyjv7iJU7bwbCkpodM/7rJ1xHE=; 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=NkdgRTWHSH/M4JO5KTORYBa/JPUa84NYX/psQuvVyBfh/J39Wxf+xk0A7n6iK9FC1 c2phx9GGxHlWhVdXqlOp7/26nPfBD+OzF0I9mrzqHHXQNp72Q+TQMv+DqmgqIcj875 gGtNALUTxOmuHHYIzGmwKfkvJdzSD8qQXclDcOOw= Received: from send173.i.mail.ru (send173.i.mail.ru [95.163.59.12]) (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 2488139BE3F for ; Thu, 12 Mar 2026 20:04:07 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2488139BE3F Received: by exim-smtp-64cdfc6c8d-bb5jz with esmtpa (envelope-from ) id 1w0jSA-000000000kd-0xJK; Thu, 12 Mar 2026 20:04:06 +0300 Content-Type: multipart/alternative; boundary="------------o5vYtbmk002QkcvjzoG6K6i0" Message-ID: <7f14d93b-f295-434f-898c-3409daee3053@tarantool.org> Date: Thu, 12 Mar 2026 20:04:05 +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: In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD91ABAE9865AC7DC88E3B882EBCA423B4D3BB7B2ACD2117197182A05F538085040EB347E710A59DD8B3DE06ABAFEAF6705992093A164CF55FC5697EB80B0DC2BBA0F4B8A9FC37412E1 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7B264C8851FD8E810EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB5533756627194F95AE6E7C2D016AEDBA198D9FB6DD759448F72D23B29385624C2B2DF570389733CBF5DBD5E913377AFFFEAFD269A417C69337E82CC2CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C07E7E81EEA8A9722B8941B15DA834481F9449624AB7ADAF37BA3038C0950A5D3613377AFFFEAFD269176DF2183F8FC7C0780023771F26D54D7B076A6E789B0E97A8DF7F3B2552694AD5FFEEA1DED7F25D49FD398EE364050F9647ADFADE5905B17AAF5A6EB0CB4C2AB3661434B16C20ACC84D3B47A649675FE827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8BC6A536F79815AD9275ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A56C0ED1A81E9D4E985002B1117B3ED6966C2C7FD14CE641C8AD0703CEB2EF9A27823CB91A9FED034534781492E4B8EEADCAFEFF123806BC82BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34CAB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D6598CE8E8C9F12EDD2D7BB180F325C1CB8F6A89176CCFF0A2D69A7D02D559C3B5241192436440534F3FB8341EE9D5BE9A0AA7FDD75F298A30BA3900E2A1BEDEE96B32075D93EA4D76686536EB022892E5344C41F94D744909CE2512F26BEC029E55448553D2254B8D95CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVdbVVJCphTR/Qp+Yzml+8Bg= X-Mailru-Sender: C4F68CFF4024C8867DFDF7C7F2588458346AE1B8BD78005F72C88FB39F7EDAEDFD28F564A8AC1AD29D8EA9046FAED6CA645D15D82EE4B272BD6E4642A116CA93524AA66B5ACBE6721EF430B9A63E2A504198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] misc: introduce flags with profiler support status 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. --------------o5vYtbmk002QkcvjzoG6K6i0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, Sergey, thanks for review! See my comments. Sergey On 3/12/26 15:00, Sergey Kaplun via Tarantool-patches wrote: > Hi, Sergey! > Thanks for the patch! > Please consider my comments below. > > On 22.01.26, Sergey Bronnikov wrote: >> The patch introduce flags in module "misc" with support status >> for sysprof and memprof: `misc.sysprof.enabled` and >> `misc.memprof.enabled`. Both flags are boolean and always > Let's rename it to `available` instead. The `enabled` may be interpreted > as `is_running`, and confuse the user then. I propose using `is_available` instead. > >> available on platforms supported by profilers (Windows is not >> supported). >> >> Closes tarantool/tarantool#12215 > Minor: Should be Resolves, since it is closed when we bump LuaJIT in the > Tarantool repository. Ok, updated. > >> --- >> src/lib_misc.c | 4 ++++ >> .../profilers/misclib-memprof-lapi-disabled.test.lua | 5 ++++- >> test/tarantool-tests/profilers/misclib-memprof-lapi.test.lua | 5 ++++- >> .../profilers/misclib-sysprof-lapi-disabled.test.lua | 5 ++++- >> test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua | 5 ++++- >> 5 files changed, 20 insertions(+), 4 deletions(-) >> >> diff --git a/src/lib_misc.c b/src/lib_misc.c >> index 034ff878..6b2278c1 100644 >> --- a/src/lib_misc.c >> +++ b/src/lib_misc.c >> @@ -478,7 +478,11 @@ LUALIB_API int luaopen_misc(struct lua_State *L) >> LJ_LIB_REG(L, LUAM_MISCLIBNAME, misc); >> #if !LJ_TARGET_WINDOWS >> LJ_LIB_REG(L, LUAM_MISCLIBNAME ".memprof", misc_memprof); >> + lua_pushboolean(L, LJ_HASMEMPROF); >> + lua_setfield(L, -2, "enabled"); >> LJ_LIB_REG(L, LUAM_MISCLIBNAME ".sysprof", misc_sysprof); >> + lua_pushboolean(L, LJ_HASSYSPROF); >> + lua_setfield(L, -2, "enabled"); > Is it possible to use standard `LJLIB_PUSH() LJLIB_SET()` machinery > instead? I didn't get what is a macros `LJLIB_SET`. Also, what are the benefits with using mentioned macros instead more standard Lua API functions? > >> #endif /* !LJ_TARGET_WINDOWS */ >> return 1; >> } >> diff --git a/test/tarantool-tests/profilers/misclib-memprof-lapi-disabled.test.lua b/test/tarantool-tests/profilers/misclib-memprof-lapi-disabled.test.lua >> index de0aa136..f867cfc6 100644 >> --- a/test/tarantool-tests/profilers/misclib-memprof-lapi-disabled.test.lua >> +++ b/test/tarantool-tests/profilers/misclib-memprof-lapi-disabled.test.lua >> @@ -3,7 +3,7 @@ local test = tap.test('misclib-memprof-lapi-disabled'):skipcond({ >> ['Memprof is enabled'] = not os.getenv('LUAJIT_DISABLE_MEMPROF'), >> }) >> >> -test:plan(6) >> +test:plan(8) >> >> -- Attempt to start memprof when it is disabled. >> local res, err, errno = misc.memprof.start() >> @@ -19,4 +19,7 @@test:ok(err:match('profiler is disabled'), >> 'error on stop when memprof is disabled') >> test:ok(type(errno) == 'number', 'errno on start when memprof is disabled') >> >> +test:ok(type(misc.memprof.enabled) == 'boolean', 'misc.memprof.enabled exists') > I suppose that > |test:is(misc.memprof.available, false, 'misc.memprof.enabled correct') > is enough. > > Same for other tests below. if "misc.memprof" is not a table the error will be "attempt to index field" > > >> +test:ok(misc.memprof.enabled == false, 'misc.memprof.enabled is false') >> + >> test:done(true) >> diff --git a/test/tarantool-tests/profilers/misclib-memprof-lapi.test.lua b/test/tarantool-tests/profilers/misclib-memprof-lapi.test.lua >> index cd675864..44ba8b08 100644 >> --- a/test/tarantool-tests/profilers/misclib-memprof-lapi.test.lua >> +++ b/test/tarantool-tests/profilers/misclib-memprof-lapi.test.lua > > >> diff --git a/test/tarantool-tests/profilers/misclib-sysprof-lapi-disabled.test.lua b/test/tarantool-tests/profilers/misclib-sysprof-lapi-disabled.test.lua >> index 2a9ce796..c023d8f1 100644 >> --- a/test/tarantool-tests/profilers/misclib-sysprof-lapi-disabled.test.lua >> +++ b/test/tarantool-tests/profilers/misclib-sysprof-lapi-disabled.test.lua > > >> diff --git a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua >> index 701d58e4..41ed43e0 100644 >> --- a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua >> +++ b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua > > >> -- >> 2.43.0 >> --------------o5vYtbmk002QkcvjzoG6K6i0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hi, Sergey,

thanks for review! See my comments.

Sergey

On 3/12/26 15:00, Sergey Kaplun via Tarantool-patches wrote:
Hi, Sergey!
Thanks for the patch!
Please consider my comments below.

On 22.01.26, Sergey Bronnikov wrote:
The patch introduce flags in module "misc" with support status
for sysprof and memprof: `misc.sysprof.enabled` and
`misc.memprof.enabled`. Both flags are boolean and always
Let's rename it to `available` instead. The `enabled` may be interpreted
as `is_running`, and confuse the user then.
I propose using `is_available` instead.

available on platforms supported by profilers (Windows is not
supported).

Closes tarantool/tarantool#12215
Minor: Should be Resolves, since it is closed when we bump LuaJIT in the
Tarantool repository.
Ok, updated.

---
 src/lib_misc.c                                               | 4 ++++
 .../profilers/misclib-memprof-lapi-disabled.test.lua         | 5 ++++-
 test/tarantool-tests/profilers/misclib-memprof-lapi.test.lua | 5 ++++-
 .../profilers/misclib-sysprof-lapi-disabled.test.lua         | 5 ++++-
 test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua | 5 ++++-
 5 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/lib_misc.c b/src/lib_misc.c
index 034ff878..6b2278c1 100644
--- a/src/lib_misc.c
+++ b/src/lib_misc.c
@@ -478,7 +478,11 @@ LUALIB_API int luaopen_misc(struct lua_State *L)
   LJ_LIB_REG(L, LUAM_MISCLIBNAME, misc);
 #if !LJ_TARGET_WINDOWS
   LJ_LIB_REG(L, LUAM_MISCLIBNAME ".memprof", misc_memprof);
+  lua_pushboolean(L, LJ_HASMEMPROF);
+  lua_setfield(L, -2, "enabled");
   LJ_LIB_REG(L, LUAM_MISCLIBNAME ".sysprof", misc_sysprof);
+  lua_pushboolean(L, LJ_HASSYSPROF);
+  lua_setfield(L, -2, "enabled");
Is it possible to use standard `LJLIB_PUSH() LJLIB_SET()` machinery
instead?

I didn't get what is a macros `LJLIB_SET`.

Also, what are the benefits with using mentioned macros instead more standard Lua API functions?



 #endif /* !LJ_TARGET_WINDOWS */
   return 1;
 }
diff --git a/test/tarantool-tests/profilers/misclib-memprof-lapi-disabled.test.lua b/test/tarantool-tests/profilers/misclib-memprof-lapi-disabled.test.lua
index de0aa136..f867cfc6 100644
--- a/test/tarantool-tests/profilers/misclib-memprof-lapi-disabled.test.lua
+++ b/test/tarantool-tests/profilers/misclib-memprof-lapi-disabled.test.lua
@@ -3,7 +3,7 @@ local test = tap.test('misclib-memprof-lapi-disabled'):skipcond({
   ['Memprof is enabled'] = not os.getenv('LUAJIT_DISABLE_MEMPROF'),
 })
 
-test:plan(6)
+test:plan(8)
 
 -- Attempt to start memprof when it is disabled.
 local res, err, errno = misc.memprof.start()
@@ -19,4 +19,7 @@ test:ok(err:match('profiler is disabled'),
         'error on stop when memprof is disabled')
 test:ok(type(errno) == 'number', 'errno on start when memprof is disabled')
 
+test:ok(type(misc.memprof.enabled) == 'boolean', 'misc.memprof.enabled exists')
I suppose that
| test:is(misc.memprof.available, false, 'misc.memprof.enabled correct')
is enough.

Same for other tests below.
if "misc.memprof" is not a table the error will be "attempt to index field"


+test:ok(misc.memprof.enabled == false, 'misc.memprof.enabled is false')
+
 test:done(true)
diff --git a/test/tarantool-tests/profilers/misclib-memprof-lapi.test.lua b/test/tarantool-tests/profilers/misclib-memprof-lapi.test.lua
index cd675864..44ba8b08 100644
--- a/test/tarantool-tests/profilers/misclib-memprof-lapi.test.lua
+++ b/test/tarantool-tests/profilers/misclib-memprof-lapi.test.lua
<snipped>

diff --git a/test/tarantool-tests/profilers/misclib-sysprof-lapi-disabled.test.lua b/test/tarantool-tests/profilers/misclib-sysprof-lapi-disabled.test.lua
index 2a9ce796..c023d8f1 100644
--- a/test/tarantool-tests/profilers/misclib-sysprof-lapi-disabled.test.lua
+++ b/test/tarantool-tests/profilers/misclib-sysprof-lapi-disabled.test.lua
<snipped>

diff --git a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua
index 701d58e4..41ed43e0 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


    
--------------o5vYtbmk002QkcvjzoG6K6i0--