[Tarantool-patches] [PATCH luajit v4 3/3] sysprof: improve parser's memory footprint

Igor Munkin imun at tarantool.org
Mon Aug 21 16:05:41 MSK 2023


Max,

Thanks for the patch! LGTM, except several nits below.

On 21.08.23, Maksim Kokryashkin wrote:
> From: Maxim Kokryashkin <m.kokryashkin at tarantool.org>
> 
> This patch reduces sysprof's parser memory footprint,
> by avoiding reading all callchains before collapsing them.
> Instead of it, parser merges stacks immediately after
> reading them atnd stores counts in a lua table.

Typo: s/atnd/and/.
Typo: s/lua/Lua/.

> 
> The `collapse.lua` module is purged as a result of the
> patch, but it is left as a stub to keep the integrational
> testing intact. This stub should be removed in the next
> series.
> 
> Resolves tarantool/tarantool#8700
> ---
> Note: the assertion, proposed by Igor wasn't added, since it breaks
> integrational testing.

OK, anyway, thanks for trying.

> 
>  tools/CMakeLists.txt       |   4 ++
>  tools/sysprof.lua          |  21 +------
>  tools/sysprof/collapse.lua | 123 +-----------------------------------
>  tools/sysprof/parse.lua    | 125 ++++++++++++++++++++++++++-----------
>  4 files changed, 100 insertions(+), 173 deletions(-)

<snipped>

> diff --git a/tools/sysprof/parse.lua b/tools/sysprof/parse.lua
> index 5b52f104..92e475a6 100755
> --- a/tools/sysprof/parse.lua
> +++ b/tools/sysprof/parse.lua

<snipped>

> @@ -143,18 +153,63 @@ local function parse_symtab(reader, symbols, vmstate)

<snipped>

> +local function insert_lua_callchain(chain, lua)
> +  local ins_cnt = 0
> +  local name_lua
> +  for _, fr in ipairs(lua.callchain) do
> +    ins_cnt = ins_cnt + 1
> +    if fr.type == FRAME.CFUNC then
> +      -- C function encountered, the next chunk
> +      -- of frames is located on the C stack.
> +      break
> +    end
> +    name_lua = fr.name
> +
> +    if fr.type == FRAME.LFUNC
> +      and lua.trace.traceno ~= nil
> +      and lua.trace.addr == fr.addr
> +      and lua.trace.line == fr.line
> +    then
> +            name_lua = lua.trace.name

Still misindented operator.

> +    end
> +
> +    table.insert(chain, name_lua)
> +  end
> +  table.remove(lua.callchain, ins_cnt)
> +end
> +

<snipped>

> --
> 2.39.2 (Apple Git-143)
> 

-- 
Best regards,
IM


More information about the Tarantool-patches mailing list