Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Bronnikov <estetus@gmail.com>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit 7/7] memprof: set default path to profiling output file
Date: Tue, 18 Feb 2025 14:55:02 +0300	[thread overview]
Message-ID: <Z7R1FurubN_9WOiM@root> (raw)
In-Reply-To: <e873be7dce1efccfb6d323266f7de6ff5e5d29c0.1739444510.git.sergeyb@tarantool.org>

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

<snipped>

> 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

  reply	other threads:[~2025-02-18 11:55 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-13 11:10 [Tarantool-patches] [PATCH luajit 0/7][v2] Fix profilers issues Sergey Bronnikov via Tarantool-patches
2025-02-13 11:10 ` [Tarantool-patches] [PATCH luajit 1/7][v2] test: add descriptions to sysprof testcases Sergey Bronnikov via Tarantool-patches
2025-02-18 11:04   ` Sergey Kaplun via Tarantool-patches
2025-02-13 11:10 ` [Tarantool-patches] [PATCH luajit 2/7] sysprof: align test title with test filename Sergey Bronnikov via Tarantool-patches
2025-02-18 11:10   ` Sergey Kaplun via Tarantool-patches
2025-02-18 14:02     ` Sergey Bronnikov via Tarantool-patches
2025-02-13 11:10 ` [Tarantool-patches] [PATCH luajit 3/7][v2] sysprof: fix typo in the comment Sergey Bronnikov via Tarantool-patches
2025-02-18 11:10   ` Sergey Kaplun via Tarantool-patches
2025-02-13 11:10 ` [Tarantool-patches] [PATCH luajit 4/7][v2] sysprof: introduce specific errors and default mode Sergey Bronnikov via Tarantool-patches
2025-02-18 15:43   ` Sergey Kaplun via Tarantool-patches
2025-02-19  9:34     ` Sergey Bronnikov via Tarantool-patches
2025-02-19 15:20       ` Sergey Kaplun via Tarantool-patches
2025-02-19 16:08       ` Sergey Bronnikov via Tarantool-patches
2025-02-13 11:10 ` [Tarantool-patches] [PATCH luajit 5/7] ci: add workflow with disabled profilers Sergey Bronnikov via Tarantool-patches
2025-02-18 12:10   ` Sergey Kaplun via Tarantool-patches
2025-02-18 14:14     ` Sergey Bronnikov via Tarantool-patches
2025-02-13 11:10 ` [Tarantool-patches] [PATCH luajit 6/7] misc: specific message for " Sergey Bronnikov via Tarantool-patches
2025-02-19  8:06   ` Sergey Kaplun via Tarantool-patches
2025-02-19 12:53     ` Sergey Bronnikov via Tarantool-patches
2025-02-19 15:41       ` Sergey Kaplun via Tarantool-patches
2025-02-19 15:56         ` Sergey Bronnikov via Tarantool-patches
2025-02-13 11:10 ` [Tarantool-patches] [PATCH luajit 7/7] memprof: set default path to profiling output file Sergey Bronnikov via Tarantool-patches
2025-02-18 11:55   ` Sergey Kaplun via Tarantool-patches [this message]
2025-02-18 14:20     ` 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=Z7R1FurubN_9WOiM@root \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=estetus@gmail.com \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 7/7] memprof: set default path to profiling output file' \
    /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