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 B3C5E6ECE3; Sat, 16 Jul 2022 10:35:16 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B3C5E6ECE3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1657956916; bh=cja49GVFXYE0yFcXGqIXqOlHZDOD1R/pSDrIWjHKBiI=; 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=CkKpP23M7otDZrDXZ0Z88YhE+yztS7TeieeNqrJqM9uG35VFXvwYJMgUkJdopI+Fm FvCsXD6DxfZDpj5pcnyhc2NsAN0Vwk4Vk9NouGcsIHDG8vAnMz4Ze4ETU0kQvmjpGf ySl9RYhttQ0ILJPwzjdZbYcOSZ8r8809HNG7YG+M= Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [94.100.181.251]) (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 CEFBD6ECE3 for ; Sat, 16 Jul 2022 10:35:15 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org CEFBD6ECE3 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1oCcKY-0007vK-Sz; Sat, 16 Jul 2022 10:35:15 +0300 Date: Sat, 16 Jul 2022 10:32:53 +0300 To: Maxim Kokryashkin Message-ID: References: <83b89e5c769469d19f0bc9144667685801f3cb51.1656883823.git.m.kokryashkin@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83b89e5c769469d19f0bc9144667685801f3cb51.1656883823.git.m.kokryashkin@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD910A510B04B6817B6F106AEB2F97A1EDD9BFA8A287B205D79182A05F5380850404C228DA9ACA6FE275F4A3A978A3217A0A27E61FB2C1BBB2ECEDFCE5FC000580791C9D7A1E8E5A7B2 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE71BDE6A359BD5B800EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063748789019239639CB8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8DF0E01B1CD1B1329578952772AB57EF9117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCD215BE4436AF2686A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD182CC0D3CB04F14752D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6AC294AFEFA671E80089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-8FC586DF: 6EFBBC1D9D64D975 X-C1DE0DAB: 9604B64F49C60606AD91A466A1DEF99B296C473AB1E142185AC9E3593CE4B31AB1881A6453793CE9274300E5CE05BD4401A9E91200F654B03D517A56EBCFBDE7D71D610BA8056A10BC8E1A1E96B5449946CFF0F5A0B7395D9C2B6934AE262D3EE7EAB7254005DCED8DA55E71E02F9FC08E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D342E8FEDBD32DECB6D07832CDCAC451159178E9789E96A0A689EF4D6A2D5428DF4AB1499CADA7C47AB1D7E09C32AA3244C415A17206B803DF558C0F6FB1B6589E38580396430872480927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj/I4vCLMdMHBXWk4zGJU2+A== X-Mailru-Sender: 689FA8AB762F7393CC2E0F076E87284E816DA13DD4354326872A28DA0B003BF50FBE9A32752B8C9C2AA642CC12EC09F1FB559BB5D741EB962F61BD320559CF1EFD657A8799238ED55FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 2/2] sysprof: add stack sandwich support 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 patch! LGTM, except a few nits below. On 04.07.22, Maxim Kokryashkin wrote: > This commit introduces stack sandwich support to the > sysprof's parser. > > Sandwich is handled the following way: Typo: s/Sandwich/The sandwich/ > 1. If there is a `lua_cpcall` in the C stack trace, nothing > is done on the C stack and the corresponding frame on the > Lua stack is removed. > 2. If there is a `lua_call`/`lua_pcall`, then next chunk of Typo: s/next chunk/the next chunk/ > frames is from the Lua stack. That chunk ends with either > a CFUNC, or a stack trace end. > > Resolves tarantool/tarantool#7244 > --- > tools/sysprof/collapse.lua | 31 +++++++++++++++++++------------ > 1 file changed, 19 insertions(+), 12 deletions(-) > > diff --git a/tools/sysprof/collapse.lua b/tools/sysprof/collapse.lua > index b0c4afc8..b815baf3 100755 > --- a/tools/sysprof/collapse.lua > +++ b/tools/sysprof/collapse.lua > @@ -39,9 +39,11 @@ local function insert(name, node, is_leaf) > end > > local function insert_lua_callchain(chain, lua, symbols) > end > + table.remove(lua.callchain, ins_cnt) > end > > + Nit: looks like this newline is excess. > -- merge lua and host callchains into one callchain representing > -- transfer of control > local function merge(event, symbols, sep_vmst) > local cc = {} > - local lua_inserted = false > > for _,h_fr in pairs(event.host.callchain) do > local name_host = symtab.demangle(symbols, { > addr = h_fr.addr, > gen = h_fr.gen > }) > + table.insert(cc, 1, { name = name_host }) > > - -- We assume that usually the transfer of control > - -- looks like: > - -- HOST -> LUA -> HOST > - -- so for now, lua callchain starts from lua_pcall() call > - if name_host == 'lua_pcall' then > - insert_lua_callchain(cc, event.lua, symbols) > - lua_inserted = true > + if string.match(name_host, '^lua_cpcall') ~= nil then Why do we use `string.match()` instead `==`? > + -- Any C function is present on both the C and the Lua > + -- stacks. It is more convenient to get its info from the host stack, > + -- since it has information about child frames. > + table.remove(event.lua.callchain, 1) > end > > - table.insert(cc, 1, { name = name_host }) > - end > + if string.match(name_host, '^lua_p?call') ~= nil then I suggest to check full function name, so use '^lua_p?call$' as pattern instead. > + insert_lua_callchain(cc, event.lua, symbols) > + end > > - if lua_inserted == false then > - insert_lua_callchain(cc, event.lua, symbols) > end > > if sep_vmst == true then > -- > 2.36.1 > -- Best regards, Sergey Kaplun