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 7700DF3CD4C; Tue, 18 Feb 2025 14:55:47 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7700DF3CD4C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1739879747; bh=tssAtqmLBd7s4YoMOp/iN+tbBpVueXdls9pXuWvu1h8=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=KUVFetP3XmlwVys6nm06enPr/9KosLCYveyi+Fw+oePB3ObwY8cEyJsirp7tt9S4A efRGTdc/8FaRuxHoAGakU0y3OHNj0A5HdM9XUwC70MovAGK+9GKDo8BlmQaMFSwTcs N+R339KuxqnBqBu3ljjizo+kjgnEVXlJWJCkyNig= Received: from send126.i.mail.ru (send126.i.mail.ru [89.221.237.221]) (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 57FDDF3CD40 for ; Tue, 18 Feb 2025 14:55:45 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 57FDDF3CD40 Received: by exim-smtp-844687bc8-gt94l with esmtpa (envelope-from ) id 1tkMCW-00000000P1M-0owa; Tue, 18 Feb 2025 14:55:44 +0300 Date: Tue, 18 Feb 2025 14:55:02 +0300 To: Sergey Bronnikov Cc: tarantool-patches@dev.tarantool.org Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD916C41472748AFA0453D9C7FE68DF4451D80261D9949172CF00894C459B0CD1B9C71EEC1B4C105B3C06104296DCCA83D26248F69C26666A0308DD188BAB19602E2208A4954BE01924 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE757AEC41D7AA04458EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637416EC277BB71E4518638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8B469E83BC84FB07226C785A3D950FB03832CEF465C0596F2CC7F00164DA146DAFE8445B8C89999728AA50765F790063783E00425F71A4181389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC80CABCCA60F52D7EBF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8BDCE939D40DBB93CA75ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A566D0107017B035215002B1117B3ED6965E2304B3EDBD5A3D250A03108B67251B823CB91A9FED034534781492E4B8EEAD9DB614F8F96CFA30BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADBF74143AD284FC7177DD89D51EBB7742424CF958EAFF5D571004E42C50DC4CA955A7F0CF078B5EC49A30900B95165D34F1257DC9690AEBA136D523960F26AD9496D6A90C76BA0FB7B67D34F2E6102B78E5D62AC2B7A66AEE1D7E09C32AA3244CFFD913806243439B77DD89D51EBB7742B3272EDD56D0C4F1EA455F16B58544A2E30DDF7C44BCB90DA5AE236DF995FB59829709634694AABAED6A17656DB59BCAD427812AF56FC65B X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVWiyXSWEEqdrheZJOHmWKlg= X-DA7885C5: 7B67AF256095F1E3F255D290C0D534F940965DBC7FFA05E6DF92C624EE730650D6D10F4E6C887F8C5B1A4C17EAA7BC4BEF2421ABFA55128DAF83EF9164C44C7E X-Mailru-Sender: 689FA8AB762F739381B31377CF4CA21929F9CBA8C3B8BBEE3826E429607D99CDA00FA954464540A6E49D44BB4BD9522A059A1ED8796F048DB274557F927329BE89D5A3BC2B10C37545BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 7/7] memprof: set default path to profiling output file 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 Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey! Thanks for the patch! LGTM, with a minor nits below. On 13.02.25, Sergey Bronnikov wrote: > sysprof has an optional parameter `path`, that set a path to Typo: s/set/sets/ > profiling output file, by default the path is `sysprof.bin`. Typo: s/profiling/the profiling/ Typo: s/file, by default/file. By default,/ > `misc.memprof.start()` requires to set a path to profiling output Typo: s/to set/setting/ Typo: s/profiling/the profiling/ > file. The patch fixes this inconsistency by introducing a default > path to memprof profiling output file - `memprof.bin`. Typo: s/memprof/the memprof/ > --- > src/lib_misc.c | 5 ++- > ...misclib-memprof-lapi-default-file.test.lua | 41 +++++++++++++++++++ > 2 files changed, 45 insertions(+), 1 deletion(-) > create mode 100644 test/tarantool-tests/profilers/misclib-memprof-lapi-default-file.test.lua > > diff --git a/src/lib_misc.c b/src/lib_misc.c > index 7666d85f..4f5d72fc 100644 > --- a/src/lib_misc.c > +++ b/src/lib_misc.c > diff --git a/test/tarantool-tests/profilers/misclib-memprof-lapi-default-file.test.lua b/test/tarantool-tests/profilers/misclib-memprof-lapi-default-file.test.lua > new file mode 100644 > index 00000000..b6233d4a > --- /dev/null > +++ b/test/tarantool-tests/profilers/misclib-memprof-lapi-default-file.test.lua > @@ -0,0 +1,41 @@ > +local tap = require("tap") Minor: Let's use single quotes here and below. Side note: This code style part wasn't fixed when the first tests for memprof was written. > +local test = tap.test("misc-memprof-lapi-default-file"):skipcond({ > + ["Memprof is implemented for x86_64 only"] = jit.arch ~= "x86" and > + jit.arch ~= "x64", > + ["Memprof is disabled"] = os.getenv('LUAJIT_DISABLE_MEMPROF'), > +}) > + > +test:plan(1) > + > +local tools = require "utils.tools" Minor: Please use brackets for function calls. > + > +test:test("default-output-file", function(subtest) > + > + subtest:plan(1) > + > + local def_output_file = 'memprof.bin' Minor: s/def/default/ > + os.remove(def_output_file) > + > + local res, err = misc.memprof.start() > + -- Should start successfully. > + assert(res, err) This assert should be removed since we want to remove the file in case of an error (for example, we can't write the memprof prologue). > + > + res, err = misc.memprof.stop() > + -- Should stop successfully. > + assert(res, err) This assert should be removed since we want to remove the file in case of an error. > + > + -- Want to cleanup carefully if something went wrong. > + if not res then > + os.remove(def_output_file) > + error(err) > + end > + > + local profile_buf = tools.read_file(def_output_file) > + subtest:ok(profile_buf ~= nil and #profile_buf ~= 0, > + 'default output file is not empty') > + > + -- We don't need it any more. > + os.remove(def_output_file) > +end) > + > +test:done(true) > -- > 2.34.1 > -- Best regards, Sergey Kaplun