Tarantool development patches archive
 help / color / mirror / Atom feed
From: Maxim Kokryashkin via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: "Sergey Bronnikov" <sergeyb@tarantool.org>
Cc: "Maksim Kokryashkin" <max.kokryashkin@gmail.com>,
	tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches]  [PATCH luajit v7] memprof: introduce cli flag to run dump parser
Date: Fri, 14 Jul 2023 15:41:10 +0300	[thread overview]
Message-ID: <1689338470.607537260@f763.i.mail.ru> (raw)
In-Reply-To: <b11fca02-3b95-4b93-f189-0d83e643b9d3@tarantool.org>

[-- Attachment #1: Type: text/plain, Size: 3656 bytes --]


Hi! Thanks for the review.
 
> 
>>Hello, Max!
>>
>>Thanks for the patch! See my comments.
>>
>>
>>Sergey
>>
>>On 7/10/23 14:24, Maksim Kokryashkin wrote:
>>> From: Maxim Kokryashkin < m.kokryashkin@tarantool.org >
>>>
>>> It is really inconvenient to use a standalone shell script to parse
>>> memprof dump. That is why this commit introduces a CLI flag for tools
>>> to the LuaJIT, so now it is possible to parse memprof dump
>>> as simple as:
>>> ```
>>> luajit -tm memprof.bin
>>> ```
>>>
>>> Closes tarantool/tarantool#5688
>>> ---
>>> Changes in v7:
>>> - Fixed comments as per review by Sergey
>>>
>>> Branch:  https://github.com/tarantool/luajit/tree/fckxorg/gh-5688-cli-for-memprof-parse
>>> PR:  https://github.com/tarantool/tarantool/pull/8002
>>>
>>> src/luajit.c | 32 +++++++++-
>>> .../gh-5688-memprof-cli-flag.test.lua | 58 +++++++++++++++++++
>>> 2 files changed, 89 insertions(+), 1 deletion(-)
>>> create mode 100644 test/tarantool-tests/gh-5688-memprof-cli-flag.test.lua
>>>
>>> diff --git a/src/luajit.c b/src/luajit.c
>>> index 1ca24301..d335f32b 100644
>>> --- a/src/luajit.c
>>> +++ b/src/luajit.c
>>> @@ -72,6 +72,7 @@ static void print_usage(void)
>>> " -O[opt] Control LuaJIT optimizations.\n"
>>> " -i Enter interactive mode after executing " LUA_QL("script") ".\n"
>>> " -v Show version information.\n"
>>> + " -t[cmd] Execute tool.\n"
>>
>>According to usage cmd after -t option is optional. However without cmd
>>luajit prints usage
>>
>>that hints about incorrect usage:
>>
>>
>>[0] ~/sources/MRG/tarantool/third_party/luajit$ ./src/luajit -t
>>usage: ./src/luajit [options]... [script [args]...].
>>Available options are:
>>   -e chunk  Execute string 'chunk'.
>>   -l name   Require library 'name'.
>>   -b ...    Save or list bytecode.
>>   -j cmd    Perform LuaJIT control command.
>>   -O[opt]   Control LuaJIT optimizations.
>>   -i        Enter interactive mode after executing 'script'.
>>   -v        Show version information.
>>   -t[cmd]   Execute tool.
>>   -E        Ignore environment variables.
>>   --        Stop handling options.
>>   -         Execute stdin and stop handling options.
>Fixed! Branch is force-pushed, here is the diff:
>=========================================================
>diff --git a/src/luajit.c b/src/luajit.c
>index d335f32b..c16138f0 100644
>--- a/src/luajit.c
>+++ b/src/luajit.c
>@@ -72,7 +72,7 @@ static void print_usage(void)
>   "  -O[opt]   Control LuaJIT optimizations.\n"
>   "  -i        Enter interactive mode after executing " LUA_QL("script") ".\n"
>   "  -v        Show version information.\n"
>-  "  -t[cmd]   Execute tool.\n"
>+  "  -t(cmd)   Execute tool.\n"
>   "  -E        Ignore environment variables.\n"
>   "  --        Stop handling options.\n"
>   "  -         Execute stdin and stop handling options.\n", stderr);
>=========================================================
>>
>><snipped>
>>> +end
>>> +
>>> +generate_output(TMP_BINFILE, default_payload)
>>> +
>>> +local errcode = os.execute(EXECUTABLE .. ' -tinvalid ' .. TMP_BINFILE)
>>> +test:ok(errcode ~= 0, 'invalid tool flag')
>>> +
>>> +errcode = os.execute(EXECUTABLE .. ' -tm ' .. BAD_PATH)
>>> +test:ok(errcode ~= 0, 'binfile does not exist')
>>> +
>>> +errcode = os.execute(EXECUTABLE .. ' -tm ' .. TMP_BINFILE)
>>> +test:ok(errcode == 0, 'memprof binfile parsing')
>>Nit: probably it is worth adding  checks for output.
>>> +
>>> +os.remove(TMP_BINFILE)
>>> +os.exit(test:check() and 0 or 1)
>>> --
>>> 2.39.2 (Apple Git-143)
>>>
>--
>Best regards,
>Maxim Kokryashkin
> 

[-- Attachment #2: Type: text/html, Size: 5361 bytes --]

  reply	other threads:[~2023-07-14 12:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10 11:24 Maksim Kokryashkin via Tarantool-patches
2023-07-11 13:06 ` Sergey Bronnikov via Tarantool-patches
2023-07-14 12:41   ` Maxim Kokryashkin via Tarantool-patches [this message]
2023-07-28 15:30     ` Sergey Bronnikov via Tarantool-patches
2023-07-29 16:24       ` Igor Munkin via Tarantool-patches
2023-07-15 11:35 ` Sergey Kaplun via Tarantool-patches
2023-08-01 15:45 ` Igor Munkin via Tarantool-patches
2023-08-02  7:23 ` Igor Munkin via Tarantool-patches
2023-08-02  7:59   ` Maxim Kokryashkin via Tarantool-patches
2023-08-02  8:12     ` Igor Munkin via Tarantool-patches
2023-08-02  8:32       ` Maxim Kokryashkin 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=1689338470.607537260@f763.i.mail.ru \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=m.kokryashkin@tarantool.org \
    --cc=max.kokryashkin@gmail.com \
    --cc=sergeyb@tarantool.org \
    --subject='Re: [Tarantool-patches]  [PATCH luajit v7] memprof: introduce cli flag to run dump parser' \
    /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