From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Maxim Kokryashkin <max.kokryashkin@gmail.com>, tarantool-patches@dev.tarantool.org, skaplun@tarantool.org Subject: Re: [Tarantool-patches] [PATCH luajit v9 1/2] tools: add cli flag to run profile dump parsers Date: Thu, 7 Sep 2023 12:41:06 +0300 [thread overview] Message-ID: <f6707a2d-8a6e-408a-d8e7-dbff1318a287@tarantool.org> (raw) In-Reply-To: <1b01124ea966b486d9462dea0d3653a45c4f81b1.1693481682.git.m.kokryashkin@tarantool.org> 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 > --- <snipped> > 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<cmd> 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<cmd> 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); > } > <snipped> > 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. <no obvious problems, snipped>
next prev parent reply other threads:[~2023-09-07 9:41 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-08-31 11:35 [Tarantool-patches] [PATCH luajit v9 0/2] introduce cli for tools Maxim Kokryashkin via Tarantool-patches 2023-08-31 11:35 ` [Tarantool-patches] [PATCH luajit v9 1/2] tools: add cli flag to run profile dump parsers Maxim Kokryashkin via Tarantool-patches 2023-09-03 9:50 ` Sergey Kaplun via Tarantool-patches 2023-09-04 9:30 ` Maxim Kokryashkin via Tarantool-patches 2023-09-07 9:41 ` Sergey Bronnikov via Tarantool-patches [this message] 2023-09-12 20:03 ` Maxim Kokryashkin via Tarantool-patches 2023-09-14 9:22 ` Sergey Bronnikov via Tarantool-patches 2023-09-18 8:51 ` Maxim Kokryashkin via Tarantool-patches 2023-10-04 8:58 ` Sergey Bronnikov via Tarantool-patches 2023-10-04 11:49 ` Maxim Kokryashkin via Tarantool-patches 2023-10-06 8:26 ` Sergey Bronnikov via Tarantool-patches 2023-11-23 6:33 ` Igor Munkin via Tarantool-patches 2023-08-31 11:35 ` [Tarantool-patches] [PATCH luajit v9 2/2] test: don't skip tool CLI flag for tarantool Maxim Kokryashkin via Tarantool-patches 2023-09-03 9:54 ` Sergey Kaplun via Tarantool-patches 2023-09-07 9:42 ` Sergey Bronnikov 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=f6707a2d-8a6e-408a-d8e7-dbff1318a287@tarantool.org \ --to=tarantool-patches@dev.tarantool.org \ --cc=max.kokryashkin@gmail.com \ --cc=sergeyb@tarantool.org \ --cc=skaplun@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH luajit v9 1/2] tools: add cli flag to run profile dump parsers' \ /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