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 E13AC19C8BB7; Thu, 22 Jan 2026 14:53:47 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E13AC19C8BB7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1769082828; bh=fXrM6KkH+KwiH5SNvrDMMVQESRaIhI8hSdRWL7sJV28=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=K0mOsfdzeXFTxLz+03xpuA5mY9HhSQkJC30y+LULHen5PkZo2+VZhcn47nAAKtUMe +gXcwc8P//3ln22rlvpiTC/hViABk88hnPLtCbT1959bSdbegLyBulXl545zfES2Ww tIARXtxG0bIpuzFdzyBf/zmAGq/rnrTXtVOFLPPM= Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 8A7F153917A for ; Thu, 22 Jan 2026 14:53:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8A7F153917A Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-59b9fee282dso821720e87.3 for ; Thu, 22 Jan 2026 03:53:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769082825; x=1769687625; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mYCv0qmcqoaIHNJm7tf9s0k7M+2AUvaUguYtjYY+7Wk=; b=F2kE54lPSagZjkbPuDhLMH/eVBq8PWFoKH9DYkVjzgmBrVFW/Nm74bE738hmc4s5CD z1GDSqfg6FzSVIX4w9ciOzhr41UYWjGVORJ0QAFUDOuuXTz6VirKjwI68RxmBmG+4hI8 tvKDRp9k+K+QUM81wsU/NKrUy1EF3ybaFqzcNyobzAlb4NNV1vb/IRIfgH3Sa9JeCn2y e7CGdoWwrHNL3UmdAx3AkLURbto/rbPACBgeUBm02+/1MkkLyNFEinfkphiRKRqXbyy/ c6USxtsI+YSN0Elh1ijhLsARGp2fBcfZxI8hmauxilZziO9I41mtdLk/o+o2IiW1q8LI zRSw== X-Gm-Message-State: AOJu0Yzl9z36Tazpjk7Hdv1J48RhTaAMdWIfLsYlw38oZigiHECUCobk cMvb+hss4Cx4JyRXHk+WOzPx7iMJ6nsQiQWxlF8f0dTGHUM4VQ7UMavDM0CDxLTV X-Gm-Gg: AZuq6aKs8P9eOQAvGlt6hRsDtum/JdCgdI/PaMRY9o920E2K5Qed7FPtHt1lUCOU+Is cWE1aPXe/ez77ENIAz/d/P5Dh+jVO2egaTLERuN3RXL4dy0j/z405OhMwMfi8L2m9lgAJZ0rDxN QYkTeJfLMkDcnWZaizzn6rQBt8hYIM7VKD4YCaJbd1n0Wt/o65qFoJOpf49W6fzHPIwlYIcZgJ8 ujU8ruXWUWlEzFFsnwNmf6UlP+WBdDi8PxhHP2hTJRH7/XHVnKgfUMmSwBExLmXut+ZjIlzD2h3 oapwTmURlwd4MrRSee8lc7xZQ8sq+Sqiu1NVMeZLRSGlJa3n0ljpgExN9I9rxBCFOkb0S+mEEQV 4QBGyiS3ckUyJTtGFmCR7drjbFXHpwC4RqPCoStgoBVuNLsG2G2RrYIfaYAtjbZcDc2no X-Received: by 2002:a05:6512:a84:b0:59d:e03a:12f1 with SMTP id 2adb3069b0e04-59de03a140bmr423460e87.30.1769082825218; Thu, 22 Jan 2026 03:53:45 -0800 (PST) Received: from localhost ([2a06:a780:1000:2::76cb:c653]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-59baf33f4a9sm5360120e87.8.2026.01.22.03.53.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 03:53:44 -0800 (PST) X-Google-Original-From: Sergey Bronnikov To: tarantool-patches@dev.tarantool.org, Sergey Kaplun Date: Thu, 22 Jan 2026 14:24:19 +0300 Message-ID: X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [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" 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 available on platforms supported by profilers (Windows is not supported). Closes tarantool/tarantool#12215 --- 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"); #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') +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 @@ -11,7 +11,7 @@ local test = tap.test("misclib-memprof-lapi"):skipcond({ ["Memprof is disabled"] = os.getenv("LUAJIT_DISABLE_MEMPROF"), }) -test:plan(5) +test:plan(7) local jit_opt_default = { 3, -- level @@ -270,4 +270,7 @@ test:test("jit-output", function(subtest) jit.opt.start(unpack(jit_opt_default)) end) +test:ok(type(misc.memprof.enabled) == 'boolean', 'misc.memprof.enabled exists') +test:ok(misc.memprof.enabled == true, 'misc.memprof.enabled is true') + test:done(true) 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 @@ -3,7 +3,7 @@ local test = tap.test('misclib-sysprof-lapi-disabled'):skipcond({ ['Sysprof is enabled'] = not os.getenv('LUAJIT_DISABLE_SYSPROF'), }) -test:plan(9) +test:plan(11) -- Attempt to start sysprof when sysprof is disabled. local res, err, errno = misc.sysprof.start() @@ -26,4 +26,7 @@ test:ok(err:match('profiler is disabled'), 'error on stop when sysprof is disabled') test:ok(type(errno) == 'number', 'errno on start when sysprof is disabled') +test:ok(type(misc.sysprof.enabled) == 'boolean', 'misc.sysprof.enabled exists') +test:ok(misc.sysprof.enabled == false, 'misc.sysprof.enabled is false') + test:done(true) 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 @@ -10,7 +10,7 @@ local test = tap.test("misclib-sysprof-lapi"):skipcond({ ["Disabled due to #10803"] = os.getenv("LUAJIT_TEST_USE_VALGRIND"), }) -test:plan(45) +test:plan(47) jit.off() -- XXX: Run JIT tuning functions in a safe frame to avoid errors @@ -228,4 +228,7 @@ check_mode("C", 100) os.remove(TMP_BINFILE) +test:ok(type(misc.sysprof.enabled) == 'boolean', 'misc.sysprof.enabled exists') +test:ok(misc.sysprof.enabled == true, 'misc.sysprof.enabled is true') + test:done(true) -- 2.43.0