From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Maxim Kokryashkin <max.kokryashkin@gmail.com>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit 2/2] sysprof: add stack sandwich support
Date: Sat, 16 Jul 2022 10:32:53 +0300 [thread overview]
Message-ID: <YtJppfBK2Vfmi/aV@root> (raw)
In-Reply-To: <83b89e5c769469d19f0bc9144667685801f3cb51.1656883823.git.m.kokryashkin@tarantool.org>
Hi, Maxim!
Thanks for the patch!
LGTM, except a few nits below.
On 04.07.22, Maxim Kokryashkin wrote:
> This commit introduces stack sandwich support to the
> sysprof's parser.
>
> Sandwich is handled the following way:
Typo: s/Sandwich/The sandwich/
> 1. If there is a `lua_cpcall` in the C stack trace, nothing
> is done on the C stack and the corresponding frame on the
> Lua stack is removed.
> 2. If there is a `lua_call`/`lua_pcall`, then next chunk of
Typo: s/next chunk/the next chunk/
> frames is from the Lua stack. That chunk ends with either
> a CFUNC, or a stack trace end.
>
> Resolves tarantool/tarantool#7244
> ---
> tools/sysprof/collapse.lua | 31 +++++++++++++++++++------------
> 1 file changed, 19 insertions(+), 12 deletions(-)
>
> diff --git a/tools/sysprof/collapse.lua b/tools/sysprof/collapse.lua
> index b0c4afc8..b815baf3 100755
> --- a/tools/sysprof/collapse.lua
> +++ b/tools/sysprof/collapse.lua
> @@ -39,9 +39,11 @@ local function insert(name, node, is_leaf)
> end
>
> local function insert_lua_callchain(chain, lua, symbols)
<snipped>
> end
> + table.remove(lua.callchain, ins_cnt)
> end
>
> +
Nit: looks like this newline is excess.
> -- merge lua and host callchains into one callchain representing
> -- transfer of control
> local function merge(event, symbols, sep_vmst)
> local cc = {}
> - local lua_inserted = false
>
> for _,h_fr in pairs(event.host.callchain) do
> local name_host = symtab.demangle(symbols, {
> addr = h_fr.addr,
> gen = h_fr.gen
> })
> + table.insert(cc, 1, { name = name_host })
>
> - -- We assume that usually the transfer of control
> - -- looks like:
> - -- HOST -> LUA -> HOST
> - -- so for now, lua callchain starts from lua_pcall() call
> - if name_host == 'lua_pcall' then
> - insert_lua_callchain(cc, event.lua, symbols)
> - lua_inserted = true
> + if string.match(name_host, '^lua_cpcall') ~= nil then
Why do we use `string.match()` instead `==`?
> + -- Any C function is present on both the C and the Lua
> + -- stacks. It is more convenient to get its info from the host stack,
> + -- since it has information about child frames.
> + table.remove(event.lua.callchain, 1)
> end
>
> - table.insert(cc, 1, { name = name_host })
> - end
> + if string.match(name_host, '^lua_p?call') ~= nil then
I suggest to check full function name, so use '^lua_p?call$' as pattern
instead.
> + insert_lua_callchain(cc, event.lua, symbols)
> + end
>
> - if lua_inserted == false then
> - insert_lua_callchain(cc, event.lua, symbols)
> end
>
> if sep_vmst == true then
> --
> 2.36.1
>
--
Best regards,
Sergey Kaplun
next prev parent reply other threads:[~2022-07-16 7:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-03 21:38 [Tarantool-patches] [PATCH luajit 0/2] sysprof: fix inconsistencies Maxim Kokryashkin via Tarantool-patches
2022-07-03 21:38 ` [Tarantool-patches] [PATCH luajit 1/2] symtab: fix static symtab dump Maxim Kokryashkin via Tarantool-patches
2022-07-16 7:21 ` Sergey Kaplun via Tarantool-patches
2022-07-03 21:38 ` [Tarantool-patches] [PATCH luajit 2/2] sysprof: add stack sandwich support Maxim Kokryashkin via Tarantool-patches
2022-07-16 7:32 ` Sergey Kaplun via Tarantool-patches [this message]
2022-07-18 17:23 ` [Tarantool-patches] [PATCH luajit 0/2] sysprof: fix inconsistencies Igor Munkin via Tarantool-patches
2022-08-10 14:34 ` Igor Munkin via Tarantool-patches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YtJppfBK2Vfmi/aV@root \
--to=tarantool-patches@dev.tarantool.org \
--cc=max.kokryashkin@gmail.com \
--cc=skaplun@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH luajit 2/2] sysprof: add stack sandwich support' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox