<HTML><BODY><div>Hi! I have one more question:<br><br>How should we properly test the behavior of profiler recording allocations from traces?<br>Now I can write test which roughly estimates number of allocations in loop:</div><div> </div><div><div>| local function payload()<br>|   -- Preallocate table to avoid table array part reallocations.<br>|   local _ = table_new(100, 0)</div><div>|   -- Want too see 100 objects here.<br>|   for i = 1, 100 do<br>|     -- Try to avoid crossing with "test" module objects.<br>|     _[i] = "memprof-str-"..i<br>|   end</div><div>|   _ = nil<br>|   -- VMSTATE == GC, reported as INTERNAL.<br>|   collectgarbage()<br>| end<br> </div>| jit.on() <br>| symbols, events = `run_payload_under_memprof_and_parse`()</div><div>| alloc = `get_all_alloc_events`(symbols, events)<br>| test:ok(alloc[`line_where_loop_starts`].num > `some_guaranteed_number`)</div><div><br>But I think it will be great if we could replace > sign with ==. The problem is we cannot guarantee</div><div>constant number of allocations in the loop: on the most of platforms with `jit.opt.start(‘’hotloop=1’’, ‘’-sink’’)`</div><div>I get 97 allocations in 100-iteration loop, as we spend some iterations to compile the trace. But on freebsd,</div><div>for example, I get 24 allocations. ​​​​</div><div> </div><div>--<br>Best regards,<br>Mikhail Shishatskiy</div><div> </div><div> </div><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;">Среда, 21 июля 2021, 14:48 +03:00 от Sergey Kaplun <skaplun@tarantool.org>:<br> <div id=""><div class="js-helper js-readmsg-msg"><div><div id="style_16268681191564136589_BODY">Hi! Thanks for the patch!<br>Please consider my comments below.</div></div></div></div></blockquote><div> </div><div><snipped></div><div> </div><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;"><div><div class="js-helper js-readmsg-msg"><div><div>--<br>Best regards,<br>Sergey Kaplun</div></div></div></div></blockquote><div> </div></BODY></HTML>