Skip to content

tests/lapi: add sysprof test #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ligurio
Copy link
Owner

@ligurio ligurio commented Jul 30, 2025

No description provided.

@ligurio ligurio force-pushed the ligurio/gh-xxxx-lapi-sysprof branch from 586ceda to 421cf11 Compare July 30, 2025 10:46
@ligurio ligurio requested a review from Buristan July 30, 2025 14:49
@ligurio ligurio force-pushed the ligurio/gh-xxxx-lapi-sysprof branch from 421cf11 to 4172439 Compare July 30, 2025 14:52
Copy link
Collaborator

@Buristan Buristan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, Sergey!
Thanks for the patch-set.
I'll proceed with the review per-patch below.


[PATCH 1/2] tests/lapi: add sysprof test

I would rather split this patch into 2 separate ones -- for jit.p and misc.sysprof correspondingly.

local MAX_INT = test_lib.MAX_INT
local MIN_INT = test_lib.MIN_INT

local has_tnt_sysprof, sysprof = pcall(require, "misc.sysprof")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather separate those profilers to make test a little bit clearer.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

splited to two tests:

tests/lapi/jit_p_test.lua
tests/lapi/misc_sysprof_test.lua

Copy link
Owner Author

@ligurio ligurio Aug 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can move misc_sysprof_test.lua to tarantool repo if you wish. Because it is not applicable to other Lua runtimes and Tarantool-specific.

.luacheckrc Outdated
@@ -1,3 +1,6 @@
-- Tarantool introduces a global for misc API namespace.
read_globals = { "misc" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not necessary, since you may refer the sysprof's functions via require result.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

"i", -- Sampling interval in milliseconds (default 10ms).
}

local SYSPROF_DEFAULT_INTERVAL = 10 -- ms
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to use the minimum possible interval here.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to 1

mode = mode,
path = "/dev/null",
})
assert(err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: It may be written as the following:
assert(misc.sysprof.start(...))
Feel free to ignore.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrapped with assert(), thanks!

Copy link
Collaborator

@Buristan Buristan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[PATCH 2/2] tests/capi: omit sysprof testing

With test misc_sysprof_test.lua
added in the previous commit sysprof in luaL_loadbuffer_proto_test
is not needed anymore.

I do not agree with this:

  1. It handles the different API invocations (not the C callback, but the Lua function).
  2. The test added in the previous commit is not very useful unless the Lua mutator is added.

Thus, I suggest dropping this commit for now.

@Buristan Buristan assigned ligurio and unassigned Buristan Jul 31, 2025
@ligurio
Copy link
Owner Author

ligurio commented Aug 6, 2025

[PATCH 2/2] tests/capi: omit sysprof testing

removed from the patchset (cherry-picked to the branch with luamut integration)

The patch adds tests for sysprof built into LuaJIT and
Tarantool's sysprof.
@ligurio ligurio force-pushed the ligurio/gh-xxxx-lapi-sysprof branch from 4172439 to 08f5667 Compare August 6, 2025 19:25
@ligurio ligurio requested a review from Buristan August 6, 2025 19:54
@ligurio ligurio assigned Buristan and unassigned ligurio Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants