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 DB6474F8198; Sun, 9 Jul 2023 15:17:01 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DB6474F8198 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1688905022; bh=Tvqwe2LGNvjr3Hra2golpx8PsOOYmpvDkvQaBAurtI4=; 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=abdBZwlkW8+heg/qbWaJatTadFHOahzmrvqsVIclRO0YlkVKwb8iH9cPM2QrI/MTQ 0Pmc0Gw+mdS6sk310NL4ilCnsJkU491YWbRhW6+Q+ZRaa0jJWUPBUZrByp6/hjnljN avpIgVkK1vRIjhOfLmVVDk76EyBVxINjZWI9Kw4k= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [94.100.177.149]) (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 9FE9E49C4A1 for ; Sun, 9 Jul 2023 15:17:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9FE9E49C4A1 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1qITLX-0002f9-G4; Sun, 09 Jul 2023 15:17:00 +0300 Date: Sun, 9 Jul 2023 15:12:38 +0300 To: Maxim Kokryashkin Message-ID: References: <20230705122541.405023-1-m.kokryashkin@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230705122541.405023-1-m.kokryashkin@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9F6142ABD4516DDC521D9E2619497CD7C3561FFD4158A37B9182A05F538085040DA224F5635738ADFA8E9431DA1B56F1BCA0D75969532B3D287840B268E04906A X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE721AF84DC1D70954DEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006376CE4E8B6A85920B98638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D87CB90F12298CCE9B1879F54BC7C81F56117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520CCD848CCB6FE560C618001F51B5FD3F9D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6B1CFA6D474D4A6A4089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A534E8EE83F11AC4734F6200681F2BC9742F4C7C2E33D5A4EFF87CCE6106E1FC07E67D4AC08A07B9B0CE135D2742255B35CB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF3467209570F2A0B0302A1678D713B641651D17C2E8DC4E6CEF367A7D9D949EAAEC58EB6354A2D53A84815E46D7AAED538D2352F58AD63B4206F703DD19FF87ACA74DFFEFA5DC0E7F02C26D483E81D6BE5EF9655DD6DEA7D65774BB76CC95456EEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojREMDzwhiTMbbBtgs0LP8pQ== X-DA7885C5: CC4295A5642AAFEA9DA0A5219C9DCEA1BFE936ADAD209537D7737BF17AF7898E262E2D401490A4A0DB037EFA58388B346E8BC1A9835FDE71 X-Mailru-Sender: 689FA8AB762F73930F533AC2B33E986BE0CBFCCD8C770DEE66655E1351FACAD50FBE9A32752B8C9C2AA642CC12EC09F1FB559BB5D741EB962F61BD320559CF1EFD657A8799238ED55FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit v6] 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 Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Maxim! Thanks for the fixes! LGTM, after fixing the comments below. On 05.07.23, Maxim Kokryashkin wrote: > 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 v6: > - Simplified the patch. It's really nice that we don't use any tricks with the environment now! Good job! > > 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 | 31 ++++++++++- > .../gh-5688-memprof-cli-flag.test.lua | 55 +++++++++++++++++++ > 2 files changed, 85 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..81c0f8af 100644 > --- a/src/luajit.c > +++ b/src/luajit.c > +static int dotoolcmd(lua_State *L, const char *cmd) > +{ > + if(strcmp(cmd, "m") == 0) { Typo: s If run with invalid cli flag value there is no error message shown. | >>> src/luajit -tblabla /tmp/t.lua | 14:56:56 jobs:0 burii@root:~/reviews/luajit/cli-flags$[1] It will be nice to see some test for it. > + lua_getglobal(L, "require"); > + lua_pushliteral(L, "memprof"); > + if (lua_pcall(L, 1, 1, 0)) { > + const char *msg = lua_tostring(L, -1); > + if (msg && !strncmp(msg, "module ", 7)) > + l_message(progname, > + "unknown luaJIT command or tools not installed"); May be it is better to say that: "tools.* modules not installed", since it isn't LuaJIT command. > + return 1; > + } > + lua_getglobal(L, "arg"); > + return report(L, lua_pcall(L, 1, 1, 0)); > + } > + return -1; > +} > + > diff --git a/test/tarantool-tests/gh-5688-memprof-cli-flag.test.lua b/test/tarantool-tests/gh-5688-memprof-cli-flag.test.lua > new file mode 100644 > index 00000000..ba0cad68 > --- /dev/null > +++ b/test/tarantool-tests/gh-5688-memprof-cli-flag.test.lua > @@ -0,0 +1,55 @@ > +local tap = require('tap') > +local test = tap.test('gh-5688-cli-for-memprof-parse'):skipcond({ > + ['Memprof is implemented for x86_64 only'] = jit.arch ~= 'x86' and > + jit.arch ~= 'x64', > + ['Memprof is implemented for Linux only'] = jit.os ~= 'Linux', Side note: I suppose that this is because memprof use symbol table dump for C functions. But there is no table dumped for OSX. But this isn't a reason to restrict memprof usage for this platform -- we can still report C symbols as raw addresses, like it was done before. May you, please, create a ticket for it (or for dumping C symbols for OSX as well if you prefer this way :))? > +-- XXX: The patch is for LuaJIT only, and it doesn't > -- > 2.40.1 > -- Best regards, Sergey Kaplun