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 706095F02CF; Thu, 7 Sep 2023 12:41:09 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 706095F02CF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1694079669; bh=JcRLVa87p0+SA+wncEdJ+JAHHZoLL10Bt+1UMtivC0M=; 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=qQkE51PBFtNLee2vZWymv/Tltm31Pykl5NsUTH58peoy2IzSIrFYUQ/4hhaO1Cife 7t0dH7shWIFCb9tgxhXuZk4ZYsuD8rtX2IN2WjWuk4qTQK8DZt4LbtANWTvkxaZUDN JO1/hwXU3/ISogSOfYuKRmkWvqzqPxmj/P1TCtSU= Received: from smtp37.i.mail.ru (smtp37.i.mail.ru [95.163.41.78]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 69EB75EF42C for ; Thu, 7 Sep 2023 12:41:08 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 69EB75EF42C Received: by smtp37.i.mail.ru with esmtpa (envelope-from ) id 1qeBVb-008TBI-0O; Thu, 07 Sep 2023 12:41:07 +0300 Message-ID: Date: Thu, 7 Sep 2023 12:41:06 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Content-Language: en-US To: Maxim Kokryashkin , tarantool-patches@dev.tarantool.org, skaplun@tarantool.org References: <1b01124ea966b486d9462dea0d3653a45c4f81b1.1693481682.git.m.kokryashkin@tarantool.org> In-Reply-To: <1b01124ea966b486d9462dea0d3653a45c4f81b1.1693481682.git.m.kokryashkin@tarantool.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD96E142CFC92DB15CDE87830E258C493C61F3CEBBE49E3D68C182A05F5380850409EA1C7E19B881E8EE7C6E1C72507E71DFA3E31760EF9E6EEAEBE47222F53BDF0 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE70043D879A87EF1BCEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006370D24454B2F95E3848638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8E762391283072B9DCCFB40F3D27E911A117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCE1488AC3D4DED311A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18BDFBBEFFF4125B51D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE26055571C92BF10F2882943172349060D8FC6C240DEA76429C9F4D5AE37F343AA9539A8B242431040A6AB1C7CE11FEE3C6602A96AF88C695040F9FF01DFDA4A8C4224003CC836476E2F48590F00D11D6E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F79006379FC65886B7F75608EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A50F52AD3C905CFED6A1BB37B14240EA52A88BB39C071A5889F87CCE6106E1FC07E67D4AC08A07B9B0893991AD1F2BFC6ACB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF445ACE51D290BC92909AFEBFE57B78727FD4D830FB5C37006EC727642EE084646D10329F4AAC8FAE8757DCF1EFBC4EA7B237658D3D34514D6530DF1C3528C90DA74DFFEFA5DC0E7F02C26D483E81D6BE0DBAE6F56676BC7117BB6831D7356A2DEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojAl6H1x/OglJTjMvmgcbe9w== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A769C2C16A66C4ACEDA7E7C6E1C72507E71D7958A49548C749F6EBA65886582A37BD66FEC6BF5C9C28D98A98C1125256619760D574B6FC815AB872D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit v9 1/2] tools: add cli flag to run profile dump parsers 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" Hi, Max On 8/31/23 14:35, Maxim Kokryashkin wrote: > It is really inconvenient to use a standalone shell script to parse > binary dumps from profilers. That is why this commit introduces a > CLI flag for tools in the LuaJIT, so now it is possible to parse > a memprof dump as simple as: > ``` > luajit -tm memprof.bin > luajit -tm --leak-only memprof.bin > ``` > > And the sysprof too: > ``` > luajit -ts sysprof.bin > luajit -ts --split sysprof.bin $ ./build/src/luajit -ts --split sysprof.bin luajit-parse-sysprof.lua: ERROR: unrecognized option `--split'. Try `--help'. > ``` > > The `luajit-parse-memprof` and `luajit-parse-sysprof` are purged > as a result of these changes. Typo: s/The/The scripts/ > > Closes tarantool/tarantool#5688 > --- > diff --git a/src/luajit.c b/src/luajit.c > index 3a3ec247..f57b7e95 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 Execute tool.\n" When I run "luajit -b" without arguments LuaJIT shows me a usage for "-b": [0] ~/sources/MRG/tarantool/third_party/luajit$ ./build/src/luajit -b Save LuaJIT bytecode: luajit -b[options] input output   -l        Only list bytecode.   -s        Strip debug info (default).   -g        Keep debug info.   -n name   Set module name (default: auto-detect from input name).   -t type   Set output file type (default: auto-detect from output name).   -a arch   Override architecture for object files (default: native).   -o os     Override OS for object files (default: native).   -e chunk  Use chunk string as input.   --        Stop handling options.   -         Use stdin as input and/or stdout as output. File types: c h obj o raw (default) When I run "luajit -t" without arguments LuaJIT shows me the same usage, that is not helpful: [0] ~/sources/MRG/tarantool/third_party/luajit$ ./build/src/luajit -t usage: ./build/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   Execute tool.   -E        Ignore environment variables.   --        Stop handling options.   -         Execute stdin and stop handling options. Please show a usage with available arguments for "-t": Parse profile dump: luajit -t[options] input   -m       parse memprof dump.   -s        parse sysprof dump (default).   --leak-only ...   --split ... > " -E Ignore environment variables.\n" > " -- Stop handling options.\n" > " - Execute stdin and stop handling options.\n", stderr); > @@ -361,6 +362,37 @@ static int dojitcmd(lua_State *L, const char *cmd) > return runcmdopt(L, opt ? opt+1 : opt); > } > > diff --git a/test/tarantool-tests/gh-5688-tool-cli-flag.test.lua b/test/tarantool-tests/gh-5688-tool-cli-flag.test.lua > new file mode 100644 > index 00000000..4dc4f6a1 > --- /dev/null > +++ b/test/tarantool-tests/gh-5688-tool-cli-flag.test.lua > @@ -0,0 +1,127 @@ > +local tap = require('tap') > +local test = tap.test('gh-5688-tool-cli-flag'):skipcond({ > + ['Profile tools are implemented for x86_64 only'] = jit.arch ~= 'x86' and > + jit.arch ~= 'x64', indentation > + ['Profile tools are implemented for Linux only'] = jit.os ~= 'Linux', > + -- XXX: Tarantool integration is required to run this test properly. > + -- luacheck: no global > + ['No profile tools CLI option integration'] = _TARANTOOL, > +}) > + > +test:plan(3) > + > +jit.off() > +jit.flush() > + > +local table_new = require('table.new') > +local utils = require('utils') > + > +local BAD_PATH = utils.tools.profilename('bad-path-tmp.bin') > +local TMP_BINFILE_MEMPROF = utils.tools.profilename('memprofdata.tmp.bin') > +local TMP_BINFILE_SYSPROF = utils.tools.profilename('sysprofdata.tmp.bin') > + > +local EXECUTABLE = utils.exec.luacmd(arg) > +local MEMPROF_PARSER = EXECUTABLE .. ' -tm ' > +local SYSPROF_PARSER = EXECUTABLE .. ' -ts ' > + > +local REDIRECT_OUTPUT = ' 2>&1' > + > +local TABLE_SIZE = 20 > + > +local SMOKE_CMD_SET = { > + { > + cmd = EXECUTABLE .. ' -t ' .. BAD_PATH, > + -- luacheck: no global > + like = _TARANTOOL and '.+unknown tool command' or 'usage:.+', Let's define this global in .luacheckrc. I think we will use _TARANTOOL more and this inline suppressions will be annoying.