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 014CE524D76; Tue, 11 Jul 2023 16:06:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 014CE524D76 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1689080782; bh=5Y1EEjw25VOrSSt6IDtSHLHOtvyZsPC7Jq42VMORceU=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=kLfWZd2ulFn4Wj0i+MQyvNpRj+CjmkC2YJG7gvz7KahWIPEI+7dCLfnpWT4Vaj54E xIOM4Ka0AWW1EiCb6lxwBg2IyktWdda8jwOJmFWgGH9U6vvPnysHr6zPgxHxc/0kKF qQXQV0p9wMUlX9iU7emt/GWbmbDJEAYaGZh7OwnU= Received: from smtp34.i.mail.ru (smtp34.i.mail.ru [95.163.41.75]) (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 5EE744457FA for ; Tue, 11 Jul 2023 16:06:20 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5EE744457FA Received: by smtp34.i.mail.ru with esmtpa (envelope-from ) id 1qJD4N-000Qzv-DT; Tue, 11 Jul 2023 16:06:19 +0300 Message-ID: Date: Tue, 11 Jul 2023 16:06:18 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 To: Maksim Kokryashkin , tarantool-patches@dev.tarantool.org, skaplun@tarantool.org, m.kokryashkin@tarantool.org References: <20230710112400.1802-1-max.kokryashkin@gmail.com> Content-Language: en-US In-Reply-To: <20230710112400.1802-1-max.kokryashkin@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9F6142ABD4516DDC5D33B31904FBC6732F4D25206406C97BE182A05F5380850405B778216EF661AC9F85CEF5D94B2A806CE9DD46495B89670BF5E65E8A4F01AB1 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE75AD53DF1D86BACA3EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637BBB1CE3B4DF50705EA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BE5CCB53A13BC8DBA38D601F9505BA33620A273FE8D1B61B8CC7F00164DA146DAFE8445B8C89999728AA50765F7900637D0FEED2715E18529389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC86633242DC0339950F6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947CBFD98ABA943BD70BBA3038C0950A5D36C8A9BA7A39EFB766D91E3A1F190DE8FDBA3038C0950A5D36D5E8D9A59859A8B699DB8DEEBFCC4B663AA81AA40904B5D99C9F4D5AE37F343AD1F44FA8B9022EA23BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E73542F54486E6D6388DC4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A51A21843F3D415AB55043ADA0BED0AAB7FE918816D921FDABF87CCE6106E1FC07E67D4AC08A07B9B0CE135D2742255B35CB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF9770E4D380A1DD6D0AF36F25CE209439FF46D9CF41FD308EEEFD88C2549EC22849C71475D3C80931399DF444199BC1D1826709423910A550089F405336CAFE50A74DFFEFA5DC0E7F02C26D483E81D6BE0DBAE6F56676BC7117BB6831D7356A2DEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj7en6wDTORtMwm9wJ2FPrnw== X-Mailru-Sender: 49D287FBCBBF3A5CA515715C6C0804CBAE440ADDE3F4C0F8B53536E1918E3B0F0DADA85ECE80C3AF645D15D82EE4B272BD6E4642A116CA93524AA66B5ACBE6721EF430B9A63E2A504198E0F3ECE9B5443453F38A29522196 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 Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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. > +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) >