[Tarantool-patches] [PATCH luajit v1] memprof: group allocations on traces by trace number

Mikhail Shishatskiy m.shishatskiy at tarantool.org
Fri Jul 23 10:54:49 MSK 2021


Hi! I have one more question:

How should we properly test the behavior of profiler recording allocations from traces?
Now I can write test which roughly estimates number of allocations in loop:
 
| local function payload()
|   -- Preallocate table to avoid table array part reallocations.
|   local _ = table_new(100, 0)
|   -- Want too see 100 objects here.
|   for i = 1, 100 do
|     -- Try to avoid crossing with "test" module objects.
|     _[i] = "memprof-str-"..i
|   end
|   _ = nil
|   -- VMSTATE == GC, reported as INTERNAL.
|   collectgarbage()
| end
  | jit.on() 
| symbols, events = `run_payload_under_memprof_and_parse`()
| alloc = `get_all_alloc_events`(symbols, events)
| test:ok(alloc[`line_where_loop_starts`].num > `some_guaranteed_number`)

But I think it will be great if we could replace > sign with ==. The problem is we cannot guarantee
constant number of allocations in the loop: on the most of platforms with `jit.opt.start(‘’hotloop=1’’, ‘’-sink’’)`
I get 97 allocations in 100-iteration loop, as we spend some iterations to compile the trace. But on freebsd,
for example, I get 24 allocations. ​​​​
 
--
Best regards,
Mikhail Shishatskiy
 
  
>Среда, 21 июля 2021, 14:48 +03:00 от Sergey Kaplun <skaplun at tarantool.org>:
> 
>Hi! Thanks for the patch!
>Please consider my comments below.
 
<snipped>
 
>--
>Best regards,
>Sergey Kaplun
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20210723/4c7236d6/attachment.htm>


More information about the Tarantool-patches mailing list