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 605F1555445; Fri, 28 Jul 2023 18:30:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 605F1555445 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1690558222; bh=dKbB20QrGi3YLck+qc6jb96W6Nl1k2WDaeYt8le1OZk=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=K7wVqGN1O3H7qKMh3Jjiffdy5o1pEgGsN+BYGszxA8UFzmwu3g+BY9+kXjTafMTTk VJSGK5c7K2A7UaGFapNqC3En5Tu5k69jo2ConG8vyf/ubKcv7sDspMSBT61tp1k8ii 0ROhRzE7OAtuFbGSb2veYe247YA1mlNVG6mn1fh8= Received: from smtpng2.i.mail.ru (smtpng2.i.mail.ru [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 6CD144DA84B for ; Fri, 28 Jul 2023 18:30:21 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6CD144DA84B Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1qPPQ4-0000P5-Es; Fri, 28 Jul 2023 18:30:20 +0300 Content-Type: multipart/alternative; boundary="------------IcUyujIiWBcJRe0kim0z0pdL" Message-ID: <8045e529-1712-f271-046b-8ccd1bdf3a5d@tarantool.org> Date: Fri, 28 Jul 2023 18:30:20 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 To: Maxim Kokryashkin References: <20230710112400.1802-1-max.kokryashkin@gmail.com> <1689338470.607537260@f763.i.mail.ru> Content-Language: en-US In-Reply-To: <1689338470.607537260@f763.i.mail.ru> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD920919EE866B1AD249D11BE9396DBB59C6C22AC9D2D4E1A0800894C459B0CD1B9124DDE9A389CD026929FECD9D7FDC439A7DDF230CE07A9BCECAC19F6B383DD1F X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE77BF46084C0059042EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637DC205F3977E1285D8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8225916F2F92F030965EF80E43717E826117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735200AC5B80A05675ACDCB629EEF1311BF91D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269176DF2183F8FC7C08CCB3ED2A1DE2304725E5C173C3A84C36DD0439D4B94EFE535872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A51FC322358871F852E699E02F0B869B912160EBA5D4C48006F87CCE6106E1FC07E67D4AC08A07B9B0CF7CD7A0D5AA5F25CB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFA7075ABAF10D506A1F235ED4C1C8C8275C48B31B3C0D4A11AA60AC67B6BA6E1B486D6DC23143AA0E8B1A62728B433156E98595C0CA46D24E622F77BDEB25BA20A74DFFEFA5DC0E7F02C26D483E81D6BE0DBAE6F56676BC7117BB6831D7356A2DEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojIrZ+3NGB1hYD1FFm/gSUsg== X-DA7885C5: 0AF69579CD3E1958A9B8DAAF8D14F318467E230E7E5CD53FB0DB6063D1ADCCBF262E2D401490A4A0DB037EFA58388B346E8BC1A9835FDE71 X-Mailru-Sender: 689FA8AB762F73930F533AC2B33E986BA7D7F6806F904D62F48B1E062F2250B3DD788429FD8613638ED9BB8B05EE7B3AFB559BB5D741EB96D19CD4E7312BAA970A04DAD6CC59E3365FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit v7] memprof: introduce cli flag to run dump parser 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 Cc: Maksim Kokryashkin , tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This is a multi-part message in MIME format. --------------IcUyujIiWBcJRe0kim0z0pdL Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Max, thanks for the cake patches! LGTM On 7/14/23 15:41, Maxim Kokryashkin wrote: > 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 > > > > > 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); > ========================================================= > > > > > +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 > --------------IcUyujIiWBcJRe0kim0z0pdL Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Max, thanks for the <s>cake</s> patches! LGTM


On 7/14/23 15:41, Maxim Kokryashkin wrote:
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
 
--------------IcUyujIiWBcJRe0kim0z0pdL--